public void EqualsInPrecisionRange(GeoDegreePrecision precision) { var coordinate1 = new GeoCoordinateInfo(47.53333, 21.63333, precision); var coordinate2 = new GeoCoordinateInfo(47.5333367, 21.6333367, precision); Assert.StrictEqual(coordinate1, coordinate2); }
/// <summary> /// Initializes a new instance of the <see cref="GeoCoordinateInfo" /> class. /// </summary> /// <param name="latitude">The latitude is a geographic coordinate that specifies the north-south position of a point on the Earth's surface.</param> /// <param name="longitude">The longitude is a geographic coordinate that specifies the east-west position of a point on the Earth's surface.</param> /// <param name="precision">Decimal degrees (DD) express latitude and longitude geographic coordinates as decimal fractions.</param> public GeoCoordinateInfo(double?latitude, double?longitude, GeoDegreePrecision precision) { if (latitude != null) { Latitude = (long)(latitude * (int)precision) / (double)precision; } if (longitude != null) { Longitude = (long)(longitude * (int)precision) / (double)precision; } Precision = precision; }