Location equality

This commit is contained in:
ClemensFischer 2026-01-25 11:57:14 +01:00
parent 1e13a3bffb
commit 7208cc71bd
9 changed files with 50 additions and 30 deletions

View file

@ -35,7 +35,11 @@ namespace MapControl
public double Latitude { get; }
public double Longitude { get; }
public bool Equals(double latitude, double longitude) => Latitude == latitude && Longitude == longitude;
public bool LatitudeEquals(double latitude) => Math.Abs(Latitude - latitude) < 1e-9;
public bool LongitudeEquals(double longitude) => Math.Abs(Longitude - longitude) < 1e-9;
public bool Equals(double latitude, double longitude) => LatitudeEquals(latitude) && LongitudeEquals(longitude);
public bool Equals(Location location) => location != null && Equals(location.Latitude, location.Longitude);