@Override public int compare(Polygon o1, Polygon o2) { return o2.getNumPoints() - o1.getNumPoints(); } });
@Override public int compare(Polygon o1, Polygon o2) { return o2.getNumPoints() - o1.getNumPoints(); } });
public Coordinate[] getCoordinates() { if (isEmpty()) { return new Coordinate[]{}; } Coordinate[] coordinates = new Coordinate[getNumPoints()]; int k = -1; Coordinate[] shellCoordinates = shell.getCoordinates(); for (int x = 0; x < shellCoordinates.length; x++) { k++; coordinates[k] = shellCoordinates[x]; } for (int i = 0; i < holes.length; i++) { Coordinate[] childCoordinates = holes[i].getCoordinates(); for (int j = 0; j < childCoordinates.length; j++) { k++; coordinates[k] = childCoordinates[j]; } } return coordinates; }
@Override public int compare(Polygon o1, Polygon o2) { return o2.getNumPoints() - o1.getNumPoints(); } });
public boolean visitPolygoneWithHole(final Polygon _p) { nbPolygoneHole_++; nbPtTotal_ += _p.getNumPoints(); return true; }
public int getNumPoints() { return polygon.getNumPoints(); }
public Coordinate[] getCoordinates() { if (isEmpty()) { return new Coordinate[]{}; } Coordinate[] coordinates = new Coordinate[getNumPoints()]; int k = -1; Coordinate[] shellCoordinates = shell.getCoordinates(); for (int x = 0; x < shellCoordinates.length; x++) { k++; coordinates[k] = shellCoordinates[x]; } for (int i = 0; i < holes.length; i++) { Coordinate[] childCoordinates = holes[i].getCoordinates(); for (int j = 0; j < childCoordinates.length; j++) { k++; coordinates[k] = childCoordinates[j]; } } return coordinates; }
private static byte[] serialize(Polygon polygon) { int numRings = polygon.getNumInteriorRing() + 1; int numPoints = polygon.getNumPoints(); ByteBuffer buffer = newBuffer(calculateBufferSize(numPoints, numRings)); putHeader(buffer, ShapeType.POLYGON, numPoints, numRings); putRingOffsets(buffer, polygon, 0); putPolygonPoints(buffer, polygon); return buffer.array(); }
private static byte[] serialize(Polygon polygon) { int numRings = polygon.getNumInteriorRing() + 1; int numPoints = polygon.getNumPoints(); ByteBuffer buffer = newBuffer(calculateBufferSize(numPoints, numRings)); putHeader(buffer, ShapeType.POLYGON, numPoints, numRings); putRingOffsets(buffer, polygon, 0); putPolygonPoints(buffer, polygon); return buffer.array(); }
private static void addElemInfo(List elemInfoList, MultiPolygon polys, final int STARTING_OFFSET, final int GTYPE) { Polygon poly; int offset = STARTING_OFFSET; int LEN = D(GTYPE) + L(GTYPE); for (int i = 0; i < polys.getNumGeometries(); i++) { poly = (Polygon) polys.getGeometryN(i); addElemInfo(elemInfoList, poly, offset, GTYPE); if( isRectangle( poly )){ offset += (2 * LEN); } else { offset += (poly.getNumPoints() * LEN); } } }