/// <summary> /// Creates a deep copy of the input <see cref="Geometry"/>. /// The <see cref="Geometries.CoordinateSequenceFactory"/> defined for this factory /// is used to copy the <see cref="CoordinateSequence"/>s /// of the input geometry. /// <para/> /// This is a convenient way to change the <tt>CoordinateSequence</tt> /// used to represent a geometry, or to change the /// factory used for a geometry. /// <para/> /// <see cref="Geometry.Copy()"/> can also be used to make a deep copy, /// but it does not allow changing the CoordinateSequence type. /// </summary> /// <param name="g">The geometry</param> /// <returns>A deep copy of the input geometry, using the CoordinateSequence type of this factory</returns> /// <seealso cref="Geometry.Copy"/> public virtual Geometry CreateGeometry(Geometry g) { // NOTE: don't move lambda to a separate variable! // make a variable and you've broke WinPhone build. var operation = new GeometryEditor.CoordinateSequenceOperation((x, y) => _coordinateSequenceFactory.Create(x)); var editor = new GeometryEditor(this); return(editor.Edit(g, operation)); }
private static CoordinateSequence CreateClosedRing(CoordinateSequenceFactory fact, CoordinateSequence seq, int size) { var newseq = fact.Create(size, seq.Dimension); int n = seq.Count; Copy(seq, 0, newseq, 0, n); // fill remaining coordinates with start point for (int i = n; i < size; i++) { Copy(seq, 0, newseq, i, 1); } return(newseq); }
public static CoordinateSequence Extend(CoordinateSequenceFactory fact, CoordinateSequence seq, int size) { var newseq = fact.Create(size, seq.Ordinates); int n = seq.Count; Copy(seq, 0, newseq, 0, n); // fill remaining coordinates with end point, if it exists if (n > 0) { for (int i = n; i < size; i++) { Copy(seq, n - 1, newseq, i, 1); } } return(newseq); }