/** * {@inheritDoc} */ @Override public EntityContainer createContainer(Way entity) { return new WayContainer(entity); } }
/** * {@inheritDoc} */ @Override public EntityContainer createContainer(Way entity) { return new WayContainer(entity); } }
/** * {@inheritDoc} */ @Override public WayContainer next() { return new WayContainer(source.next()); }
/** * {@inheritDoc} */ @Override public WayContainer next() { return new WayContainer(source.next()); }
/** * {@inheritDoc} */ @Override public WayContainer getWriteableInstance() { if (way.isReadOnly()) { return new WayContainer(way.getWriteableInstance()); } else { return this; } } }
/** * {@inheritDoc} */ public void end() { getSink().process(new WayContainer(way)); }
/** * {@inheritDoc} */ @Override public WayContainer getWriteableInstance() { if (way.isReadOnly()) { return new WayContainer(way.getWriteableInstance()); } else { return this; } } }
/** * {@inheritDoc} */ public void end() { getSink().process(new WayContainer(way)); }
sink.process(new NodeContainer(readNode())); } else if (reader.getLocalName().equals(ELEMENT_NAME_WAY)) { sink.process(new WayContainer(readWay())); } else if (reader.getLocalName().equals(ELEMENT_NAME_RELATION)) { sink.process(new RelationContainer(readRelation()));
sink.process(new NodeContainer(readNode())); } else if (reader.getLocalName().equals(ELEMENT_NAME_WAY)) { sink.process(new WayContainer(readWay())); } else if (reader.getLocalName().equals(ELEMENT_NAME_RELATION)) { sink.process(new RelationContainer(readRelation()));
/** * {@inheritDoc} */ @Override public void process(WayContainer wayContainer) { boolean modified; wayBuilder.initialize(wayContainer.getEntity()); modified = false; modified = modified || processEntity(wayBuilder); modified = modified || processWay(wayBuilder); if (modified) { sink.process(new WayContainer(wayBuilder.buildEntity())); } else { sink.process(wayContainer); } }
/** * {@inheritDoc} */ @Override public void process(WayContainer wayContainer) { boolean modified; wayBuilder.initialize(wayContainer.getEntity()); modified = false; modified = modified || processEntity(wayBuilder); modified = modified || processWay(wayBuilder); if (modified) { sink.process(new WayContainer(wayBuilder.buildEntity())); } else { sink.process(wayContainer); } }
/** * Performs pre-test activities. */ @Before public void setUp() { OsmUser user; List<Tag> tags; user = new OsmUser(12, "OsmosisTest"); tags = Arrays.asList(new Tag("amenity", "bank"), new Tag("Akey", "Avalue")); amenityNode = new Node(new CommonEntityData(1101, 0, new Date(), user, 0, tags), 1, 2); amenityNodeContainer = new NodeContainer(amenityNode); tags = new ArrayList<Tag>(); taglessNode = new Node(new CommonEntityData(1102, 0, new Date(), user, 0, tags), 3, 4); taglessNodeContainer = new NodeContainer(taglessNode); tags = Arrays.asList(new Tag("highway", "motorway"), new Tag("Bkey", "Bvalue")); motorwayWay = new Way(new CommonEntityData(2201, 0, new Date(), user, 0, tags), new ArrayList<WayNode>()); motorwayWayContainer = new WayContainer(motorwayWay); tags = Arrays.asList(new Tag("highway", "residential"), new Tag("Ckey", "Cvalue")); residentialWay = new Way(new CommonEntityData(2202, 0, new Date(), user, 0, tags), new ArrayList<WayNode>()); residentialWayContainer = new WayContainer(residentialWay); tags = Arrays.asList(new Tag("Dkey", "Dvalue")); testRelation = new Relation(new CommonEntityData(3301, 0, new Date(), user, 0, tags), new ArrayList<RelationMember>()); testRelationContainer = new RelationContainer(testRelation); }
/** * Test processing a Way. */ @Test public final void testProcess6() { 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)); // Nothing to assert; just expect no exception }
/** * 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"))); }
/** * Tests that badly ordered input (with respect to the ids) is detected correctly. * * @throws Exception * if anything fails. */ @Test public void badSortOrderType() throws Exception { ChangeSimplifier simplifier = new ChangeSimplifier(); simplifier.setChangeSink(new NullChangeWriter()); simplifier.initialize(new HashMap<String, Object>()); Node node; Way way; way = new Way(new CommonEntityData(2, 2, new Date(), OsmUser.NONE, 2)); simplifier.process(new ChangeContainer(new WayContainer(way), ChangeAction.Modify)); try { node = new Node(new CommonEntityData(1, 2, new Date(), OsmUser.NONE, 1), 1, 1); simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify)); } catch (OsmosisRuntimeException e) { if (e.getMessage().startsWith("Pipeline entities are not sorted")) { return; } throw e; } Assert.fail("Expected exception not thrown"); } }
decodedEntities.add(new WayContainer(osmWay));
tags), nodes); sink.process(new WayContainer(tmp));
@Override public void run() { this.sink.initialize(new HashMap<>()); // Call the nodes this.source.getNodes().forEach((identifier, node) -> this.sink.process(new NodeContainer( new AtlasPrimitiveLocationItemToOsmosisNodeConverter().convert(node)))); this.source.getPoints().forEach((identifier, point) -> this.sink.process(new NodeContainer( new AtlasPrimitiveLocationItemToOsmosisNodeConverter().convert(point)))); // Call the ways this.source.getEdges().forEach((identifier, edge) -> this.sink.process( new WayContainer(new AtlasPrimitiveLineItemToOsmosisWayConverter().convert(edge)))); this.source.getLines().forEach((identifier, line) -> this.sink.process( new WayContainer(new AtlasPrimitiveLineItemToOsmosisWayConverter().convert(line)))); this.source.getAreas().forEach((identifier, area) -> this.sink.process( new WayContainer(new AtlasPrimitiveAreaToOsmosisWayConverter().convert(area)))); // Call the relations this.source.getRelations() .forEach((identifier, relation) -> this.sink.process(new RelationContainer( new AtlasPrimitiveRelationToOsmosisRelationConverter().convert(relation)))); // Close this.sink.release(); this.sink.complete(); }
container = new NodeContainer((Node) entity); } else { container = new WayContainer((Way) entity);