コード例 #1
0
        public double GetDistanceInMeter(GeocodeAddress gAddressTo)
        {
            if (GeocodeResponse == null || gAddressTo == null || gAddressTo.GeocodeResponse == null)
            {
                return(Double.NaN);
            }
            pinFrom = new GeoCoordinate(GeocodeResponse.Latitude, GeocodeResponse.Longitude);
#pragma warning disable CA1062 // Validate arguments of public methods
            GeoCoordinate pinTo = new GeoCoordinate(gAddressTo.GeocodeResponse.Latitude, gAddressTo.GeocodeResponse.Longitude);

            double distanceBetween = pinFrom.GetDistanceTo(pinTo);
            return(Math.Round(distanceBetween, 0));
        }
コード例 #2
0
        public bool IsWithinDistanceInMeter(GeocodeAddress gr2, double distance = 500)
        {
            double dist = GetDistanceInMeter(gr2);

            if (dist <= distance)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }