/// <summary> /// /// </summary> /// <param name="g"></param> /// <returns> /// A clone of g based on a CoordinateSequence created by this /// GeometryFactory's CoordinateSequenceFactory. /// </returns> public IGeometry CreateGeometry(IGeometry g) { // could this be cached to make this more efficient? Or maybe it isn't enough overhead to bother GeometryEditor editor = new GeometryEditor(this); return(editor.Edit(g, new AnonymousCoordinateOperationImpl())); }
/// <summary> /// Creates a deep copy of the input <see cref="IGeometry"/>. /// The <see cref="ICoordinateSequenceFactory"/> defined for this factory /// is used to copy the <see cref="ICoordinateSequence"/>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="IGeometry.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="IGeometry.Copy"/> public IGeometry CreateGeometry(IGeometry 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 IGeometry ReplaceLines(IGeometry geom, IList <ISegmentString> segStrings) { var nodedLinesMap = NodedLinesMap(segStrings); var lineReplacer = new GeometryCoordinateReplacer(nodedLinesMap); var geomEditor = new GeometryEditor(); var snapped = geomEditor.Edit(geom, lineReplacer); return(snapped); }
/// <summary> /// Creates a deep copy of the input <see cref="IGeometry"/>. /// The <see cref="ICoordinateSequenceFactory"/> defined for this factory /// is used to copy the <see cref="ICoordinateSequence"/>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="IGeometry.Clone()"/> 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="IGeometry.Clone"/> public IGeometry CreateGeometry(IGeometry g) { var editor = new GeometryEditor(this); // return editor.Edit(g, new GeometryEditor.CoordinateSequenceOperation() { // public CoordinateSequence edit(CoordinateSequence coordSeq, Geometry geometry) { // return coordinateSequenceFactory.create(coordSeq); // } //}); return(editor.Edit(g, new GeometryEditor.CoordinateSequenceOperation( (x, y) => _coordinateSequenceFactory.Create(x)))); }
public IGeometry Node(IGeometry geom) { var geomList = new List <IGeometry>(); geomList.Add(geom); var segStrings = ExtractSegmentStrings(geomList); //Noder sr = new SimpleSnapRounder(pm); var sr = new MCIndexSnapRounder(_pm); sr.ComputeNodes(segStrings); var nodedPtsMap = GetNodedPtsMap(segStrings); var lineReplacer = new GeometryLineReplacer(nodedPtsMap); var geomEditor = new GeometryEditor(); var snapped = geomEditor.Edit(geom, lineReplacer); return(snapped); }
/// <returns> /// a clone of g based on a CoordinateCollection created by this /// GeometryFactory's ICoordinateSequenceFactory /// </returns> public virtual Geometry CreateGeometry(Geometry g) { GeometryEditor editor = new GeometryEditor(this); return(editor.Edit(g, new CoordinateOperation())); }