/// <summary> /// Returns a deep copy of this collection. /// </summary> /// <returns>The copied object.</returns> public object Clone() { var copy = new CoordinateList(); foreach (var c in this) { copy.Add(c.Copy()); } return(copy); }
/// <summary> /// If the coordinate array argument has repeated points, /// constructs a new array containing no repeated points. /// Otherwise, returns the argument. /// </summary> /// <param name="coord"></param> /// <returns></returns> public static Coordinate[] RemoveRepeatedPoints(Coordinate[] coord) { if (!HasRepeatedPoints(coord)) { return(coord); } var coordList = new CoordinateList(coord, false); return(coordList.ToCoordinateArray()); }
/** * Extracts the coordinates which intersect an {@link Envelope}. * * @param coordinates the coordinates to scan * @param env the envelope to intersect with * @return an array of the coordinates which intersect the envelope */ public static Coordinate[] Intersection(Coordinate[] coordinates, Envelope env) { var coordList = new CoordinateList(); for (int i = 0; i < coordinates.Length; i++) { var c = coordinates[i]; if (env.Intersects(c)) { coordList.Add(c, true); } } return(coordList.ToCoordinateArray()); }