private static GeometryCollection convert(org.postgis.GeometryCollection geometry) { Geometry[] geometries = new Geometry[geometry.numGeoms()]; for (int i = 0; i < geometries.length; i++) { geometries[i] = convert(geometry.getSubGeometry(i)); } return new GeometryCollection(geometries); }
private void writeCollection(GeometryCollection geom, ValueSetter dest) { dest.setInt(geom.numGeoms()); writeGeometryArray(geom.getGeometries(), dest); }
private static org.postgis.GeometryCollection convert(GeometryCollection geometryCollection) { org.postgis.Geometry[] pgGeometries = new org.postgis.Geometry[geometryCollection.getNumGeometries()]; for (int i = 0; i < pgGeometries.length; i++) { pgGeometries[i] = convert(geometryCollection.getGeometryN(i)); } org.postgis.GeometryCollection pgGeometryCollection = new org.postgis.GeometryCollection(pgGeometries); pgGeometryCollection.setSrid(geometryCollection.getSRID()); return pgGeometryCollection; }
private GeometryCollection parseCollection(ValueGetter data) { int count = data.getInt(); Geometry[] geoms = new Geometry[count]; parseGeometryArray(data, geoms); return new GeometryCollection(geoms); } }
private int estimateCollection(GeometryCollection geom) { // 4-byte count + subgeometries return 4 + estimateGeometryArray(geom.getGeometries()); } }
private static org.postgis.GeometryCollection convert(GeometryCollection geometryCollection) { org.postgis.Geometry[] pgGeometries = new org.postgis.Geometry[geometryCollection.getNumGeometries()]; for (int i = 0; i < pgGeometries.length; i++) { pgGeometries[i] = convert(geometryCollection.getGeometryN(i)); } org.postgis.GeometryCollection pgGeometryCollection = new org.postgis.GeometryCollection(pgGeometries); pgGeometryCollection.setSrid(geometryCollection.getSRID()); return pgGeometryCollection; }
private GeometryCollection parseCollection(ValueGetter data) { int count = data.getInt(); Geometry[] geoms = new Geometry[count]; parseGeometryArray(data, geoms); return new GeometryCollection(geoms); } }
private int estimateCollection(GeometryCollection geom) { // 4-byte count + subgeometries return 4 + estimateGeometryArray(geom.getGeometries()); } }
private GeometryCollection convertJTSGeometryCollection( com.vividsolutions.jts.geom.GeometryCollection collection) { com.vividsolutions.jts.geom.Geometry currentGeom; org.postgis.Geometry[] pgCollections = new org.postgis.Geometry[collection .getNumGeometries()]; for (int i = 0; i < pgCollections.length; i++) { currentGeom = collection.getGeometryN(i); currentGeom = forceEmptyToGeometryCollection(currentGeom); if (currentGeom.getClass() == com.vividsolutions.jts.geom.LineString.class) { pgCollections[i] = convertJTSLineString((com.vividsolutions.jts.geom.LineString) currentGeom); } else if (currentGeom.getClass() == com.vividsolutions.jts.geom.LinearRing.class) { pgCollections[i] = convertJTSLineStringToLinearRing((com.vividsolutions.jts.geom.LinearRing) currentGeom); } else if (currentGeom.getClass() == com.vividsolutions.jts.geom.MultiLineString.class) { pgCollections[i] = convertJTSMultiLineString((com.vividsolutions.jts.geom.MultiLineString) currentGeom); } else if (currentGeom.getClass() == com.vividsolutions.jts.geom.MultiPoint.class) { pgCollections[i] = convertJTSMultiPoint((com.vividsolutions.jts.geom.MultiPoint) currentGeom); } else if (currentGeom.getClass() == com.vividsolutions.jts.geom.MultiPolygon.class) { pgCollections[i] = convertJTSMultiPolygon((com.vividsolutions.jts.geom.MultiPolygon) currentGeom); } else if (currentGeom.getClass() == com.vividsolutions.jts.geom.Point.class) { pgCollections[i] = convertJTSPoint((com.vividsolutions.jts.geom.Point) currentGeom); } else if (currentGeom.getClass() == com.vividsolutions.jts.geom.Polygon.class) { pgCollections[i] = convertJTSPolygon((com.vividsolutions.jts.geom.Polygon) currentGeom); } else if (currentGeom.getClass() == com.vividsolutions.jts.geom.GeometryCollection.class) { pgCollections[i] = convertJTSGeometryCollection((com.vividsolutions.jts.geom.GeometryCollection) currentGeom); } } GeometryCollection gc = new GeometryCollection(pgCollections); gc.setSrid(collection.getSRID()); return gc; }
result = new GeometryCollection(); } else if (value.startsWith("MULTIPOLYGON")) { result = new MultiPolygon(value, haveM); result = new Point(value, haveM); } else if (value.startsWith("GEOMETRYCOLLECTION")) { result = new GeometryCollection(value, haveM); } else { throw new SQLException("Unknown type: " + value);
private static GeometryCollection convert(org.postgis.GeometryCollection geometry) { Geometry[] geometries = new Geometry[geometry.numGeoms()]; for (int i = 0; i < geometries.length; i++) { geometries[i] = convert(geometry.getSubGeometry(i)); } return new GeometryCollection(geometries); }
private void writeCollection(GeometryCollection geom, ValueSetter dest) { dest.setInt(geom.numGeoms()); writeGeometryArray(geom.getGeometries(), dest); }
private Geometry convertGeometryCollection(GeometryCollection collection) { org.postgis.Geometry[] geometries = collection.getGeometries(); com.vividsolutions.jts.geom.Geometry[] jtsGeometries = new com.vividsolutions.jts.geom.Geometry[geometries.length]; for (int i = 0; i < geometries.length; i++) { jtsGeometries[i] = convert2JTS(geometries[i]); //TODO - refactor this so the following line is not necessary jtsGeometries[i].setSRID(0); // convert2JTS sets SRIDs, but constituent geometries in a collection must have srid == 0 } com.vividsolutions.jts.geom.GeometryCollection jtsGCollection = getGeometryFactory() .createGeometryCollection(jtsGeometries); return jtsGCollection; }
result = new GeometryCollection(); } else if (value.startsWith("MULTIPOLYGON")) { result = new MultiPolygon(value, haveM); result = new Point(value, haveM); } else if (value.startsWith("GEOMETRYCOLLECTION")) { result = new GeometryCollection(value, haveM); } else { throw new SQLException("Unknown type: " + value);