public ReferencedEnvelope getBounds() { CoordinateReferenceSystem crs = schema.getCoordinateReferenceSystem(); Envelope bounds = (Envelope) index.getRoot().getBounds(); return new ReferencedEnvelope(bounds, crs); }
@Override protected Iterator openIterator() { List features; synchronized (CachingFeatureSource.this) { try { if (index == null || dirty || !isSubQuery(query)) { fillCache(query); } if (queryBounds != null) { features = index.query(queryBounds); } else { features = index.query((Envelope) index.getRoot().getBounds()); } } catch (Exception e) { throw new RuntimeException("Failed to get data", e); } } Iterator it = features.iterator(); if (query.getFilter() != null && Filter.INCLUDE.equals(query.getFilter())) { it = new FilteringIterator<Feature>(it, query.getFilter()); } if (targetSchema != sourceSchema) { it = new ReTypingIterator(it, sourceSchema, targetSchema); } return it; }
/** * Removes an item from the tree. * (Builds the tree, if necessary.) */ protected boolean remove(Object searchBounds, Object item) { build(); if (getIntersectsOp().intersects(root.getBounds(), searchBounds)) { return remove(searchBounds, root, item); } return false; }
/** * Also builds the tree, if necessary. */ protected List query(Object searchBounds) { build(); ArrayList matches = new ArrayList(); if (isEmpty()) { //Assert.isTrue(root.getBounds() == null); return matches; } if (getIntersectsOp().intersects(root.getBounds(), searchBounds)) { queryInternal(searchBounds, root, matches); } return matches; }
/** * Also builds the tree, if necessary. */ protected void query(Object searchBounds, ItemVisitor visitor) { build(); if (isEmpty()) { // nothing in tree, so return //Assert.isTrue(root.getBounds() == null); return; } if (getIntersectsOp().intersects(root.getBounds(), searchBounds)) { queryInternal(searchBounds, root, visitor); } }