use of com.revolsys.geometry.index.strtree.StrTree in project com.revolsys.open by revolsys.
the class STRtreeTest method testEmptyTreeUsingItemVisitorQuery.
public void testEmptyTreeUsingItemVisitorQuery() {
final StrTree tree = new StrTree();
tree.query(new BoundingBoxDoubleXY(0, 1, 0, 1), (item) -> {
assertTrue("Should never reach here", true);
});
}
use of com.revolsys.geometry.index.strtree.StrTree in project com.revolsys.open by revolsys.
the class STRtreeTest method testEmptyTreeUsingListQuery.
public void testEmptyTreeUsingListQuery() {
final StrTree tree = new StrTree();
final List list = tree.getItems(new BoundingBoxDoubleXY(0, 1, 0, 1));
assertTrue(list.isEmpty());
}
use of com.revolsys.geometry.index.strtree.StrTree in project com.revolsys.open by revolsys.
the class STRtreeTest method testSpatialIndex.
public void testSpatialIndex() throws Exception {
final SpatialIndexTester tester = new SpatialIndexTester();
tester.setSpatialIndex(new StrTree(4));
tester.init();
tester.run();
assertTrue(tester.isSuccess());
}
use of com.revolsys.geometry.index.strtree.StrTree in project com.revolsys.open by revolsys.
the class IndexedNestedRingTester method buildIndex.
private void buildIndex() {
this.index = new StrTree();
for (int i = 0; i < this.rings.size(); i++) {
final LinearRing ring = (LinearRing) this.rings.get(i);
final BoundingBox env = ring.getBoundingBox();
this.index.insertItem(env, ring);
}
}
use of com.revolsys.geometry.index.strtree.StrTree in project com.revolsys.open by revolsys.
the class FacetSequenceTreeBuilder method build.
public static StrTree<FacetSequence> build(final Geometry g) {
final StrTree<FacetSequence> tree = new StrTree<>(STR_TREE_NODE_CAPACITY);
for (final LineString line : g.getGeometryComponents(LineString.class)) {
int i = 0;
final int size = line.getVertexCount();
while (i <= size - 1) {
int end = i + FACET_SEQUENCE_SIZE + 1;
// section
if (end >= size - 1) {
end = size;
}
final LineFacetSequence facetSequence = new LineFacetSequence(line, i, end);
final BoundingBox boundingBox = line.getBoundingBox();
tree.insertItem(boundingBox, facetSequence);
i = i + FACET_SEQUENCE_SIZE;
}
}
for (final Point point : g.getGeometries(Point.class)) {
final PointFacetSequence facetSequence = new PointFacetSequence(point);
tree.insertItem(point.getBoundingBox(), facetSequence);
}
tree.build();
return tree;
}
Aggregations