Search in sources :

Example 21 with BoundContainer

use of org.openstreetmap.osmosis.core.container.v0_6.BoundContainer in project osmosis by openstreetmap.

the class PolygonFilterTest method testProcessBoundContainer2.

/**
 * Test passing a Bound which crosses the antimeredian and intersects the filter area.
 */
@Test
public final void testProcessBoundContainer2() {
    Bound compareBound;
    polyAreaFilter.process(new BoundContainer(crossingIntersectingBound));
    polyAreaFilter.complete();
    compareBound = (Bound) entityInspector.getLastEntityContainer().getEntity();
    assertTrue(Double.compare(compareBound.getRight(), 20) == 0);
    assertTrue(Double.compare(compareBound.getLeft(), -20) == 0);
    assertTrue(Double.compare(compareBound.getTop(), 20) == 0);
    assertTrue(Double.compare(compareBound.getBottom(), -20) == 0);
    assertTrue(compareBound.getOrigin().equals("crossing intersecting"));
}
Also used : BoundContainer(org.openstreetmap.osmosis.core.container.v0_6.BoundContainer) Bound(org.openstreetmap.osmosis.core.domain.v0_6.Bound) Test(org.junit.Test)

Example 22 with BoundContainer

use of org.openstreetmap.osmosis.core.container.v0_6.BoundContainer in project osmosis by openstreetmap.

the class PolygonFilterTest method testProcessBoundContainer3.

/**
 * Test the non-passing of a Bound which does not intersect the filter area.
 */
@Test
public final void testProcessBoundContainer3() {
    polyAreaFilter.process(new BoundContainer(nonIntersectingBound));
    polyAreaFilter.complete();
    assertNull(entityInspector.getLastEntityContainer());
}
Also used : BoundContainer(org.openstreetmap.osmosis.core.container.v0_6.BoundContainer) Test(org.junit.Test)

Example 23 with BoundContainer

use of org.openstreetmap.osmosis.core.container.v0_6.BoundContainer in project osmosis by openstreetmap.

the class PolygonFilterTest method testProcessBoundContainer1.

/**
 * Test passing a Bound which intersects the filter area.
 */
@Test
public final void testProcessBoundContainer1() {
    Bound compareBound;
    polyAreaFilter.process(new BoundContainer(intersectingBound));
    polyAreaFilter.complete();
    compareBound = (Bound) entityInspector.getLastEntityContainer().getEntity();
    assertTrue(Double.compare(compareBound.getRight(), 20) == 0);
    assertTrue(Double.compare(compareBound.getLeft(), 0) == 0);
    assertTrue(Double.compare(compareBound.getTop(), 20) == 0);
    assertTrue(Double.compare(compareBound.getBottom(), 0) == 0);
    assertTrue(compareBound.getOrigin().equals("intersecting"));
}
Also used : BoundContainer(org.openstreetmap.osmosis.core.container.v0_6.BoundContainer) Bound(org.openstreetmap.osmosis.core.domain.v0_6.Bound) Test(org.junit.Test)

Example 24 with BoundContainer

use of org.openstreetmap.osmosis.core.container.v0_6.BoundContainer in project osmosis by openstreetmap.

the class BoundComputer method complete.

@Override
public void complete() {
    objects.complete();
    if (nodesSeen) {
        sink.process(new BoundContainer(new Bound(right, left, top, bottom, this.origin)));
    }
    try (ReleasableIterator<EntityContainer> i = objects.iterate()) {
        while (i.hasNext()) {
            sink.process(i.next());
        }
    }
    sink.complete();
}
Also used : BoundContainer(org.openstreetmap.osmosis.core.container.v0_6.BoundContainer) Bound(org.openstreetmap.osmosis.core.domain.v0_6.Bound) EntityContainer(org.openstreetmap.osmosis.core.container.v0_6.EntityContainer)

Example 25 with BoundContainer

use of org.openstreetmap.osmosis.core.container.v0_6.BoundContainer in project osmosis by openstreetmap.

the class OsmWriterTest method testProcess2.

/**
 * Test processing a repeated Bound entity.
 */
@Test(expected = OsmosisRuntimeException.class)
public final void testProcess2() {
    testOsmWriter.process(new BoundContainer(new Bound("source")));
    testOsmWriter.process(new BoundContainer(new Bound("source2")));
    fail("Expected to throw an exception.");
}
Also used : BoundContainer(org.openstreetmap.osmosis.core.container.v0_6.BoundContainer) Bound(org.openstreetmap.osmosis.core.domain.v0_6.Bound) Test(org.junit.Test)

Aggregations

BoundContainer (org.openstreetmap.osmosis.core.container.v0_6.BoundContainer)29 Bound (org.openstreetmap.osmosis.core.domain.v0_6.Bound)22 Test (org.junit.Test)12 EntityContainer (org.openstreetmap.osmosis.core.container.v0_6.EntityContainer)10 NodeContainer (org.openstreetmap.osmosis.core.container.v0_6.NodeContainer)9 RelationContainer (org.openstreetmap.osmosis.core.container.v0_6.RelationContainer)7 WayContainer (org.openstreetmap.osmosis.core.container.v0_6.WayContainer)7 Date (java.util.Date)5 OsmosisRuntimeException (org.openstreetmap.osmosis.core.OsmosisRuntimeException)5 CommonEntityData (org.openstreetmap.osmosis.core.domain.v0_6.CommonEntityData)5 BoundContainerIterator (org.openstreetmap.osmosis.core.container.v0_6.BoundContainerIterator)4 NodeContainerIterator (org.openstreetmap.osmosis.core.container.v0_6.NodeContainerIterator)4 RelationContainerIterator (org.openstreetmap.osmosis.core.container.v0_6.RelationContainerIterator)4 WayContainerIterator (org.openstreetmap.osmosis.core.container.v0_6.WayContainerIterator)4 ReleasableIterator (org.openstreetmap.osmosis.core.lifecycle.ReleasableIterator)4 MultipleSourceIterator (org.openstreetmap.osmosis.core.store.MultipleSourceIterator)4 Node (org.openstreetmap.osmosis.core.domain.v0_6.Node)3 OsmUser (org.openstreetmap.osmosis.core.domain.v0_6.OsmUser)3 SinkEntityInspector (org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector)3 Osmformat (crosby.binary.Osmformat)2