Search in sources :

Example 6 with StrTree

use of com.revolsys.geometry.index.strtree.StrTree in project com.revolsys.open by revolsys.

the class STRtreeTest method testSerialization.

public void testSerialization() throws Exception {
    final SpatialIndexTester tester = new SpatialIndexTester();
    tester.setSpatialIndex(new StrTree(4));
    tester.init();
    StrTree tree = (StrTree) tester.getSpatialIndex();
    // create the index before serialization
    tree.getItems(BoundingBox.empty());
    final byte[] data = SerializationUtil.serialize(tree);
    tree = (StrTree) SerializationUtil.deserialize(data);
    tester.setSpatialIndex(tree);
    tester.run();
    assertTrue(tester.isSuccess());
}
Also used : StrTree(com.revolsys.geometry.index.strtree.StrTree)

Example 7 with StrTree

use of com.revolsys.geometry.index.strtree.StrTree in project com.revolsys.open by revolsys.

the class STRtreeTest method testDisallowedInserts.

public void testDisallowedInserts() {
    final StrTree t = new StrTree(5);
    t.insertItem(new BoundingBoxDoubleXY(0, 0, 0, 0), new Object());
    t.insertItem(new BoundingBoxDoubleXY(0, 0, 0, 0), new Object());
    t.getItems(BoundingBox.empty());
    try {
        t.insertItem(new BoundingBoxDoubleXY(0, 0, 0, 0), new Object());
        assertTrue(false);
    } catch (final IllegalStateException e) {
        assertTrue(true);
    }
}
Also used : StrTree(com.revolsys.geometry.index.strtree.StrTree) BoundingBoxDoubleXY(com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)

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