public void Visit(T obj, GeoLocation location) { var distance = _location.DistanceTo(location); if (distance < _closestDistance) { _closestDistance = distance; Closest = obj; } }
public double CalculateDistance(Airport airport, GeoLocation center) { double distance = -1; if (airport.Latitude.HasValue && airport.Longitude.HasValue) { GeoLocation airportLocation = GeoLocation.FromDegrees(airport.Latitude.Value, airport.Longitude.Value); distance = center.DistanceTo(airportLocation); } return(distance); }
public static double DistanceTo(this GeoLocation from, GeoLocation to, GeoMath.MeasureUnits units, int decimalPoints = 2) { return(from.DistanceTo(to.Latitude, to.Longitude, units, decimalPoints)); }