/// <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); }
/// <summary> /// Computes an interior point for the /// linear 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 linear components. /// </returns> public static Coordinate GetInteriorPoint(Geometry geom) { var intPt = new InteriorPointLine(geom); return(intPt.InteriorPoint); }