@Override public Rectangle bounds() { return this.edge.bounds(); }
private boolean hasGoodMatch(final Edge edge, final Atlas other) { if (this.withGeometryMatching) { final Rectangle bounds = edge.bounds(); return hasPerfectMatch(edge, other.edgesIntersecting(bounds, otherEdge -> edge.getOsmIdentifier() == otherEdge.getOsmIdentifier())); } return false; }
final Rectangle edgeBounds = edge.bounds();
@Test public void testNotMovingTooFast() { Assert.assertEquals(1, this.dynamicAtlas.numberOfEdges()); final Iterable<Edge> edgesIntersecting = this.dynamicAtlas .edgesIntersecting(this.dynamicAtlas.edges().iterator().next().bounds()); Assert.assertEquals(1, Iterables.size(edgesIntersecting)); Assert.assertEquals("primary", edgesIntersecting.iterator().next().getTags().get("highway")); } }
@Test public void testFull() { final Atlas atlas = this.rule.getAtlas(); final Edge source = atlas.edge(3); final CompleteEdge result = CompleteEdge.from(source); Assert.assertEquals(source.getIdentifier(), result.getIdentifier()); Assert.assertEquals(source.bounds(), result.bounds()); Assert.assertEquals(source.asPolyLine(), result.asPolyLine()); Assert.assertEquals(source.start().getIdentifier(), result.start().getIdentifier()); Assert.assertEquals(source.end().getIdentifier(), result.end().getIdentifier()); Assert.assertEquals(source.getTags(), result.getTags()); Assert.assertEquals( source.relations().stream().map(Relation::getIdentifier) .collect(Collectors.toSet()), result.relations().stream().map(Relation::getIdentifier) .collect(Collectors.toSet())); }
@Test public void testShallow() { final Atlas atlas = this.rule.getAtlas(); final Edge source = atlas.edge(3); final CompleteEdge result = CompleteEdge.shallowFrom(source); Assert.assertEquals(source.getIdentifier(), result.getIdentifier()); Assert.assertEquals(source.bounds(), result.bounds()); result.withPolyLine(PolyLine.TEST_POLYLINE); Assert.assertEquals(PolyLine.TEST_POLYLINE.bounds(), result.bounds()); final Map<String, String> tags = Maps.hashMap("key", "value"); result.withTags(tags); Assert.assertEquals(tags, result.getTags()); final long startNodeIdentifier = 5; result.withStartNodeIdentifier(startNodeIdentifier); Assert.assertEquals(startNodeIdentifier, result.start().getIdentifier()); final long endNodeIdentifier = 6; result.withEndNodeIdentifier(endNodeIdentifier); Assert.assertEquals(endNodeIdentifier, result.end().getIdentifier()); result.withRelationIdentifiers(source.relations().stream().map(Relation::getIdentifier) .collect(Collectors.toSet())); Assert.assertEquals( source.relations().stream().map(Relation::getIdentifier) .collect(Collectors.toSet()), result.relations().stream().map(Relation::getIdentifier) .collect(Collectors.toSet())); } }