Struct Coordinates
- Namespace
- XENBIT.ResQueServe.Abstractions.DataStructures
- Assembly
- RQS.Abstractions.dll
public readonly struct Coordinates : IComparable<Coordinates>, IComparable, IEquatable<Coordinates>
- Implements
- Inherited Members
Constructors
Coordinates(double, double)
[JsonConstructor]
public Coordinates(double latitude, double longitude)
Parameters
Properties
Latitude
public double Latitude { get; }
Property Value
Longitude
public double Longitude { get; }
Property Value
Methods
CompareTo(object?)
public int CompareTo(object? obj)
Parameters
objobject
Returns
CompareTo(Coordinates)
public int CompareTo(Coordinates other)
Parameters
otherCoordinates
Returns
DistanceTo(Coordinates)
Calculates the distance in meters between this coordinate and another using the Haversine formula.
public double DistanceTo(Coordinates other)
Parameters
otherCoordinates
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
Equals(Coordinates)
public bool Equals(Coordinates other)
Parameters
otherCoordinates
Returns
GetHashCode()
public override int GetHashCode()
Returns
GetOpenStreetMapUrl()
Gets the OpenStreetMap URL to show the coordinates on a map.
public string GetOpenStreetMapUrl()
Returns
IsValid()
Determines whether the current coordinates (latitude and longitude) are valid.
public bool IsValid()
Returns
- bool
trueif the coordinates are within the valid range; otherwise,false.
Remarks
The method checks if both latitude and longitude are not zero. It then verifies that latitude is between -90 and 90 degrees, and longitude is between -180 and 180 degrees.
ToString()
public override string ToString()