private Geometry convertBox(PGboxbase box) { Point ll = box.getLLB(); Point ur = box.getURT(); Coordinate[] ringCoords = new Coordinate[5]; if (box instanceof org.postgis.PGbox2d) { ringCoords[0] = new Coordinate(ll.x, ll.y); ringCoords[1] = new Coordinate(ur.x, ll.y); ringCoords[2] = new Coordinate(ur.x, ur.y); ringCoords[3] = new Coordinate(ll.x, ur.y); ringCoords[4] = new Coordinate(ll.x, ll.y); } else { ringCoords[0] = new Coordinate(ll.x, ll.y, ll.z); ringCoords[1] = new Coordinate(ur.x, ll.y, ll.z); ringCoords[2] = new Coordinate(ur.x, ur.y, ur.z); ringCoords[3] = new Coordinate(ll.x, ur.y, ur.z); ringCoords[4] = new Coordinate(ll.x, ll.y, ll.z); } com.vividsolutions.jts.geom.LinearRing shell = getGeometryFactory() .createLinearRing(ringCoords); return getGeometryFactory().createPolygon(shell, null); }
@Override public Envelope getBBoxAggregateValue( ResultSet rs, int colIdx, ICRS crs ) throws SQLException { Envelope env = null; PGboxbase pgBox = (PGboxbase) rs.getObject( colIdx ); if ( pgBox != null ) { org.deegree.geometry.primitive.Point min = buildPoint( pgBox.getLLB(), crs ); org.deegree.geometry.primitive.Point max = buildPoint( pgBox.getURT(), crs ); env = new DefaultEnvelope( null, crs, null, min, max ); } return env; }
@Override public Object getObject(int columnIndex) throws SQLException { Object object = rs.getObject(columnIndex); if(spatialFields.contains(columnIndex)) { if(object instanceof JtsGeometry) { return ((JtsGeometry) object).getGeometry(); } else if(object instanceof PGboxbase) { PGboxbase box = ((PGboxbase) object); Point bottomLeft = box.getLLB(); Point upRight = box.getURT(); Envelope envelope = new Envelope(bottomLeft.x, upRight.x, bottomLeft.y, upRight.y); return geometryFactory.toGeometry(envelope); } } if(object instanceof PGobject) { return new PGObjectWrapper((PGobject) object); } else { return object; } }
@Override public Object getObject(int columnIndex) throws SQLException { Object object = rs.getObject(columnIndex); if(spatialFields.contains(columnIndex)) { if(object instanceof JtsGeometry) { return ((JtsGeometry) object).getGeometry(); } else if(object instanceof PGboxbase) { PGboxbase box = ((PGboxbase) object); Point bottomLeft = box.getLLB(); Point upRight = box.getURT(); Envelope envelope = new Envelope(bottomLeft.x, upRight.x, bottomLeft.y, upRight.y); return geometryFactory.toGeometry(envelope); } } if(object instanceof PGobject) { return new PGObjectWrapper((PGobject) object); } else { return object; } }
@Override public Object getObject(int columnIndex) throws SQLException { Object object = rs.getObject(columnIndex); if(spatialFields.contains(columnIndex)) { if(object instanceof JtsGeometry) { return ((JtsGeometry) object).getGeometry(); } else if(object instanceof PGboxbase) { PGboxbase box = ((PGboxbase) object); Point bottomLeft = box.getLLB(); Point upRight = box.getURT(); Envelope envelope = new Envelope(bottomLeft.x, upRight.x, bottomLeft.y, upRight.y); return geometryFactory.toGeometry(envelope); } } if(object instanceof PGobject) { return new PGObjectWrapper((PGobject) object); } else { return object; } }