use of org.openstreetmap.osmosis.core.domain.v0_6.Bound 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"));
}
use of org.openstreetmap.osmosis.core.domain.v0_6.Bound in project osmosis by openstreetmap.
the class PolygonFilterTest method setUp.
/**
* Performs pre-test activities.
*/
@Before
public void setUp() {
OsmUser user;
List<Tag> tags;
user = new OsmUser(12, "OsmosisTest");
// All nodes have an empty tags list.
tags = new ArrayList<Tag>();
polygonFile = new File(getClass().getResource("testPolygon.txt").getFile());
entityInspector = new SinkEntityInspector();
// polyAreaFilter has a notch out of the Northeast corner.
polyAreaFilter = new PolygonFilter(IdTrackerType.Dynamic, polygonFile, false, false, false, false);
polyAreaFilter.setSink(entityInspector);
intersectingBound = new Bound(30, 0, 30, 0, "intersecting");
crossingIntersectingBound = new Bound(-10, 10, 30, -30, "crossing intersecting");
nonIntersectingBound = new Bound(30, 15, 30, 15, "nonintersecting");
inAreaNode = new Node(new CommonEntityData(1234, 0, new Date(), user, 0, tags), 5, 10);
outOfAreaNode = new Node(new CommonEntityData(1235, 0, new Date(), user, 0, tags), 15, 15);
edgeNode = new Node(new CommonEntityData(1236, 0, new Date(), user, 0, tags), 15, 10);
}
use of org.openstreetmap.osmosis.core.domain.v0_6.Bound 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"));
}
use of org.openstreetmap.osmosis.core.domain.v0_6.Bound 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();
}
use of org.openstreetmap.osmosis.core.domain.v0_6.Bound in project osmosis by openstreetmap.
the class BoundSetterFactory method createTaskManagerImpl.
@Override
protected TaskManager createTaskManagerImpl(TaskConfiguration taskConfig) {
double left;
double right;
double top;
double bottom;
int zoom;
Bound newBound = null;
String origin = null;
boolean remove;
remove = getBooleanArgument(taskConfig, ARG_REMOVE, DEFAULT_REMOVE);
if (!remove) {
origin = getStringArgument(taskConfig, ARG_ORIGIN, DEFAULT_ORIGIN);
left = getDoubleArgument(taskConfig, ARG_LEFT, DEFAULT_LEFT);
right = getDoubleArgument(taskConfig, ARG_RIGHT, DEFAULT_RIGHT);
top = getDoubleArgument(taskConfig, ARG_TOP, DEFAULT_TOP);
bottom = getDoubleArgument(taskConfig, ARG_BOTTOM, DEFAULT_BOTTOM);
zoom = getIntegerArgument(taskConfig, ARG_ZOOM, DEFAULT_ZOOM);
if (doesArgumentExist(taskConfig, ARG_X1)) {
int x1 = getIntegerArgument(taskConfig, ARG_X1);
left = xToLon(zoom, x1);
right = xToLon(zoom, getIntegerArgument(taskConfig, ARG_X2, x1) + 1);
}
if (doesArgumentExist(taskConfig, ARG_Y1)) {
int y1 = getIntegerArgument(taskConfig, ARG_Y1);
top = yToLat(zoom, y1);
bottom = yToLat(zoom, getIntegerArgument(taskConfig, ARG_Y2, y1) + 1);
}
newBound = new Bound(right, left, top, bottom, origin);
}
return new SinkSourceManager(taskConfig.getId(), new BoundSetter(newBound), taskConfig.getPipeArgs());
}
Aggregations