@Override public Node end() { return this.source.end(); }
@Override public List<Node> nodes() { final List<Node> result = new ArrayList<>(); result.add(this.edge.start()); result.add(this.edge.end()); return result; }
public Set<Node> connectedNodes() { final Set<Node> result = new HashSet<>(); result.add(this.start()); result.add(this.end()); return result; }
/** * @return All the {@link Edge}s connected and pointing out of the end {@link Node} of this * {@link Edge}. If this {@link Edge} is a two-way road, then the reversed {@link Edge} * will be included in the set. */ public Set<Edge> outEdges() { return this.end().outEdges(); }
public Node lastNode() { return lastEdge().end(); }
/** * This function checks to see if the end node of an Edge AtlasObject has an amenity tag with * one of the AMENITY_VALUES_TO_EXCLUDE. * * @param object * An AtlasObject (known to be an Edge) * @return {@code true} if the end node of the end has one of the AMENITY_VALUES_TO_EXCLUDE, and * {@code false} otherwise */ private boolean endNodeHasAmenityTypeToExclude(final AtlasObject object) { final Edge edge = (Edge) object; final Node endNode = edge.end(); return Validators.isOfType(endNode, AmenityTag.class, AMENITY_VALUES_TO_EXCLUDE); }
protected Stream<Edge> outEdgesStream() { return edges().stream().filter(edge -> !nodes().contains(edge.end())); }
protected Stream<Edge> junctionEdgesStream() { return edges().stream() .filter(edge -> nodes().contains(edge.start()) && nodes().contains(edge.end())); }
protected Stream<Edge> exteriorEdgesStream() { return edges().stream() .filter(edge -> !nodes().contains(edge.end()) || !nodes().contains(edge.start())); }
@Override public JsonObject geoJsonProperties() { final JsonObject properties = super.geoJsonProperties(); properties.addProperty("startNode", start().getIdentifier()); properties.addProperty("endNode", end().getIdentifier()); return properties; }
/** * Note: The start and end {@link Node}s of the {@link Route} are part of the hash code to * reduce the probability of a collision. There are other candidates to add here, like distance * between start/end, but start/end by themselves are the least computationally intensive to * derive. */ @Override public int hashCode() { return new HashCodeBuilder().append(this.start().start().getLocation()) .append(this.end().end().getLocation()).append(Iterables.asList(this)).hashCode(); }
public static CompleteEdge from(final Edge edge) { return new CompleteEdge(edge.getIdentifier(), edge.asPolyLine(), edge.getTags(), edge.start().getIdentifier(), edge.end().getIdentifier(), edge.relations().stream().map(Relation::getIdentifier).collect(Collectors.toSet())); }
/** * A {@link SyntheticBoundaryNodeTag} is a special tag that is placed on any tag that has been * cut on the border of the particular Atlas file or shard that you are processing. The cutting * process has the potential to create floating edges at the border that are in reality not * floating edges. * * @param edge * the edge that is currently be processed * @return {@code true} if the edge contains a synthetic boundary tag */ private boolean isNotOnSyntheticBoundary(final Edge edge) { return !(SyntheticBoundaryNodeTag.isBoundaryNode(edge.start()) || SyntheticBoundaryNodeTag.isBoundaryNode(edge.end())); }
@Override public Node end() { return new DynamicNode(dynamicAtlas(), subEdge().end().getIdentifier()); }
@Override public Node end() { return new MultiNode(multiAtlas(), masteriseNodeIdentifier(this.getSubEdge().end().getIdentifier())); }
public Route prepend(final Route route) { if (!start().start().equals(route.end().end())) { throw new CoreException("Cannot prepend a disconnected route."); } return new MultiRoute(route, this); }
@Test public void connectivityTest() { this.multi.forEach(atlasItem -> logger.trace(atlasItem.toString())); // Out edges of CC2: 987 Assert.assertEquals(1, this.multi.edge(6).end().outEdges().size()); Assert.assertEquals(987, this.multi.edge(6).end().outEdges().iterator().next().getIdentifier()); Assert.assertEquals(2, this.multi.edge(-9).end().outEdges().size()); Assert.assertEquals(2, this.multi.edge(-9).end().inEdges().size()); Assert.assertEquals(2, this.multi.edge(987).start().inEdges().size()); }
@Override public String toString() { return "[Edge" + ": id=" + this.getIdentifier() + ", startNode=" + start().getIdentifier() + ", endNode=" + end().getIdentifier() + ", polyLine=" + this.asPolyLine().toWkt() + ", " + tagString() + "]"; } }
@Override public String toDiffViewFriendlyString() { final String relationsString = this.parentRelationsAsDiffViewFriendlyString(); return "[Edge" + ": id=" + this.getIdentifier() + ", startNode=" + start().getIdentifier() + ", endNode=" + end().getIdentifier() + ", polyLine=" + this.asPolyLine().toWkt() + ", relations=(" + relationsString + "), " + tagString() + "]"; }
private boolean canAddEdgeToBoundary(final Edge edge, final Route boundary) { return edge.getIdentifier() != -boundary.end().getIdentifier() && edge.getOsmIdentifier() == boundary.end().getOsmIdentifier() && boundary.end().end().getLocation().equals(edge.start().getLocation()) && !boundary.includes(edge); } }