/** * {@inheritDoc} */ @Override public EntityContainer createContainer(Bound entity) { return new BoundContainer(entity); } }
/** * {@inheritDoc} */ @Override public EntityContainer createContainer(Bound entity) { return new BoundContainer(entity); } }
/** * {@inheritDoc} */ @Override public BoundContainer next() { return new BoundContainer(source.next()); }
/** * {@inheritDoc} */ @Override public BoundContainer next() { return new BoundContainer(source.next()); }
/** * {@inheritDoc} */ @Override public BoundContainer getWriteableInstance() { if (bound.isReadOnly()) { return new BoundContainer(bound.getWriteableInstance()); } else { return this; } } }
/** * {@inheritDoc} */ @Override public void end() { getSink().process(new BoundContainer(bound)); bound = null; }
/** * {@inheritDoc} */ @Override public void end() { getSink().process(new BoundContainer(bound)); bound = null; }
/** * {@inheritDoc} */ @Override public void end() { getSink().process(new BoundContainer(bound)); bound = null; }
/** * {@inheritDoc} */ @Override public void end() { getSink().process(new BoundContainer(bound)); bound = null; }
/** * {@inheritDoc} */ @Override public BoundContainer getWriteableInstance() { if (bound.isReadOnly()) { return new BoundContainer(bound.getWriteableInstance()); } else { return this; } } }
/** * 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."); }
/** * Test processing a single Bound entity. */ @Test public final void testProcess1() { testOsmWriter.process(new BoundContainer(new Bound("source"))); // Nothing to assert; just expect no exception }
/** * Test processing a Bound after a Node. */ @Test(expected = OsmosisRuntimeException.class) public final void testProcess4() { testOsmWriter.process(new NodeContainer( new Node( new CommonEntityData(1234, 0, new Date(), new OsmUser(12, "OsmosisTest"), 0, new ArrayList<Tag>()), 20, 20))); testOsmWriter.process(new BoundContainer(new Bound("source"))); fail("Expected to throw an exception."); }
@Override public BoundContainer apply(Osmformat.HeaderBlock header) { Bound bound; if (header.hasBbox()) { Osmformat.HeaderBBox bbox = header.getBbox(); bound = new Bound(bbox.getRight() * COORDINATE_SCALING_FACTOR, bbox.getLeft() * COORDINATE_SCALING_FACTOR, bbox.getTop() * COORDINATE_SCALING_FACTOR, bbox.getBottom() * COORDINATE_SCALING_FACTOR, header.getSource()); } else { bound = new Bound(header.getSource()); } return new BoundContainer(bound); } }
/** * Test the non-passing of a Bound which does not intersect the filter area. */ @Test public final void testProcessBoundContainer2() { simpleAreaFilter.process(new BoundContainer(nonIntersectingBound)); simpleAreaFilter.complete(); assertNull(entityInspector.getLastEntityContainer()); }
/** * 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()); }
@Override public void run() { try { sink.initialize(Collections.<String, Object>emptyMap()); if (publishBound) { sink.process(new BoundContainer(bound)); } sink.process(new NodeContainer(createNode())); sink.complete(); } finally { sink.close(); } }
/** * Test processing a Bound after a Way. */ @Test(expected = OsmosisRuntimeException.class) public final void testProcess7() { Way testWay; testWay = new Way(new CommonEntityData(3456, 0, new Date(), new OsmUser(12, "OsmosisTest"), 0)); testWay.getWayNodes().add(new WayNode(1234)); testWay.getWayNodes().add(new WayNode(1235)); testWay.getTags().add(new Tag("test_key1", "test_value1")); testOsmWriter.process(new WayContainer(testWay)); testOsmWriter.process(new BoundContainer(new Bound("source"))); }
/** * Test processing a Bound after a Relation. */ @Test(expected = OsmosisRuntimeException.class) public final void testProcess9() { Relation testRelation; testRelation = new Relation(new CommonEntityData(3456, 0, new Date(), new OsmUser(12, "OsmosisTest"), 0)); testRelation.getMembers().add(new RelationMember(1234, EntityType.Node, "role1")); testRelation.getTags().add(new Tag("test_key1", "test_value1")); testOsmWriter.process(new RelationContainer(testRelation)); testOsmWriter.process(new BoundContainer(new Bound("source"))); } }
/** * Tests the bound computation if no nodes but a bound entity is upstream. */ @Test public void computeBoundNoNodesWithBound() { SinkEntityInspector inspector = new SinkEntityInspector(); BoundComputer bc = new BoundComputer("NewBound"); bc.setSink(inspector); bc.process(new BoundContainer(new Bound("Test"))); bc.complete(); bc.close(); Assert.assertNull(inspector.getLastEntityContainer()); }