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?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(object? obj)
Parameters
objobjectAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes objin the sort order.Zero This instance occurs in the same position in the sort order as obj.Greater than zero This instance follows objin the sort order.
Exceptions
- ArgumentException
objis not the same type as this instance.
CompareTo(Coordinates)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(Coordinates other)
Parameters
otherCoordinatesAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
Equals(Coordinates)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Coordinates other)
Parameters
otherCoordinatesAn object to compare with this object.
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
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()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.