/** project this linestring to an equirectangular projection */ private static LineString equirectangularProject(LineString geometry, double xscale) { Coordinate[] coords = new Coordinate[geometry.getNumPoints()]; for (int i = 0; i < coords.length; i++) { Coordinate c = geometry.getCoordinateN(i); c = (Coordinate) c.clone(); c.x *= xscale; coords[i] = c; } return geometryFactory.createLineString(coords); }
/** * Creates a validation error with the given type and location * * @param errorType the type of the error * @param pt the location of the error */ public TopologyValidationError(int errorType, Coordinate pt) { this.errorType = errorType; if (pt != null) this.pt = (Coordinate) pt.clone(); }
public Coordinate[] getBoundaryPoints() { Collection coll = getBoundaryNodes(); Coordinate[] pts = new Coordinate[coll.size()]; int i = 0; for (Iterator it = coll.iterator(); it.hasNext(); ) { Node node = (Node) it.next(); pts[i++] = (Coordinate) node.getCoordinate().clone(); } return pts; }
/** * Creates a deep copy of the Object * * @return The deep copy */ public Object clone() { Coordinate[] cloneCoordinates = new Coordinate[size()]; for (int i = 0; i < coordinates.length; i++) { cloneCoordinates[i] = (Coordinate) coordinates[i].clone(); } return new CoordinateArraySequence(cloneCoordinates); } /**
/** * Creates a deep copy of the Object * * @return The deep copy */ public Object clone() { Coordinate[] cloneCoordinates = new Coordinate[size()]; for (int i = 0; i < coordinates.length; i++) { cloneCoordinates[i] = (Coordinate) coordinates[i].clone(); } return new DefaultCoordinateSequence(cloneCoordinates); } /**
/** * Returns a deep copy of this <tt>CoordinateList</tt> instance. * * @return a clone of this <tt>CoordinateList</tt> instance */ public Object clone() { CoordinateList clone = (CoordinateList) super.clone(); for (int i = 0; i < this.size(); i++) { clone.add(i, ((Coordinate) this.get(i)).clone()); } return clone; } }
/** * Check all nodes to see if their labels are consistent. * If any are not, return false * * @return <code>true</code> if the edge area labels are consistent at this node */ private boolean isNodeEdgeAreaLabelsConsistent() { for (Iterator nodeIt = nodeGraph.getNodeIterator(); nodeIt.hasNext(); ) { RelateNode node = (RelateNode) nodeIt.next(); if (! node.getEdges().isAreaLabelsConsistent(geomGraph)) { invalidPoint = (Coordinate) node.getCoordinate().clone(); return false; } } return true; }
/** * Creates a validation error with the given type and location * * @param errorType the type of the error * @param pt the location of the error */ public TopologyValidationError(int errorType, Coordinate pt) { this.errorType = errorType; if (pt != null) this.pt = (Coordinate) pt.clone(); }
public Coordinate getCoordinateCopy(final int _index) { return (Coordinate)getCoordinate(_index).clone(); }
/** * Takes a coordinate and returns a copy that is scaled to 6-digits of precision. * * @param target * The coordinate to scale * @return The coordinate scaled to 6-digits */ public Coordinate getScaledCoordinate(final Coordinate target) { // Clone to avoid updating actual coordinate final Coordinate cloned = (Coordinate) target.clone(); this.precisionModel.makePrecise(cloned); return cloned; }
public Coordinate[] getBoundaryPoints() { Collection coll = getBoundaryNodes(); Coordinate[] pts = new Coordinate[coll.size()]; int i = 0; for (Iterator it = coll.iterator(); it.hasNext(); ) { Node node = (Node) it.next(); pts[i++] = (Coordinate) node.getCoordinate().clone(); } return pts; }
properIntersectionPoint = (Coordinate) li.getIntersection(0).clone(); hasProper = true; if (! isBoundaryPoint(li, bdyNodes))
/** * Creates a deep copy of the Object * * @return The deep copy */ public Object clone() { Coordinate[] cloneCoordinates = new Coordinate[size()]; for (int i = 0; i < coordinates.length; i++) { cloneCoordinates[i] = (Coordinate) coordinates[i].clone(); } return new DefaultCoordinateSequence(cloneCoordinates); } /**
/** * Creates a deep copy of the Object * * @return The deep copy */ public Object clone() { Coordinate[] cloneCoordinates = new Coordinate[size()]; for (int i = 0; i < coordinates.length; i++) { cloneCoordinates[i] = (Coordinate) coordinates[i].clone(); } return new CoordinateArraySequence(cloneCoordinates, dimension); } /**
/** * Returns a deep copy of this <tt>CoordinateList</tt> instance. * * @return a clone of this <tt>CoordinateList</tt> instance */ public Object clone() { CoordinateList clone = (CoordinateList) super.clone(); for (int i = 0; i < this.size(); i++) { clone.add(i, ((Coordinate) this.get(i)).clone()); } return clone; } }
/** * Check all nodes to see if their labels are consistent. * If any are not, return false * * @return <code>true</code> if the edge area labels are consistent at this node */ private boolean isNodeEdgeAreaLabelsConsistent() { for (Iterator nodeIt = nodeGraph.getNodeIterator(); nodeIt.hasNext(); ) { RelateNode node = (RelateNode) nodeIt.next(); if (! node.getEdges().isAreaLabelsConsistent(geomGraph)) { invalidPoint = (Coordinate) node.getCoordinate().clone(); return false; } } return true; }
/** * @todo Les poly de niveau sont mal traites */ public void addAtomic(final int _ligneIdx, final int _idxBefore, final double _x, final double _y, final CtuluCommandContainer _cmd) { if (!isGeomModifiable_) { return; } Geometry geom = (Geometry)super.geometry_.getValueAt(_ligneIdx); final Coordinate[] oldcs = geom.getCoordinates(); final int initSize = oldcs.length; final Coordinate[] cs = new Coordinate[initSize + 1]; int idx = 0; for (int i = 0; i < initSize; i++) { cs[idx++] = (Coordinate)oldcs[i].clone(); if (i == _idxBefore) { cs[idx++] = new Coordinate(_x, _y, oldcs[i].z); } } geom = GISGeometryFactory.INSTANCE.createGeometry(geom.getClass(),cs); setValue(_ligneIdx,geom, _cmd); }
/** * @todo Les poly de niveau sont mal traites */ public void addAtomic(final int _ligneIdx, final int _idxBefore, final double _x, final double _y, final CtuluCommandContainer _cmd) { if (!isGeomModifiable_) { return; } Geometry geom = (Geometry)super.geometry_.getValueAt(_ligneIdx); final Coordinate[] oldcs = geom.getCoordinates(); final int initSize = oldcs.length; final Coordinate[] cs = new Coordinate[initSize + 1]; int idx = 0; for (int i = 0; i < initSize; i++) { cs[idx++] = (Coordinate)oldcs[i].clone(); if (i == _idxBefore) { cs[idx++] = new Coordinate(_x, _y, oldcs[i].z); } } geom = GISGeometryFactory.INSTANCE.createMultiPoint(cs); setValue(_ligneIdx,geom, _cmd); }
private void buildRing(HalfEdge eStartRing) { CoordinateList line = new CoordinateList(); HalfEdge e = eStartRing; line.add(e.orig().clone(), false); // scan along the path until a node is found (if one exists) while (e.sym().degree() == 2) { HalfEdge eNext = e.next(); // check if edges form a ring - if so, we're done if (eNext == eStartRing) break; // add point to line, and move to next edge line.add(eNext.orig().clone(), false); e = eNext; } // add final node line.add(e.dest().clone(), false); // store the scanned line addLine(line); }
/** * Splits the lineString at the point closest to c. * * @param lineString line to split * @param target point where line should be split * @param moveSplitToTarget * true to move the split point to the target; false to leave the * split point at the closest point on the line to the target */ public static LineString[] split(LineString lineString, Coordinate target, boolean moveSplitToTarget) { LengthToPoint lengthToPoint = new LengthToPoint(lineString, target); LengthSubstring lengthSubstring = new LengthSubstring(lineString); LineString[] newLineStrings = new LineString[] { lengthSubstring.getSubstring(0, lengthToPoint.getLength()), lengthSubstring.getSubstring(lengthToPoint.getLength(), lineString.getLength()) }; if (moveSplitToTarget) { newLineStrings[1].getStartPoint().getCoordinate() .setCoordinate((Coordinate) target.clone()); } // Make sure the coordinates are absolutely equal [Jon Aquino // 11/21/2003] newLineStrings[0] .getEndPoint() .getCoordinate() .setCoordinate( newLineStrings[1].getStartPoint().getCoordinate()); return newLineStrings; }