Search in sources :

Example 61 with BoundingBox

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

the class TestBoundingBox method mergeBoxesWithWrongDimension2.

/**
 * Merge two boxes with wrong dimension
 */
@Test(expected = IllegalArgumentException.class)
public void mergeBoxesWithWrongDimension2() {
    final BoundingBox boundingBox1 = new BoundingBox(1d, 3d, 1d, 3d);
    final BoundingBox boundingBox2 = new BoundingBox(1d, 4d, 1d, 4d);
    final BoundingBox boundingBox3 = new BoundingBox(1d, 4d, 1d, 4d, 1d, 4d);
    final BoundingBox boundingBox4 = new BoundingBox(-1d, 2d, -1d, 2d, -1d, 2d);
    // Wrong dimensions
    final BoundingBox boundingBoxResult5 = BoundingBox.getCoveringBox(boundingBox1, boundingBox2, boundingBox3, boundingBox4);
    Assert.assertTrue(boundingBoxResult5 == null);
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) Test(org.junit.Test)

Example 62 with BoundingBox

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

the class TestBoundingBox method testIntersection6.

/**
 * Test the intersection of two bounding boxes
 */
@Test(timeout = 60000)
public void testIntersection6() {
    final BoundingBox boundingBox1 = new BoundingBox(1.0d, 2.0d, 1.0d, 2.0d);
    final BoundingBox boundingBox2 = new BoundingBox(1.0d, 3.0d, 1.0d, 3.0d);
    Assert.assertEquals(boundingBox1, boundingBox1.getIntersection(boundingBox2));
    Assert.assertEquals(boundingBox1, boundingBox2.getIntersection(boundingBox1));
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) Test(org.junit.Test)

Example 63 with BoundingBox

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

the class TestBoundingBox method testMergeBoxes1.

/**
 * Test merge on array
 */
@Test(timeout = 60000)
public void testMergeBoxes1() {
    final BoundingBox boundingBox1 = new BoundingBox(1d, 2d, 1d, 1d);
    final BoundingBox boundingBox2 = new BoundingBox(1d, 1.1d, 1d, 4d);
    final BoundingBox resultBox = BoundingBox.getCoveringBox(boundingBox1, boundingBox2);
    Assert.assertArrayEquals(new double[] { 1d, 2d, 1d, 4f }, resultBox.toDoubleArray(), EQUALS_DELTA);
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) Test(org.junit.Test)

Example 64 with BoundingBox

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

the class TestBoundingBox method testIntersection4.

/**
 * Test the intersection of two bounding boxes
 */
@Test(timeout = 60000)
public void testIntersection4() {
    final BoundingBox boundingBox1 = new BoundingBox(1d, 5d, 1d, 5d);
    final BoundingBox boundingBox2 = new BoundingBox(2d, 6d, 2d, 6d);
    final BoundingBox boundingBoxResult = new BoundingBox(2d, 5d, 2d, 5d);
    Assert.assertEquals(boundingBoxResult, boundingBox1.getIntersection(boundingBox2));
    Assert.assertEquals(boundingBoxResult, boundingBox2.getIntersection(boundingBox1));
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) Test(org.junit.Test)

Example 65 with BoundingBox

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

the class TestBoundingBox method testMergeBoxes4.

/**
 * Test merge on array
 */
@Test(timeout = 60000)
public void testMergeBoxes4() {
    final BoundingBox resultBox1 = BoundingBox.getCoveringBox();
    Assert.assertEquals(BoundingBox.FULL_SPACE, resultBox1);
    final BoundingBox resultBox2 = BoundingBox.getCoveringBox(BoundingBox.FULL_SPACE);
    Assert.assertEquals(BoundingBox.FULL_SPACE, resultBox2);
    final BoundingBox resultBox3 = BoundingBox.getCoveringBox(BoundingBox.FULL_SPACE, BoundingBox.FULL_SPACE);
    Assert.assertEquals(BoundingBox.FULL_SPACE, resultBox3);
}
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