use of org.bboxdb.storage.sstable.spatialindex.rtree.RTreeBuilder in project bboxdb by jnidzwetzki.
the class TestRTreeIndex method testBoxQuery1d.
/**
* Test to query the index
*/
@Test(timeout = 60000)
public void testBoxQuery1d() {
final List<SpatialIndexEntry> tupleList = RTreeTestHelper.getEntryList();
final SpatialIndexBuilder index = new RTreeBuilder();
index.bulkInsert(tupleList);
RTreeTestHelper.queryIndex(tupleList, index);
}
use of org.bboxdb.storage.sstable.spatialindex.rtree.RTreeBuilder in project bboxdb by jnidzwetzki.
the class TestRTreeIndex method testQueryOnEmptytree.
@Test(timeout = 60000)
public void testQueryOnEmptytree() {
final SpatialIndexBuilder index = new RTreeBuilder();
final List<? extends SpatialIndexEntry> result = index.getEntriesForRegion(new BoundingBox(1d, 1d, 2d, 2d));
Assert.assertTrue(result.isEmpty());
}
use of org.bboxdb.storage.sstable.spatialindex.rtree.RTreeBuilder in project bboxdb by jnidzwetzki.
the class TestRTreeMemoryDeserializer method testSerializeIndex3D.
/**
* Test the encoding and the decoding of the index
* @throws StorageManagerException
* @throws IOException
* @throws InterruptedException
*/
@Test(timeout = 60000)
public void testSerializeIndex3D() throws StorageManagerException, IOException, InterruptedException {
final List<SpatialIndexEntry> tupleList = RTreeTestHelper.generateRandomTupleList(3);
final SpatialIndexBuilder index = new RTreeBuilder();
index.bulkInsert(tupleList);
RTreeTestHelper.queryIndex(tupleList, index);
final File tempFile = File.createTempFile("rtree-", "-test");
tempFile.deleteOnExit();
final RandomAccessFile raf = new RandomAccessFile(tempFile, "rw");
index.writeToFile(raf);
raf.close();
final AbstractRTreeReader indexRead = getRTreeReader();
final RandomAccessFile rafRead = new RandomAccessFile(tempFile, "r");
indexRead.readFromFile(rafRead);
rafRead.close();
RTreeTestHelper.queryIndex(tupleList, indexRead);
}
use of org.bboxdb.storage.sstable.spatialindex.rtree.RTreeBuilder in project bboxdb by jnidzwetzki.
the class TestRTreeMemoryDeserializer method testSerializeIndex1D.
/**
* Test the encoding and the decoding of the index
* @throws StorageManagerException
* @throws IOException
* @throws InterruptedException
*/
@Test(timeout = 60000)
public void testSerializeIndex1D() throws StorageManagerException, IOException, InterruptedException {
final List<SpatialIndexEntry> tupleList = RTreeTestHelper.generateRandomTupleList(1);
final SpatialIndexBuilder index = new RTreeBuilder();
index.bulkInsert(tupleList);
RTreeTestHelper.queryIndex(tupleList, index);
final File tempFile = File.createTempFile("rtree-", "-test");
tempFile.deleteOnExit();
final RandomAccessFile raf = new RandomAccessFile(tempFile, "rw");
index.writeToFile(raf);
raf.close();
final AbstractRTreeReader indexRead = getRTreeReader();
final RandomAccessFile rafRead = new RandomAccessFile(tempFile, "r");
indexRead.readFromFile(rafRead);
rafRead.close();
RTreeTestHelper.queryIndex(tupleList, indexRead);
}
use of org.bboxdb.storage.sstable.spatialindex.rtree.RTreeBuilder in project bboxdb by jnidzwetzki.
the class TestRTreeMemoryDeserializer method testSerializeIndex0.
/**
* Test different node size
* @throws StorageManagerException
* @throws IOException
* @throws InterruptedException
*/
@Test(timeout = 60000)
public void testSerializeIndex0() throws StorageManagerException, IOException, InterruptedException {
final int maxNodeSize = 12;
final RTreeBuilder index = new RTreeBuilder(maxNodeSize);
final File tempFile = File.createTempFile("rtree-", "-test");
tempFile.deleteOnExit();
final RandomAccessFile raf = new RandomAccessFile(tempFile, "rw");
index.writeToFile(raf);
raf.close();
final AbstractRTreeReader indexRead = getRTreeReader();
final RandomAccessFile rafRead = new RandomAccessFile(tempFile, "r");
indexRead.readFromFile(rafRead);
rafRead.close();
Assert.assertEquals(maxNodeSize, index.getMaxNodeSize());
Assert.assertEquals(maxNodeSize, indexRead.getMaxNodeSize());
indexRead.close();
}
Aggregations