public ReferencedEnvelope getBounds() { ReferencedEnvelope bounds = null; SimpleFeatureIterator i = features(); try { if (!i.hasNext()) { bounds = new ReferencedEnvelope(); bounds.setToNull(); } else { SimpleFeature first = (SimpleFeature) i.next(); bounds = new ReferencedEnvelope(first.getBounds()); } while (i.hasNext()) { SimpleFeature f = (SimpleFeature) i.next(); bounds.include(f.getBounds()); } return bounds; } finally { i.close(); } }
/** * Makes this <code>Envelope</code> a "null" envelope, that is, the envelope of the empty * geometry. */ public void setToNull() { super.setToNull(); minz = 0; maxz = -1; }
/** * Returns the non null envelope of this attribute. If the attribute's geometry is <code>null * </code> the returned Envelope <code>isNull()</code> is true. * * @return */ public synchronized BoundingBox getBounds() { if (bounds == null) { ReferencedEnvelope bbox = new ReferencedEnvelope(getType().getCoordinateReferenceSystem()); Geometry geom = (Geometry) getValue(); if (geom != null) { bbox.expandToInclude(geom.getEnvelopeInternal()); } else { bbox.setToNull(); } bounds = bbox; } return bounds; }
everything.setToNull(); everything.translate(1.0, 1.0);
throw new RuntimeException(e); aggregatedBounds.setToNull();
/** * Returns the non null envelope of this attribute. If the attribute's * geometry is <code>null</code> the returned Envelope * <code>isNull()</code> is true. * * @return */ public synchronized BoundingBox getBounds() { if( bounds == null ){ ReferencedEnvelope bbox = new ReferencedEnvelope(getType().getCoordinateReferenceSystem()); Geometry geom = (Geometry) getValue(); if (geom != null) { bbox.expandToInclude(geom.getEnvelopeInternal()); } else { bbox.setToNull(); } bounds = bbox; } return bounds; }
if ( e == null ) { e = new ReferencedEnvelope(); e.setToNull();
if (e == null) { e = new ReferencedEnvelope(); e.setToNull();
assertEquals("Invalid srs", "EPSG:4326", resource.getSRS()); ReferencedEnvelope emptyBounds = new ReferencedEnvelope(); emptyBounds.setToNull(); assertTrue("Unexpected bounding box", emptyBounds.equals(resource.getNativeBoundingBox()));