use of org.bboxdb.storage.sstable.spatialindex.SpatialIndexEntry in project bboxdb by jnidzwetzki.
the class RTreeTestHelper method queryIndex.
/**
* Test the query
*
* @param entries
* @param index
* @throws StorageManagerException
*/
public static void queryIndex(final List<SpatialIndexEntry> entries, final SpatialIndexReader index) throws StorageManagerException {
for (final SpatialIndexEntry entry : entries) {
final List<? extends SpatialIndexEntry> resultList = index.getEntriesForRegion(entry.getBoundingBox());
Assert.assertTrue(resultList.size() >= 1);
final List<Integer> keyResult = resultList.stream().map(e -> e.getValue()).filter(k -> k.equals(entry.getValue())).collect(Collectors.toList());
Assert.assertTrue("Searching for: " + entry, keyResult.size() == 1);
}
}
use of org.bboxdb.storage.sstable.spatialindex.SpatialIndexEntry in project bboxdb by jnidzwetzki.
the class RTreeTestHelper method getEntryList.
/**
* Generate a list of tuples
* @return
*/
public static List<SpatialIndexEntry> getEntryList() {
final List<SpatialIndexEntry> entryList = new ArrayList<SpatialIndexEntry>();
entryList.add(new SpatialIndexEntry(new BoundingBox(0d, 1d, 0d, 1d), 1));
entryList.add(new SpatialIndexEntry(new BoundingBox(1d, 2d, 1d, 3d), 2));
entryList.add(new SpatialIndexEntry(new BoundingBox(2d, 3d, 0d, 1d), 3));
entryList.add(new SpatialIndexEntry(new BoundingBox(3d, 4d, 3d, 7d), 4));
entryList.add(new SpatialIndexEntry(new BoundingBox(1.2d, 2.2d, 0d, 1d), 5));
entryList.add(new SpatialIndexEntry(new BoundingBox(4.6d, 5.6d, 0d, 1d), 6));
entryList.add(new SpatialIndexEntry(new BoundingBox(5.2d, 6.2d, 4d, 5d), 7));
entryList.add(new SpatialIndexEntry(new BoundingBox(5.1d, 6.1d, 0d, 1d), 8));
entryList.add(new SpatialIndexEntry(new BoundingBox(6.1d, 7.1d, 0d, 1d), 9));
entryList.add(new SpatialIndexEntry(new BoundingBox(8.1d, 9.1d, 2d, 5d), 10));
return entryList;
}
use of org.bboxdb.storage.sstable.spatialindex.SpatialIndexEntry in project bboxdb by jnidzwetzki.
the class TestRTreeIndex method testBoxesInsert.
/**
* Test to insert and to read the bounding boxes
*/
@Test(timeout = 60000)
public void testBoxesInsert() {
final List<SpatialIndexEntry> elements = RTreeTestHelper.getEntryList();
final SpatialIndexBuilder index = new RTreeBuilder();
index.bulkInsert(elements);
}
use of org.bboxdb.storage.sstable.spatialindex.SpatialIndexEntry in project bboxdb by jnidzwetzki.
the class TestRTreeIndex method testBoxQuery10d.
/**
* Test to query the index
*/
@Test(timeout = 60000)
public void testBoxQuery10d() {
final List<SpatialIndexEntry> tupleList = RTreeTestHelper.generateRandomTupleList(10);
final SpatialIndexBuilder index = new RTreeBuilder();
index.bulkInsert(tupleList);
RTreeTestHelper.queryIndex(tupleList, index);
}
use of org.bboxdb.storage.sstable.spatialindex.SpatialIndexEntry in project bboxdb by jnidzwetzki.
the class TestRTreeIndex method testCovering.
/**
* Test the covering of the nodes
*/
@Test(timeout = 60000)
public void testCovering() {
final List<SpatialIndexEntry> tupleList = RTreeTestHelper.generateRandomTupleList(3);
final RTreeBuilder index = new RTreeBuilder();
index.bulkInsert(tupleList);
index.testCovering();
}
Aggregations