Esempio n. 1
0
        public void Visit(T obj, GeoLocation location)
        {
            var distance = _location.DistanceTo(location);

            if (distance < _closestDistance)
            {
                _closestDistance = distance;
                Closest          = obj;
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 public static double DistanceTo(this GeoLocation from, GeoLocation to, GeoMath.MeasureUnits units,
                                 int decimalPoints = 2)
 {
     return(from.DistanceTo(to.Latitude, to.Longitude, units, decimalPoints));
 }