rtree.insert(getEnvelope(ogcGeometry, radius), new GeometryWithPosition(ogcGeometry, partition, position));
public boolean add(SimpleFeature feature) { ReferencedEnvelope bounds = ReferencedEnvelope.reference(feature.getBounds()); index.insert(bounds, feature); return false; }
public boolean addAll(Collection<? extends SimpleFeature> collection) { for (SimpleFeature feature : collection) { try { ReferencedEnvelope bounds = ReferencedEnvelope.reference(feature.getBounds()); index.insert(bounds, feature); } catch (Throwable t) { } } return false; }
public void add(T te) { rectangles.add(te); si.insert(new Envelope(te.getLeft(), te.getRight(), te.getBottom(), te.getTop()), te); }
env.getHeight()), 0); tree.insert(g.getEnvelopeInternal(), granule);
public boolean addAll( FeatureCollection<? extends SimpleFeatureType, ? extends SimpleFeature> collection) { FeatureIterator<? extends SimpleFeature> iter = collection.features(); try { while (iter.hasNext()) { try { SimpleFeature feature = iter.next(); ReferencedEnvelope bounds = ReferencedEnvelope.reference(feature.getBounds()); index.insert(bounds, feature); } catch (Throwable t) { } } } finally { iter.close(); } return false; }
public IndexedFeatureResults(SimpleFeatureCollection results) throws IOException, IllegalAttributeException { // copy results attributes super(null, results.getSchema()); // load features into the index SimpleFeatureIterator reader = null; bounds = new Envelope(); count = 0; try { reader = results.features(); SimpleFeature f; Envelope env; while (reader.hasNext()) { f = reader.next(); env = ((Geometry) f.getDefaultGeometry()).getEnvelopeInternal(); bounds.expandToInclude(env); count++; index.insert(env, f); } } finally { if (reader != null) reader.close(); } }
private void fillCache(Query query) throws IOException { Query cloned = new DefaultQuery(query); cloned.getHints().remove(Hints.GEOMETRY_DISTANCE); FeatureCollection features = wrapped.getFeatures(cloned); FeatureIterator fi = features.features(); index = null; STRtree newIndex = new STRtree(); while (fi.hasNext()) { // consider turning all geometries into packed ones, to save space Feature f = fi.next(); newIndex.insert(ReferencedEnvelope.reference(f.getBounds()), f); } fi.close(); index = newIndex; cachedQuery = query; cachedBounds = getEnvelope(query.getFilter()); dirty = false; }
public void filter(Geometry geom) { // only insert atomic geometries if (geom instanceof GeometryCollection) return; index.insert(geom.getEnvelopeInternal(), geom); }
public void insert(Envelope itemEnv, Object item) { index.insert(itemEnv, item); } public List query(Envelope searchEnv)
private void addToIndex(SegmentString segStr) { List segChains = MonotoneChainBuilder.getChains(segStr.getCoordinates(), segStr); for (Iterator i = segChains.iterator(); i.hasNext(); ) { MonotoneChain mc = (MonotoneChain) i.next(); index.insert(mc.getEnvelope(), mc); } }
/** * * @param coords * @param factory * @param strtree */ public static void addSegments(final Coordinate[] coords, GeometryFactory factory, STRtree strtree) { for (int j = 0; j < coords.length - 1; j++) { Coordinate startCoord = coords[j]; Coordinate endCoord = coords[j + 1]; if (!(Double.isNaN(startCoord.z) || Double.isNaN(endCoord.z))) { LineString lineString = factory.createLineString( new Coordinate[]{startCoord, endCoord}); strtree.insert(lineString.getEnvelopeInternal(), lineString); } } }
public static STRtree build(Geometry g) { STRtree tree = new STRtree(STR_TREE_NODE_CAPACITY); List sections = computeFacetSequences(g); for (Iterator i = sections.iterator(); i.hasNext();) { FacetSequence section = (FacetSequence) i.next(); tree.insert(section.getEnvelope(), section); } tree.build(); return tree; }
for (Iterator i = inputPolys.iterator(); i.hasNext(); ) { Geometry item = (Geometry) i.next(); index.insert(item.getEnvelopeInternal(), item);
public void testDisallowedInserts() { STRtree t = new STRtree(5); t.insert(new Envelope(0, 0, 0, 0), new Object()); t.insert(new Envelope(0, 0, 0, 0), new Object()); t.query(new Envelope()); try { t.insert(new Envelope(0, 0, 0, 0), new Object()); assertTrue(false); } catch (AssertionFailedException e) { assertTrue(true); } }
public void testRemove() { STRtree tree = new STRtree(); tree.insert(new Envelope(0, 10, 0, 10), "1"); tree.insert(new Envelope(5, 15, 5, 15), "2"); tree.insert(new Envelope(10, 20, 10, 20), "3"); tree.insert(new Envelope(15, 25, 15, 25), "4"); tree.remove(new Envelope(10, 20, 10, 20), "4"); assertEquals(3, tree.size()); }
rtree.insert(getEnvelope(ogcGeometry, radius), new GeometryWithPosition(ogcGeometry, partition, position));
rtree.insert(getEnvelope(ogcGeometry, radius), new GeometryWithPosition(ogcGeometry, partition, position));
for(int i=0;i<totalRecords;i++) strtree.insert(testDataset.get(i).getEnvelopeInternal(), testDataset.get(i));
for (int i = 0; i < nb; i++) { Geometry geom = triangles.getGeometryN(i); sTRtree.insert(geom.getEnvelopeInternal(), TINFeatureFactory.createTriangle(geom));