mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-05 10:36:30 +01:00
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
|
using System;
|
|||
|
|
|||
|
namespace TINK.Model.Station
|
|||
|
{
|
|||
|
public class Position
|
|||
|
{
|
|||
|
private const double PRECISSION_LATITUDE_LONGITUDE = 0.000000000000001;
|
|||
|
|
|||
|
public Position()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public Position(double p_dLatitude, double p_dLongitude)
|
|||
|
{
|
|||
|
Latitude = p_dLatitude;
|
|||
|
Longitude = p_dLongitude;
|
|||
|
}
|
|||
|
|
|||
|
public double Latitude { get; private set; }
|
|||
|
|
|||
|
public double Longitude { get; private set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Compares position with a target position.
|
|||
|
/// </summary>
|
|||
|
/// <param name="p_oTarget">Target position to compare with.</param>
|
|||
|
/// <returns>True if positions are equal.</returns>
|
|||
|
public override bool Equals(object p_oTarget)
|
|||
|
{
|
|||
|
var l_oTarget = p_oTarget as Position;
|
|||
|
if (l_oTarget is null)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
return Math.Abs(Latitude - l_oTarget.Latitude) < PRECISSION_LATITUDE_LONGITUDE
|
|||
|
&& Math.Abs(Longitude - l_oTarget.Longitude) < PRECISSION_LATITUDE_LONGITUDE;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public override int GetHashCode()
|
|||
|
{
|
|||
|
var hashCode = -1416534245;
|
|||
|
hashCode = hashCode * -1521134295 + Latitude.GetHashCode();
|
|||
|
hashCode = hashCode * -1521134295 + Longitude.GetHashCode();
|
|||
|
return hashCode;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|