Search in sources :

Example 71 with BoundingBox

use of org.bboxdb.commons.math.BoundingBox in project bboxdb by jnidzwetzki.

the class TestBoundingBox method testIntersection1.

/**
 * Test the intersection of two bounding boxes
 */
@Test(timeout = 60000)
public void testIntersection1() {
    final BoundingBox boundingBox = new BoundingBox(1d, 3d, 3d, 7d);
    Assert.assertEquals(BoundingBox.FULL_SPACE, boundingBox.getIntersection(BoundingBox.FULL_SPACE));
    Assert.assertEquals(BoundingBox.FULL_SPACE, BoundingBox.FULL_SPACE.getIntersection(boundingBox));
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) Test(org.junit.Test)

Example 72 with BoundingBox

use of org.bboxdb.commons.math.BoundingBox in project bboxdb by jnidzwetzki.

the class TestBoundingBox method testIsFullyCovered1.

/**
 * Test the is covered method
 */
@Test(timeout = 60000)
public void testIsFullyCovered1() {
    final BoundingBox boundingBox1 = new BoundingBox(0d, 10d, 0d, 10d);
    final BoundingBox boundingBox2 = new BoundingBox(1d, 5d, 1d, 5d);
    final BoundingBox boundingBox3 = new BoundingBox(1d, 11d, 1d, 11d);
    Assert.assertTrue(boundingBox1.isCovering(boundingBox1));
    Assert.assertTrue(boundingBox1.isCovering(boundingBox2));
    Assert.assertFalse(boundingBox1.isCovering(boundingBox3));
    Assert.assertFalse(boundingBox2.isCovering(boundingBox1));
    Assert.assertTrue(boundingBox2.isCovering(boundingBox2));
    Assert.assertFalse(boundingBox2.isCovering(boundingBox3));
    Assert.assertFalse(boundingBox3.isCovering(boundingBox1));
    Assert.assertTrue(boundingBox3.isCovering(boundingBox2));
    Assert.assertTrue(boundingBox3.isCovering(boundingBox3));
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) Test(org.junit.Test)

Example 73 with BoundingBox

use of org.bboxdb.commons.math.BoundingBox in project bboxdb by jnidzwetzki.

the class TestBoundingBox method testBoundingBoxSplit2.

/**
 * Test the split method
 */
@Test(expected = IllegalArgumentException.class)
public void testBoundingBoxSplit2() {
    final BoundingBox boundingBox1 = new BoundingBox(1d, 3d, 3d, 7d);
    boundingBox1.splitAndGetLeft(4d, 0, true);
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) Test(org.junit.Test)

Example 74 with BoundingBox

use of org.bboxdb.commons.math.BoundingBox in project bboxdb by jnidzwetzki.

the class TestBoundingBox method testVolume.

/**
 * Test the volume of the bounding box
 */
@Test(timeout = 60000)
public void testVolume() {
    final BoundingBox boundingBox1 = new BoundingBox(0d, 1d, 0d, 1d);
    final BoundingBox boundingBox2 = new BoundingBox(0d, 10d, 0d, 10d);
    final BoundingBox boundingBox3 = new BoundingBox(-5d, 5d, -5d, 5d);
    Assert.assertEquals(1.0, boundingBox1.getVolume(), EQUALS_DELTA);
    Assert.assertEquals(100.0, boundingBox2.getVolume(), EQUALS_DELTA);
    Assert.assertEquals(100.0, boundingBox3.getVolume(), EQUALS_DELTA);
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) Test(org.junit.Test)

Example 75 with BoundingBox

use of org.bboxdb.commons.math.BoundingBox in project bboxdb by jnidzwetzki.

the class TestBoundingBox method testLowHigh.

/**
 * Test the calculation of low and high values
 */
@Test(timeout = 60000)
public void testLowHigh() {
    final BoundingBox bb1 = new BoundingBox(1d, 11d);
    Assert.assertEquals(1d, bb1.getCoordinateLow(0), EQUALS_DELTA);
    Assert.assertEquals(11d, bb1.getCoordinateHigh(0), EQUALS_DELTA);
    final BoundingBox bb2 = new BoundingBox(1d, 11d, 10d, 60d);
    Assert.assertEquals(1d, bb2.getCoordinateLow(0), EQUALS_DELTA);
    Assert.assertEquals(11d, bb2.getCoordinateHigh(0), EQUALS_DELTA);
    Assert.assertEquals(10d, bb2.getCoordinateLow(1), EQUALS_DELTA);
    Assert.assertEquals(60d, bb2.getCoordinateHigh(1), EQUALS_DELTA);
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) Test(org.junit.Test)

Aggregations

BoundingBox (org.bboxdb.commons.math.BoundingBox)194 Test (org.junit.Test)113 Tuple (org.bboxdb.storage.entity.Tuple)61 ArrayList (java.util.ArrayList)25 JoinedTuple (org.bboxdb.storage.entity.JoinedTuple)24 DeletedTuple (org.bboxdb.storage.entity.DeletedTuple)23 BBoxDBException (org.bboxdb.misc.BBoxDBException)22 DistributionRegion (org.bboxdb.distribution.region.DistributionRegion)20 TupleStoreName (org.bboxdb.storage.entity.TupleStoreName)16 List (java.util.List)15 DistributionRegionIdMapper (org.bboxdb.distribution.region.DistributionRegionIdMapper)13 ZookeeperException (org.bboxdb.distribution.zookeeper.ZookeeperException)13 TupleStoreConfiguration (org.bboxdb.storage.entity.TupleStoreConfiguration)13 TupleListFuture (org.bboxdb.network.client.future.TupleListFuture)12 ZookeeperNotFoundException (org.bboxdb.distribution.zookeeper.ZookeeperNotFoundException)11 EmptyResultFuture (org.bboxdb.network.client.future.EmptyResultFuture)11 IOException (java.io.IOException)10 Date (java.util.Date)10 DoubleInterval (org.bboxdb.commons.math.DoubleInterval)10 SpatialIndexReadOperator (org.bboxdb.storage.queryprocessor.operator.SpatialIndexReadOperator)10