Search in sources :

Example 1 with StrTree

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);
    });
}
Also used : StrTree(com.revolsys.geometry.index.strtree.StrTree) BoundingBoxDoubleXY(com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)

Example 2 with StrTree

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());
}
Also used : StrTree(com.revolsys.geometry.index.strtree.StrTree) ArrayList(java.util.ArrayList) List(java.util.List) BoundingBoxDoubleXY(com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)

Example 3 with StrTree

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());
}
Also used : StrTree(com.revolsys.geometry.index.strtree.StrTree)

Example 4 with StrTree

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);
    }
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox) StrTree(com.revolsys.geometry.index.strtree.StrTree) LinearRing(com.revolsys.geometry.model.LinearRing) Point(com.revolsys.geometry.model.Point)

Example 5 with StrTree

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;
}
Also used : LineString(com.revolsys.geometry.model.LineString) BoundingBox(com.revolsys.geometry.model.BoundingBox) StrTree(com.revolsys.geometry.index.strtree.StrTree) Point(com.revolsys.geometry.model.Point) Point(com.revolsys.geometry.model.Point)

Aggregations

StrTree (com.revolsys.geometry.index.strtree.StrTree)7 BoundingBoxDoubleXY (com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)3 BoundingBox (com.revolsys.geometry.model.BoundingBox)2 Point (com.revolsys.geometry.model.Point)2 LineString (com.revolsys.geometry.model.LineString)1 LinearRing (com.revolsys.geometry.model.LinearRing)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1