public int getNumPoints() { // 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().getNumPoints(); } else { return super.getNumPoints(); } }
public int getNumPoints() { // 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().getNumPoints(); } else { return super.getNumPoints(); } }
static void encode(Element e, LinearRing g, PrintHandler output) throws IOException { if ((g == null) || (g.getNumPoints() == 0)) { throw new IOException("Bad LinearRing Data"); } if (e == null) { encode(((GMLSchema.getInstance()).getElements()[39]), (LineString) g, output); } else { encode(e, (LineString) g, output); } }
public int getNumPoints() { int numPoints = shell.getNumPoints(); for (int i = 0; i < holes.length; i++) { numPoints += holes[i].getNumPoints(); } return numPoints; }
/** * 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); } }
if (shell.getNumPoints() != 5) return false;
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)); }
assertEquals(0, (geometryFactory.createLinearRing((CoordinateSequence)null)).getNumPoints()); assertEquals(0, (geometryFactory.createLineString((Coordinate[])null)).getNumPoints()); assertEquals(0, (geometryFactory.createPolygon(null, null)).getNumPoints());