XAML-Map-Control/MapControl/WinUI/Point.WinUI.cs

52 lines
1.3 KiB
C#
Raw Normal View History

// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
2025-01-01 18:57:55 +01:00
// Copyright © Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
namespace MapControl
{
2019-10-25 19:56:23 +02:00
/// <summary>
/// Replaces Windows.Foundation.Point for double floating point precision.
2019-10-25 19:56:23 +02:00
/// </summary>
public readonly struct Point
{
public Point(double x, double y)
{
X = x;
Y = y;
}
public double X { get; }
public double Y { get; }
2022-12-01 23:01:06 +01:00
2018-03-07 22:19:16 +01:00
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();
}
}
}