private int getPolygonSize(Polygon geom) { // to hold the number of linear rings int size = ByteBuffer.UINT_SIZE; // for each linear ring, a UINT holds the number of points size += geom.isEmpty() ? 0 : ByteBuffer.UINT_SIZE * (geom.getNumInteriorRing() + 1); size += getPointByteSize(geom) * geom.getNumPoints(); return size; }
@Override public void visit(PolyHedralSurface geom) { writeByteOrder(output); DimensionalFlag dimension = DimensionalFlag.valueOf(geom.is3D(), geom.isMeasured()); writeTypeCodeAndSrid(geom, dimension, output); output.putUInt(geom.getNumPatches()); for (Polygon pg : geom) { pg.accept(this); } }
@Override public void visit(Polygon geom) { writeByteOrder(output); DimensionalFlag dimension = DimensionalFlag.valueOf(geom.is3D(), geom.isMeasured()); writeTypeCodeAndSrid(geom, dimension, output); writeNumRings(geom, output); for (LinearRing ring : geom) { writeRing(ring); } }
@Override public void visit(Polygon<P> geom) { writeByteOrder(output); writeTypeCodeAndSrid(geom, output); if (geom.isEmpty()) { output.putUInt(0); } else { writeNumRings(geom, output); for (LinearRing<P> ring : geom) { writeRing(ring); } } }
private void writeNumRings(Polygon geom, ByteBuffer byteBuffer) { byteBuffer.putUInt(geom.isEmpty() ? 0 : geom.getNumInteriorRing() + 1); }
protected void writeNumRings(Polygon<P> geom, ByteBuffer byteBuffer) { byteBuffer.putUInt(geom.isEmpty() ? 0 : geom.getNumInteriorRing() + 1); }