This commit is contained in:
Oliver Hauff 2022-01-22 18:16:10 +01:00
parent e0c75d5b37
commit f38b516d25
57 changed files with 12835 additions and 9925 deletions

View file

@ -15,7 +15,7 @@ namespace TINK.Model.Station
string StationName { get; }
/// <summary> Holds the gps- position of the station.</summary>
Position Position { get; }
IPosition Position { get; }
/// <summary> Holds operator related data.</summary>
IData OperatorData { get; }

View file

@ -16,7 +16,7 @@ namespace TINK.Model.Station
public string StationName => string.Empty;
/// <summary> Holds the gps- position of the station.</summary>
public Position Position => new Position(double.NaN, double.NaN);
public IPosition Position => PositionFactory.Create();
/// <summary> Holds operator related data.</summary>
public IData OperatorData => new Data();

View file

@ -1,48 +0,0 @@
using System;
namespace TINK.Model.Station
{
public class Position
{
private const double PRECISSION_LATITUDE_LONGITUDE = 0.000000000000001;
public Position()
{
}
public Position(double latitude, double longitude)
{
Latitude = latitude;
Longitude = longitude;
}
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;
}
}
}

View file

@ -15,7 +15,7 @@ namespace TINK.Model.Station
public Station(
string id,
IEnumerable<string> group,
Position position,
IPosition position,
string stationName = "",
Data operatorData = null)
{
@ -36,7 +36,7 @@ namespace TINK.Model.Station
public string StationName { get; }
/// <summary> Holds the gps- position of the station.</summary>
public Position Position { get; }
public IPosition Position { get; }
/// <summary> Holds operator related info.</summary>
public IData OperatorData { get; }