private GeometryCollection parseCollection(ValueGetter data) { int count = data.getInt(); Geometry[] geoms = new Geometry[count]; parseGeometryArray(data, geoms); return new GeometryCollection(geoms); } }
private GeometryCollection parseCollection(ValueGetter data) { int count = data.getInt(); Geometry[] geoms = new Geometry[count]; parseGeometryArray(data, geoms); return new GeometryCollection(geoms); } }
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);
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 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 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 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; }