2018-03-06 22:22:58 +01:00
|
|
|
|
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
2025-01-01 18:57:55 +01:00
|
|
|
|
// Copyright © Clemens Fischer
|
2018-03-06 22:22:58 +01:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
2019-10-25 19:56:23 +02:00
|
|
|
|
/// <summary>
|
2022-12-01 23:49:57 +01:00
|
|
|
|
/// Replaces Windows.Foundation.Point for double floating point precision.
|
2019-10-25 19:56:23 +02:00
|
|
|
|
/// </summary>
|
2024-05-19 17:24:18 +02:00
|
|
|
|
public readonly struct Point
|
2018-03-06 22:22:58 +01:00
|
|
|
|
{
|
|
|
|
|
|
public Point(double x, double y)
|
|
|
|
|
|
{
|
|
|
|
|
|
X = x;
|
|
|
|
|
|
Y = y;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-05-19 17:24:18 +02:00
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-03-06 22:22:58 +01:00
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-01 23:49:57 +01:00
|
|
|
|
public override bool Equals(object obj)
|
2018-03-06 22:22:58 +01:00
|
|
|
|
{
|
2022-12-01 23:49:57 +01:00
|
|
|
|
return obj is Point p && this == p;
|
2018-03-06 22:22:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
|
{
|
|
|
|
|
|
return X.GetHashCode() ^ Y.GetHashCode();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|