예제 #1
0
        /// <summary>
        /// Determines if the polygon is inside the other polygon.
        /// </summary>
        /// <param name="polygon1"></param>
        /// <param name="polygon2"></param>
        /// <returns></returns>
        public static bool Within(this Polygon polygon1, Polygon polygon2)
        {
            if (Null(polygon1, polygon2))
                return false;

            return polygon2.Contains(polygon1);
        }
예제 #2
0
        /// <summary>
        /// Determines if the polyline is inside the polygon.
        /// </summary>
        /// <param name="polyline"></param>
        /// <param name="polygon"></param>
        /// <returns></returns>
        public static bool Within(this Polyline polyline, Polygon polygon)
        {
            if (Null(polyline, polygon))
                return false;

            return polygon.Contains(polyline);
        }
예제 #3
0
        /// <summary>
        /// Determines if the point is inside the polygon.
        /// </summary>
        /// <param name="point"></param>
        /// <param name="polygon"></param>
        /// <returns></returns>
        public static bool Within(this Point point, Polygon polygon)
        {
            if (Null(point, polygon))
                return false;

            return polygon.Contains(point);
        }
예제 #4
0
        /// <summary>
        /// Determines if the multipoint is inside the polygon.
        /// </summary>
        /// <param name="multipoint"></param>
        /// <param name="polygon"></param>
        /// <returns></returns>
        public static bool Within(this Multipoint multipoint, Polygon polygon)
        {
            if (Null(multipoint, polygon))
                return false;

            return polygon.Contains(multipoint);
        }
예제 #5
0
        /// <summary>
        /// Calculates the shortest distance to the polygon.
        /// </summary>
        /// <param name="point"></param>
        /// <param name="polygon"></param>
        /// <returns></returns>
        public static double Distance(this Point point, Polygon polygon)
        {
            AssertNotNull(point, polygon);

            if (polygon.Contains(point))
                return 0;

            return point.Distance(polygon.rings);
        }