private static <P extends Position> MultiPolygon to(org.geolatte.geom.MultiPolygon<P> multiPolygon, GeometryFactory gFact) { Polygon[] polygons = new Polygon[multiPolygon.getNumGeometries()]; for (int i = 0; i < multiPolygon.getNumGeometries(); i++) { polygons[i] = to(multiPolygon.getGeometryN(i), gFact); } return gFact.createMultiPolygon(polygons); }
public void visit(MultiPolygon collection, int parent) { Shape shape = new Shape(); shape.type = MULTI_POLYGON; shape.figureOffset = figures.size(); shape.parentOffset = parent; shapes.add(shape); parent = shapes.size() - 1; for (int i = 0; i < collection.getNumGeometries(); i++) { visit(collection.getGeometryN(i), parent); } }
public void visit(MultiPolygon collection, int parent) { Shape shape = new Shape(); shape.type = MULTI_POLYGON; shape.figureOffset = figures.size(); shape.parentOffset = parent; shapes.add(shape); parent = shapes.size() - 1; for (int i = 0; i < collection.getNumGeometries(); i++) { visit(collection.getGeometryN(i), parent); } }
private static org.postgis.MultiPolygon convert(MultiPolygon multiPolygon) { org.postgis.Polygon[] pgPolygons = new org.postgis.Polygon[multiPolygon.getNumGeometries()]; for (int i = 0; i < pgPolygons.length; i++) { pgPolygons[i] = convert(multiPolygon.getGeometryN(i)); } org.postgis.MultiPolygon pgMultiPolygon = new org.postgis.MultiPolygon(pgPolygons); pgMultiPolygon.setSrid(multiPolygon.getSRID()); return pgMultiPolygon; }
private static org.postgis.MultiPolygon convert(MultiPolygon multiPolygon) { org.postgis.Polygon[] pgPolygons = new org.postgis.Polygon[multiPolygon.getNumGeometries()]; for (int i = 0; i < pgPolygons.length; i++) { pgPolygons[i] = convert(multiPolygon.getGeometryN(i)); } org.postgis.MultiPolygon pgMultiPolygon = new org.postgis.MultiPolygon(pgPolygons); pgMultiPolygon.setSrid(multiPolygon.getSRID()); return pgMultiPolygon; }
@Override @SuppressWarnings("unchecked") public <P extends Position, G extends Geometry<P>> SDOGeometry encode(G geom) { MultiPolygon<P> multiPolygon = (MultiPolygon<P>)geom; final int dim = multiPolygon.getCoordinateDimension(); final int lrsPos = getLRSDim(multiPolygon); SDOGType gType = new SDOGType(dim, lrsPos, TypeGeometry.MULTIPOLYGON); SDOGeometry sdoGeom = new SDOGeometry(gType, geom.getSRID(), null, null, null); for (int i = 0; i < multiPolygon.getNumGeometries(); i++) { try { final Polygon<P> pg = multiPolygon.getGeometryN(i); sdoGeom = addPolygon(sdoGeom, pg); } catch (Exception e) { throw new RuntimeException("Found geometry that was not a geometry in MultiPolygon"); } } return sdoGeom; } }