private boolean testReferencePoint(Envelope probeEnvelope, OGCGeometry buildGeometry, int partition) { Envelope buildEnvelope = getEnvelope(buildGeometry); Envelope intersection = buildEnvelope.intersection(probeEnvelope); if (intersection.isNull()) { return false; } Rectangle extent = partitions.get(partition); double x = intersection.getMinX(); double y = intersection.getMinY(); return x >= extent.getXMin() && x < extent.getXMax() && y >= extent.getYMin() && y < extent.getYMax(); }
/** * Returns {@code true} if lengths along all dimension are zero. * * @since 2.4 */ public boolean isEmpty() { return super.isNull(); }
public Object getProperty(Object object, QName name) { // check for a polygon if (object instanceof Polygon) { object = ((Polygon) object).getEnvelopeInternal(); } Envelope e = (Envelope) object; if ("Envelope".equals(name.getLocalPart()) && !e.isNull()) { return e; } if ("Null".equals(name.getLocalPart()) && e.isNull()) { return e; } return null; } }
public Element encode(Object object, Document document, Element value) throws Exception { Envelope envelope = (Envelope) object; if (envelope.isNull()) { value.appendChild( document.createElementNS( getTarget().getNamespaceURI(), GML.Null.getLocalPart())); } return null; }
public String toString(Object obj) { if (obj == null) { throw new NullPointerException("The bounding Box obj passed in was null"); } if (!(obj instanceof Envelope)) { throw new ClassCastException("Object of type Envelope was expected."); } String s = ""; Envelope e = (Envelope) obj; if (!e.isNull()) { s += e.getMinX(); s += ("," + e.getMaxX()); s += ("," + e.getMinY()); s += ("," + e.getMaxY()); } return s; } }
s += "<bbox "; if (!e.isNull()) { s += "dynamic = \"false\" "; s += ("minx = \"" + e.getMinX() + "\" ");
if (!env.isNull()) { CoordinateReferenceSystem crs = ((GeometryDescriptor) att).getCoordinateReferenceSystem();
public Object getProperty(Object object, QName name) { Envelope envelope = (Envelope) object; if (envelope.isNull()) { return null;
/** Include the provided envelope, expanding as necessary. */ @Override public void expandToInclude(Envelope other) { if (other instanceof BoundingBox) { if (other.isNull()) { return; } BoundingBox bbox = (BoundingBox) other; ensureCompatibleReferenceSystem(bbox); expandToInclude(bbox.getLowerCorner()); expandToInclude(bbox.getUpperCorner()); } else { super.expandToInclude(other); } }
@Test public void testExclude() { Envelope env = (Envelope) Filter.EXCLUDE.accept(visitor, null); assertTrue(env.isNull()); }
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 SimpleFeatureCollection subCollection(Filter filter) { // get the new target envelope Envelope filterEnvelope = getEnvelope(filter); Envelope subEnvelope = queryBounds; if (filterEnvelope != null) { subEnvelope = subEnvelope.intersection(queryBounds); } if (subEnvelope.isNull()) { return new EmptyFeatureCollection(targetSchema); } // mix filters Query subQuery = new Query(query); Filter baseFilter = query.getFilter(); if (baseFilter != null && !Filter.INCLUDE.equals(baseFilter)) { Filter mixed = ff.and(baseFilter, filter); subQuery.setFilter(mixed); } return new CachingFeatureCollection(subEnvelope, sourceSchema, targetSchema, subQuery); } }
if (bounds == null || bounds.isNull()) { encodeNullBounds();
(Envelope) filter.accept(ExtractBoundsFilterVisitor.BOUNDS_VISITOR, null); if (envelope != null && !envelope.isNull() && !Double.isInfinite(envelope.getWidth()) && !Double.isInfinite(envelope.getHeight())) {
private void assertBounds(Envelope e1, Envelope e2, double tol) { if (e1.isNull()) { assertTrue(e2.isNull()); } assertEquals(e1.getMinX(), e2.getMinX(), tol); assertEquals(e1.getMinY(), e2.getMinY(), tol); assertEquals(e1.getMaxX(), e2.getMaxX(), tol); assertEquals(e1.getMaxY(), e2.getMaxY(), tol); }
if (schema.getGeometryDescriptor() != null) { if (targetBBox != null && !targetBBox.isNull() && !targetBBox.intersects(envelope)) { geometry = SKIP;
if (geomEnvelope.isNull()) { return null;
Envelope b = g.getEnvelopeInternal(); if (!b.isNull()) { bounds.expandToInclude(b);