@Test public void testSetBounds() { Envelope2D testEnvelope = new Envelope2D(); testEnvelope.setBounds(envelope2D); assertNotNull("envelope2d is null", testEnvelope); assertEquals("setbounds envelopes do not match", envelope2D, testEnvelope); }
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()); } } }
@Override public Object visit(BBOX filter, Object data) { Envelope2D envelope = (Envelope2D) data; filter.getBounds(); envelope.setBounds(filter.getBounds()); return super.visit(filter, data); }
@Override public Object visit(Intersects filter, Object data) { Envelope2D envelope = (Envelope2D) data; Geometry polygon= ((Geometry)((Literal)filter.getExpression2()).getValue()); org.opengis.geometry.Geometry polygon2 = JTSUtils.jtsToGo1(polygon, envelope.getCoordinateReferenceSystem()); envelope.setBounds(new Envelope2D(polygon2.getEnvelope())); return super.visit(filter, data); }