diff --git a/MapControl/Shared/MapRect.cs b/MapControl/Shared/MapRect.cs index 320c967f..d91b03ee 100644 --- a/MapControl/Shared/MapRect.cs +++ b/MapControl/Shared/MapRect.cs @@ -10,7 +10,7 @@ using System.Windows; namespace MapControl { /// - /// Map rectangle with double floating point precision, unlike Windows.Foundation.Rect does. + /// Map rectangle with double floating point precision, in contrast to Windows.Foundation.Rect. /// Used by MapProjection to convert geodetic bounding boxes to/from projected map coordinates. /// public class MapRect diff --git a/MapControl/Shared/Scale.cs b/MapControl/Shared/Scale.cs index 86b2c3f0..ca441983 100644 --- a/MapControl/Shared/Scale.cs +++ b/MapControl/Shared/Scale.cs @@ -4,7 +4,7 @@ namespace MapControl { - public struct Scale + public readonly struct Scale { public Scale(double x, double y) { @@ -12,8 +12,8 @@ namespace MapControl Y = y; } - public double X { get; set; } - public double Y { get; set; } + public double X { get; } + public double Y { get; } public static Scale operator *(double f, Scale v) { diff --git a/MapControl/WinUI/Matrix.WinUI.cs b/MapControl/WinUI/Matrix.WinUI.cs index ab3b9cfb..de898e39 100644 --- a/MapControl/WinUI/Matrix.WinUI.cs +++ b/MapControl/WinUI/Matrix.WinUI.cs @@ -2,18 +2,17 @@ // © 2022 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using ABI.Microsoft.UI.Xaml.Media; using System; #if WINUI -using XamlMedia = Microsoft.UI.Xaml.Media; +using WindowsUI = Microsoft.UI; #else -using XamlMedia = Windows.UI.Xaml.Media; +using WindowsUI = Windows.UI; #endif namespace MapControl { /// - /// Replaces Windows.UI.Xaml.Media.Matrix to achieve necessary floating point precision. + /// Replaces Windows.UI.Xaml.Media.Matrix for double floating point precision. /// public struct Matrix { @@ -34,14 +33,21 @@ namespace MapControl public double OffsetX { get; set; } public double OffsetY { get; set; } - public static implicit operator XamlMedia.Matrix(Matrix m) + public static implicit operator WindowsUI.Xaml.Media.Matrix(Matrix m) { - return new XamlMedia.Matrix(m.M11, m.M12, m.M21, m.M22, m.OffsetX, m.OffsetY); + return new WindowsUI.Xaml.Media.Matrix(m.M11, m.M12, m.M21, m.M22, m.OffsetX, m.OffsetY); + } + + public static implicit operator Matrix(WindowsUI.Xaml.Media.Matrix m) + { + return new Matrix(m.M11, m.M12, m.M21, m.M22, m.OffsetX, m.OffsetY); } public Point Transform(Point p) { - return new Point(M11 * p.X + M21 * p.Y + OffsetX, M12 * p.X + M22 * p.Y + OffsetY); + return new Point( + M11 * p.X + M21 * p.Y + OffsetX, + M12 * p.X + M22 * p.Y + OffsetY); } public void Translate(double x, double y)