Ejemplo n.º 1
0
        /// <summary>
        /// Compute a location of an interior point in a <see cref="Geometry"/>.
        /// Handles all geometry types.
        /// </summary>
        /// <param name="geom">A geometry in which to find an interior point</param>
        /// <returns>the location of an interior point, or <c>null</c> if the input is empty
        /// </returns>
        public static Coordinate GetInteriorPoint(Geometry geom)
        {
            var factory = geom.Factory;

            if (geom.IsEmpty)
            {
                return(null);
            }

            Coordinate interiorPt;

            switch (geom.Dimension)
            {
            case Dimension.Point:
                interiorPt = InteriorPointPoint.GetInteriorPoint(geom);
                break;

            case Dimension.Curve:
                interiorPt = InteriorPointLine.GetInteriorPoint(geom);
                break;

            default:
                interiorPt = InteriorPointArea.GetInteriorPoint(geom);
                break;
            }

            return(interiorPt);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Computes an interior point for the
        /// polygonal components of a Geometry.
        /// </summary>
        /// <param name="geom">The geometry to compute.</param>
        /// <returns>
        /// The computed interior point,
        /// or <see langword="null"/> if the geometry has no polygonal components.
        /// </returns>
        public static Coordinate GetInteriorPoint(Geometry geom)
        {
            var intPt = new InteriorPointArea(geom);

            return(intPt.InteriorPoint);
        }