/// <summary> /// Determines whether a <see cref="MultiPoint"/> geometry is simple. /// </summary> /// <param name="multiPoints"> /// A <see cref="MultiPoint"/> geometry instance to be tested. /// </param> /// <returns> /// Returns true if the <see cref="MultiPoint"/> geometry is simple, /// otherwise returns false. /// </returns> /// <remarks> /// A <see cref="MultiPoint"/> is simple if and only if it has /// no repeated points. /// </remarks> public bool IsSimple(MultiPoint multiPoints) { if (multiPoints == null) { throw new ArgumentNullException("multiPoints"); } if (multiPoints.IsEmpty) { return(true); } ISet points = new HashedSet(); int nCount = multiPoints.NumGeometries; for (int i = 0; i < nCount; i++) { Point pt = (Point)multiPoints.GetGeometry(i); Coordinate p = pt.Coordinate; if (points.Contains(p)) { return(false); } points.Add(p); } return(true); }
/// <summary> Converts a MultiPoint to <MultiPoint Text> format, then /// appends it to the writer. /// /// </summary> /// <param name="multiPoint"> the MultiPoint to process /// </param> /// <param name="writer"> the output writer to append to /// </param> private void AppendMultiPointText(MultiPoint multiPoint, int level, TextWriter writer) { if (multiPoint.IsEmpty) { writer.Write(WktEmpty); } else { writer.Write(WktLParan); int nCount = multiPoint.NumGeometries; for (int i = 0; i < nCount; i++) { if (i > 0) { writer.Write(WktComma); } AppendCoordinate(((Point)multiPoint.GetGeometry(i)).Coordinate, writer); } writer.Write(WktRParan); } }