public BoundingBox getBounds() { // TODO: cache this value CoordinateReferenceSystem crs = featureType.getCoordinateReferenceSystem(); Envelope bounds = ReferencedEnvelope.create(crs); for (Object o : values) { if (o instanceof Geometry) { Geometry g = (Geometry) o; // TODO: check userData for crs... and ensure its of the same // crs as the feature type if (bounds.isNull()) { bounds.init(JTS.bounds(g, crs)); } else { bounds.expandToInclude(JTS.bounds(g, crs)); } } } return (BoundingBox) bounds; }
@Override public BoundingBox getBounds() { Object o = getDefaultGeometry(); if (o instanceof Geometry) { CoordinateReferenceSystem crs = featureType.getCoordinateReferenceSystem(); if (crs == null) { crs = DefaultGeographicCRS.WGS84; } Envelope bounds = ReferencedEnvelope.create(crs); bounds.init(JTS.bounds((Geometry) o, crs)); return (BoundingBox) bounds; } return null; }
JTS.bounds(geometry, descriptor.getCoordinateReferenceSystem());
JTS.bounds( geometry, ((GeometryDescriptor) att).getCoordinateReferenceSystem());
@Override public BoundingBox getBounds() { CoordinateReferenceSystem crs = featureType.getCoordinateReferenceSystem(); Envelope bounds = ReferencedEnvelope.create(crs); Optional<Object> o; for (int i = 0; i < revFeatureValues.size(); i++) { o = revFeatureValues.get(i); if (o.isPresent() && o.get() instanceof Geometry) { Geometry g = (Geometry) o.get(); // TODO: check userData for crs... and ensure its of the same // crs as the feature type if (bounds.isNull()) { bounds.init(JTS.bounds(g, crs)); } else { bounds.expandToInclude(JTS.bounds(g, crs)); } } } return (BoundingBox) bounds; }