PolygonFilter extends AreaFilter { @Override public void process(BoundContainer boundContainer) { Bound newBound = null; if (area == null) { area = new PolygonFileReader(polygonFile).loadPolygon(); } for (Bound b : boundContainer.getEntity().toSimpleBound()) { if (newBound == null) { newBound = simpleBoundIntersect(b); } else { newBound = newBound.union(simpleBoundIntersect(b)); } } if (newBound != null) { super.process(new BoundContainer(newBound)); } } PolygonFilter(
			IdTrackerType idTrackerType, File polygonFile, boolean clipIncompleteEntities, boolean completeWays,
			boolean completeRelations, boolean cascadingRelations); @Override void process(BoundContainer boundContainer);  }
@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")); }
@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")); }
@Test public final void testProcessBoundContainer3() { polyAreaFilter.process(new BoundContainer(nonIntersectingBound)); polyAreaFilter.complete(); assertNull(entityInspector.getLastEntityContainer()); }