@Override public Rectangle bounds() { return this.polyLine.bounds(); }
@Override public Rectangle bounds() { return asPolyLine().bounds(); }
@Override public Rectangle bounds() { return asPolyLine().bounds(); }
public CompleteLine(final Long identifier, final PolyLine polyLine, final Map<String, String> tags, final Set<Long> relationIdentifiers) { super(new EmptyAtlas()); if (identifier == null) { throw new CoreException("Identifier can never be null."); } this.originalBounds = polyLine != null ? polyLine.bounds() : null; this.aggregateBounds = this.originalBounds; this.identifier = identifier; this.polyLine = polyLine; this.tags = tags; this.relationIdentifiers = relationIdentifiers; }
public CompleteEdge(final Long identifier, final PolyLine polyLine, final Map<String, String> tags, final Long startNodeIdentifier, final Long endNodeIdentifier, final Set<Long> relationIdentifiers) { super(new EmptyAtlas()); if (identifier == null) { throw new CoreException("Identifier can never be null."); } this.originalBounds = polyLine != null ? polyLine.bounds() : null; this.aggregateBounds = this.originalBounds; this.identifier = identifier; this.polyLine = polyLine; this.tags = tags; this.startNodeIdentifier = startNodeIdentifier; this.endNodeIdentifier = endNodeIdentifier; this.relationIdentifiers = relationIdentifiers; }
public static CompleteLine shallowFrom(final Line line) { return new CompleteLine(line.getIdentifier()).withInitialBounds(line.asPolyLine().bounds()); }
public static CompleteEdge shallowFrom(final Edge edge) { return new CompleteEdge(edge.getIdentifier()).withInitialBounds(edge.asPolyLine().bounds()); }
/** * Query country boundaries which cover/partially cover given {@link PolyLine} * * @param polyLine * Any {@link PolyLine} or {@link Polygon} * @return a list of {@link CountryBoundary} */ public List<CountryBoundary> boundaries(final PolyLine polyLine) { return this.boundariesHelper(() -> this.query(polyLine.bounds().asEnvelope()), boundary -> boundary.intersects(JTS_POLYLINE_CONVERTER.convert(polyLine))); }
public Set<Node> leafNodesIntersecting(final PolyLine polyLine) { final Set<Node> result = new HashSet<>(); final Rectangle polyLineBounds = polyLine.bounds(); if (polyLineBounds.overlaps(bounds())) { if (isFinal() && (polyLine.intersects(bounds()) || bounds().fullyGeometricallyEncloses(polyLine))) { result.add(this); } else { for (final Node child : this.children) { result.addAll(child.leafNodesIntersecting(polyLine)); } } } return result; }
@Override public Iterable<? extends Shard> shardsIntersecting(final PolyLine polyLine) { return Iterables.stream(SlippyTile.allTiles(this.zoom, polyLine.bounds())) .filter(slippyTile -> polyLine.intersects(slippyTile.bounds()) || slippyTile.bounds().fullyGeometricallyEncloses(polyLine)); }
/** * Query country boundaries which cover/partially cover given {@link PolyLine}, with an * extension square box * * @param polyLine * Any {@link PolyLine} or {@link Polygon} * @param extension * Extension {@link Distance} * @return a list of {@link CountryBoundary} */ public List<CountryBoundary> boundaries(final PolyLine polyLine, final Distance extension) { return this.boundariesHelper( () -> this.query(polyLine.bounds().expand(extension).asEnvelope()), boundary -> boundary.intersects(JTS_POLYLINE_CONVERTER.convert(polyLine))); }
@Test public void testShallow() { final Atlas atlas = this.rule.getAtlas(); final Line source = atlas.line(18); final CompleteLine result = CompleteLine.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()); 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())); } }
final PolyLine edgePoly = edge.asPolyLine(); final Rectangle bounds = edge.asPolyLine().bounds();
@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())); } }
.map(collection -> collection.contains(firstBucketPolyline)).orElse(false)); Assert.assertTrue( polylineBuckets2.getBucketCollectionsForBounds(lastBucketPolyline.bounds()) .allMatch(collection -> collection.contains(lastBucketPolyline)));