using System.Collections; using GeoAPI.Geometries; namespace GisSharpBlog.NetTopologySuite.Geometries.Utilities { /// /// Extracts all the 0-dimensional (Point) components from a Geometry. /// public class PointExtracter : IGeometryFilter { /// /// Returns the Point components from a single point. /// If more than one point is to be processed, it is more /// efficient to create a single PointExtracterFilter instance /// and pass it to multiple geometries. /// /// public static IList GetPoints(IGeometry geom) { IList pts = new ArrayList(); geom.Apply(new PointExtracter(pts)); return pts; } private IList pts; /// /// Constructs a PointExtracterFilter with a list in which to store Points found. /// /// public PointExtracter(IList pts) { this.pts = pts; } /// /// /// /// public void Filter(IGeometry geom) { if (geom is IPoint) pts.Add(geom); } } }