/** * Gets the bounding box for the features in this feature collection. * * @return the envelope of the geometries contained by this feature collection. */ public ReferencedEnvelope getBounds() { if (bounds == null) { bounds = new ReferencedEnvelope(); for (Iterator i = contents.values().iterator(); i.hasNext(); ) { BoundingBox geomBounds = ((SimpleFeature) i.next()).getBounds(); // IanS - as of 1.3, JTS expandToInclude ignores "null" Envelope // and simply adds the new bounds... // This check ensures this behavior does not occur. if (!geomBounds.isEmpty()) { bounds.include(geomBounds); } } } return bounds; }
/** * Gets the bounding box for the features in this feature collection. * * @return the envelope of the geometries contained by this feature collection. */ public ReferencedEnvelope getBounds() { if (bounds == null) { bounds = new ReferencedEnvelope(); for (Iterator i = contents.values().iterator(); i.hasNext(); ) { BoundingBox geomBounds = ((SimpleFeature) i.next()).getBounds(); // IanS - as of 1.3, JTS expandToInclude ignores "null" Envelope // and simply adds the new bounds... // This check ensures this behavior does not occur. if (!geomBounds.isEmpty()) { bounds.include(geomBounds); } } } return bounds; }
protected void addToSpatialIndex(SimpleFeature f) { if (f.getDefaultGeometry() != null) { BoundingBox bounds = f.getBounds(); if (!bounds.isEmpty()) spatialIndex.insert(ReferencedEnvelope.reference(bounds), f); } }
if (empty || (cropBBox != null && cropBBox.isEmpty())) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "RequestedBBox empty or null");
if (empty || (cropBBox != null && cropBBox.isEmpty())) { if (LOGGER.isLoggable(Level.FINE)) LOGGER.log(Level.FINE, "RequestedBBox empty or null");
if (requestedBBox != null && !requestedBBox.isEmpty()) {
/** * Return gml:boundedBy property if wanted. * * @param feature feature for which bounds might be required * @param configuration encoder configuration, used to suppress feature bounds * @return the feature bounds, or null if none or unwanted */ private BoundingBox getBoundedBy(Feature feature, Configuration configuration) { // check for flag not to include bounds if (configuration.hasProperty(GMLConfiguration.NO_FEATURE_BOUNDS)) { return null; } else { BoundingBox bounds = feature.getBounds(); // do a check for the case where the feature has no geometry properties if (bounds.isEmpty() && (feature.getDefaultGeometryProperty() == null || feature.getDefaultGeometryProperty().getValue() == null)) { return null; } else { return bounds; } } }
if (requestedBBox == null || requestedBBox.isEmpty()) { if (LOGGER.isLoggable(Level.FINE)) LOGGER.log(Level.FINE, "RequestedBBox empty or null");
if (geomBounds != null && !geomBounds.isEmpty()) { bounds.include(geomBounds);
public boolean contains(BoundingBox bounds) { ensureCompatibleReferenceSystem(bounds); if (isEmpty() || bounds.isEmpty()) { return false; } return bounds.getMinX() >= this.getMinX() && bounds.getMaxX() <= this.getMaxX() && bounds.getMinY() >= this.getMinY() && bounds.getMaxY() <= this.getMaxY(); }
if (featureBounding && f.getBounds() != null && !f.getBounds().isEmpty()) {
/** * Returns {@code true} if the interior of this bounds intersects the interior of the provided * bounds. * * <p>Note this method conflicts with {@link Rectangle2D#intersects(Rectangle2D)} so you may * need to call it via envelope2d.intersects( (Envelope2D) bounds ) in order to correctly check * that the coordinate reference systems match. * * @param bounds The bounds to test for intersection. * @return {@code true} if the two bounds intersect. */ public boolean intersects(BoundingBox bounds) { ensureCompatibleReferenceSystem(bounds); if (isNull() || bounds.isEmpty()) { return false; } return !(bounds.getMinX() > this.getMaxX() || bounds.getMaxX() < this.getMinX() || bounds.getMinY() > this.getMaxY() || bounds.getMaxY() < this.getMinY()); }
@Override public void endTree(NodeRef left, NodeRef right) { String name = left == null ? right.name() : left.name(); if (NodeRef.ROOT.equals(name)) { BoundingBox lbounds = new ReferencedEnvelope(this.leftEnv); BoundingBox rbounds = new ReferencedEnvelope(this.rightEnv); BoundingBox merged; if (lbounds.isEmpty()) { merged = rbounds; } else if (rbounds.isEmpty()) { merged = lbounds; } else { merged = new ReferencedEnvelope(lbounds); merged.include(rbounds); } this.diffBoundsResult = new DiffSummary<BoundingBox, BoundingBox>(lbounds, rbounds, merged); } }
public void include(BoundingBox bounds) { if (crs == null) { this.crs = bounds.getCoordinateReferenceSystem(); } else { ensureCompatibleReferenceSystem(bounds); } if (bounds.isEmpty()) { return; } if (isNull()) { setBounds(bounds); } else { if (bounds.getMinX() < getMinX()) { this.width = width + (getMinX() - bounds.getMinX()); this.x = bounds.getMinX(); } if (bounds.getMaxX() > getMaxX()) { this.width = width + (bounds.getMaxX() - getMaxX()); } if (bounds.getMinY() < getMinY()) { this.height = height + (getMinY() - bounds.getMinY()); this.y = bounds.getMinY(); } if (bounds.getMaxY() > getMaxY()) { this.height = height + (bounds.getMaxY() - getMaxY()); } } }
private static CharSequence bounds(BoundingBox b) { if (b.isEmpty()) { return "<empty>"; } return String.format("%f,%f,%f,%f", b.getMinX(), b.getMinY(), b.getMaxX(), b.getMaxY()); }
private static CharSequence bounds(BoundingBox b) { if (b.isEmpty()) { return "<empty>"; } return String.format("%f,%f,%f,%f", b.getMinX(), b.getMinY(), b.getMaxX(), b.getMaxY()); }
private static CharSequence bounds(BoundingBox b) { if (b.isEmpty()) { return "<empty>"; } return String.format("%f,%f,%f,%f", b.getMinX(), b.getMinY(), b.getMaxX(), b.getMaxY()); }
protected void addToSpatialIndex(SimpleFeature f) { if (f.getDefaultGeometry() != null) { BoundingBox bounds = f.getBounds(); if( !bounds.isEmpty() ) spatialIndex.insert(ReferencedEnvelope.reference(bounds), f); } }
@Test public void testDiffBetweenIdenticalTrees() { String oldRefSpec = "HEAD"; String newRefSpec = "HEAD"; DiffSummary<BoundingBox, BoundingBox> diffBounds = geogig.command(DiffBounds.class) .setOldVersion(oldRefSpec).setNewVersion(newRefSpec).call(); assertTrue(diffBounds.getLeft().isEmpty()); assertTrue(diffBounds.getRight().isEmpty()); assertTrue(diffBounds.getMergedResult().get().isEmpty()); }
@Test public void testDiffBetweenIdenticalTrees() { String oldRefSpec = "HEAD"; String newRefSpec = "HEAD"; DiffSummary<BoundingBox, BoundingBox> diffBounds = geogig.command(DiffBounds.class) .setOldVersion(oldRefSpec).setNewVersion(newRefSpec).call(); assertTrue(diffBounds.getLeft().isEmpty()); assertTrue(diffBounds.getRight().isEmpty()); assertTrue(diffBounds.getMergedResult().get().isEmpty()); }