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());
}
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);
}
}
Aggregations