@Override public Edge start() { return this.upstream.start(); } }
/** * @return The set of {@link Route} that are emaning from the Via route, but which are not the * current To option. */ protected Set<Route> otherToOptions() { final Set<Route> result = new HashSet<>(); for (final Edge toEdge : this.too.start().start().outEdges()) { if (toEdge.equals(this.too.start())) { continue; } result.add(Route.forEdge(toEdge)); } return result; }
/** * 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(); }
candidateRouteEdges.remove(candidateRoute.start());
@Override public boolean equals(final Object other) { if (other instanceof Route) { final Route that = (Route) other; if (this.size() == that.size()) { return new EqualsBuilder() .append(this.start().start().getLocation(), that.start().start().getLocation()) .append(this.end().end().getLocation(), that.end().end().getLocation()) .append(Iterables.asList(this), Iterables.asList(that)).isEquals(); } } return false; }
/** * @return All the {@link Edge}s connected to the start/end {@link Node}s of this {@link Route}, * excluding {@link Edge}s in {@link Route}. If this {@link Edge} is a {@link Route} * with two-way road, then the reversed {@link Edge}s will be included in the set. This * does not include {@link Edge} connected to the interior {@link Node}s of the * {@link Route}. */ public Set<Edge> connectedEdges() { final Set<Edge> result = new HashSet<>(); for (final Edge edge : this.end().end().connectedEdges()) { if (!this.includes(edge)) { result.add(edge); } } for (final Edge edge : this.start().start().connectedEdges()) { if (!this.includes(edge)) { result.add(edge); } } return result; }
public Route append(final Route route) { if (route == null) { throw new CoreException( "Cannot append a route that is null to a route {} that ends at {}", this, this.end()); } if (!end().end().equals(route.start().start())) { throw new CoreException( "Cannot append a disconnected route:\nOne: {}\nAt: {}\nTo\nTwo: {}\nAt: {}", this, this.end(), route, route.start()); } return new MultiRoute(this, route); }
final Edge startEdge = route.start(); junctionRouteEdgeIds.add(startEdge.getIdentifier()); route.forEach(edge -> junctionEdgeIds.add(edge.getIdentifier()));
/** * Checks for roads that should not be inside a roundabout. Such roads are car navigable, not a * roundabout, bridge, or tunnel, don't have a layer tag, and have geometry inside the * roundabout. * * @param roundabout * A roundabout as a {@link Route} * @return true if there is a road that is crossing and has geometry enclosed by the roundabout */ private boolean roundaboutEnclosesRoads(final Route roundabout) { final Polygon roundaboutPoly = new Polygon(roundabout.asPolyLine()); return roundabout.start().getAtlas().edgesIntersecting(roundaboutPoly, edge -> HighwayTag.isCarNavigableHighway(edge) && !JunctionTag.isRoundabout(edge) && !this.ignoreBridgeTunnelCrossings(edge) && this.intersectsWithEnclosedGeometry(roundaboutPoly, edge)) .iterator().hasNext(); }
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); }
.anyMatch(roundaboutEdge -> !HighwayTag.isCarNavigableHighway(roundaboutEdge) || !roundaboutEdge.isMasterEdge()) || !roundaboutEdges.start().inEdges().contains(roundaboutEdges.end()))
fromMember.end().end(), toMember.start().start());
private Optional<Route> buildHighwayAreaBoundary(final Route boundary) { for (final Edge edge : boundary.end().end().connectedEdges()) { if (canAddEdgeToBoundary(edge, boundary)) { final Route extendedBoundary = boundary.append(edge); if (extendedBoundary.end().end().getLocation() .equals(extendedBoundary.start().start().getLocation())) { return Optional.of(extendedBoundary); } else { return buildHighwayAreaBoundary(extendedBoundary); } } } return Optional.empty(); }
Route route = Route.forEdge(atlas.edge(bigNodeRoute.start().getIdentifier())); for (int index = 1; index < bigNodeRoute.size(); index++)
break; if (edge.end().equals(route.start().start()))
Route route = Route.forEdge(atlas.edge(bigNodeRoute.start().getIdentifier())); for (int index = 1; index < bigNodeRoute.size(); index++)
&& !(route.start().start().equals(startNode) && route.end().end().equals(endNode)))