Esempio n. 1
0
        public double RectangeDistance(Coordinate coordinate)
        {
            if (PointContains(coordinate) != InterseptResult.None)
            {
                return(0);
            }

            var min = EarthUtilities.GetDistance(new CoordinateRectangle(Left, Top, Right, Top), coordinate);
            var res = EarthUtilities.GetDistance(new CoordinateRectangle(Right, Top, Right, Bottom), coordinate);

            if (res < min)
            {
                min = res;
            }
            res = EarthUtilities.GetDistance(new CoordinateRectangle(Right, Bottom, Left, Bottom), coordinate);
            if (res < min)
            {
                min = res;
            }
            res = EarthUtilities.GetDistance(new CoordinateRectangle(Left, Bottom, Left, Top), coordinate);
            if (res < min)
            {
                min = res;
            }

            return(min);
        }
Esempio n. 2
0
 public double LineDistance(Coordinate coordinate)
 {
     return(EarthUtilities.GetDistance(this, coordinate));
 }