public Coordinate getCoordinateN(int n) { // trick to avoid issues while JTS validates the ring is closed, // it's calling super.isClosed() breaking the local override if (delegate != null) { return linearize().getCoordinateN(n); } else { return super.getCoordinateN(n); } }
public Coordinate getCoordinateN(int n) { // trick to avoid issues while JTS validates the ring is closed, // it's calling super.isClosed() breaking the local override if (delegate != null) { return linearize().getCoordinateN(n); } else { return super.getCoordinateN(n); } }
Envelope minEnv = null; Envelope testEnv = testRing.getEnvelopeInternal(); Coordinate testPt = testRing.getCoordinateN(0); LinearRing tryRing;
/** * Does what it says, reverses the order of the Coordinates in the ring. * * @param lr The ring to reverse. * @return A new ring with the reversed Coordinates. */ public static LinearRing reverseRing(final LinearRing lr) { final GeometryFactory gf = new GeometryFactory(); final int numPoints = lr.getNumPoints() - 1; final Coordinate[] newCoords = new Coordinate[numPoints + 1]; for (int t = numPoints; t >= 0; t--) { newCoords[t] = lr.getCoordinateN(numPoints - t); } return gf.createLinearRing(newCoords); }
private void checkClosedRing(LinearRing ring) { if (ring.isEmpty()) return; if (! ring.isClosed() ) { Coordinate pt = null; if (ring.getNumPoints() >= 1) pt = ring.getCoordinateN(0); validErr = new TopologyValidationError( TopologyValidationError.RING_NOT_CLOSED, pt); } }
Envelope minEnv = null; Envelope testHoleEnv = testHole.getEnvelopeInternal(); Coordinate testHolePt = testHole.getCoordinateN(0); LinearRing tryShell; int nShells = shells.size();
Envelope minEnv = null; Envelope testEnv = testRing.getEnvelopeInternal(); Coordinate testPt = testRing.getCoordinateN(0); LinearRing tryRing;
Coordinate testPt = testRing.getCoordinateN(0);
Coordinate testPt = testRing.getCoordinateN(0);
public void testAsGeometry() throws Exception { assertTrue(geometryFactory.createPoint((Coordinate) null).getEnvelope() .isEmpty()); Geometry g = geometryFactory.createPoint(new Coordinate(5, 6)) .getEnvelope(); assertTrue(!g.isEmpty()); assertTrue(g instanceof Point); Point p = (Point) g; assertEquals(5, p.getX(), 1E-1); assertEquals(6, p.getY(), 1E-1); LineString l = (LineString) reader.read("LINESTRING(10 10, 20 20, 30 40)"); Geometry g2 = l.getEnvelope(); assertTrue(!g2.isEmpty()); assertTrue(g2 instanceof Polygon); Polygon poly = (Polygon) g2; poly.normalize(); assertEquals(5, poly.getExteriorRing().getNumPoints()); assertEquals(new Coordinate(10, 10), poly.getExteriorRing().getCoordinateN( 0)); assertEquals(new Coordinate(10, 40), poly.getExteriorRing().getCoordinateN( 1)); assertEquals(new Coordinate(30, 40), poly.getExteriorRing().getCoordinateN( 2)); assertEquals(new Coordinate(30, 10), poly.getExteriorRing().getCoordinateN( 3)); assertEquals(new Coordinate(10, 10), poly.getExteriorRing().getCoordinateN( 4)); }