XAML-Map-Control/MapControl/WinUI/Point.WinUI.cs
ClemensFischer 218a85316c Reworked MapProjection
Return nullable Point from LocationToMap. Use MapRect instead of WinUI/UWP Rect replacement. Drop Vector. Add Scale struct.
2022-12-02 16:50:10 +01:00

52 lines
1.2 KiB
C#

// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// © 2022 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
namespace MapControl
{
/// <summary>
/// Replaces Windows.Foundation.Point for double floating point precision.
/// </summary>
public struct Point
{
public Point(double x, double y)
{
X = x;
Y = y;
}
public double X { get; set; }
public double Y { get; set; }
public static implicit operator Windows.Foundation.Point(Point p)
{
return new Windows.Foundation.Point(p.X, p.Y);
}
public static implicit operator Point(Windows.Foundation.Point p)
{
return new Point(p.X, p.Y);
}
public static bool operator ==(Point p1, Point p2)
{
return p1.X == p2.X && p1.Y == p2.Y;
}
public static bool operator !=(Point p1, Point p2)
{
return !(p1 == p2);
}
public override bool Equals(object obj)
{
return obj is Point p && this == p;
}
public override int GetHashCode()
{
return X.GetHashCode() ^ Y.GetHashCode();
}
}
}