mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Minor improvements
This commit is contained in:
parent
fe1ac924b4
commit
7b69215a30
|
|
@ -10,7 +10,7 @@ using System.Windows;
|
|||
namespace MapControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public class MapRect
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Replaces Windows.UI.Xaml.Media.Matrix to achieve necessary floating point precision.
|
||||
/// Replaces Windows.UI.Xaml.Media.Matrix for double floating point precision.
|
||||
/// </summary>
|
||||
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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue