/** * Function for {@link SimpleEdgeWalker} that gathers connected edges that are part of a * roundabout. * * @return {@link Function} for {@link SimpleEdgeWalker} */ private Function<Edge, Stream<Edge>> isRoundaboutEdge() { return edge -> edge.connectedEdges().stream() .filter(connected -> JunctionTag.isRoundabout(connected) && !this.isExcludedHighway(connected)); }
/** * Function for {@link SimpleEdgeWalker} that gathers connected edges that are part of a * roundabout. * * @return {@link Function} for {@link SimpleEdgeWalker} */ private Function<Edge, Stream<Edge>> isRoundaboutEdge() { return edge -> edge.connectedEdges().stream() .filter(connected -> JunctionTag.isRoundabout(connected) && HighwayTag.isCarNavigableHighway(connected)); } }
/** * This checks to see if the edge has any connected edges. One of the things it has to do is * check for reverse edges, as these are considered connected edges however in terms of a * floating edge they are considered the same edge. * * @param edge * the edge you are checking * @return {@code true} if there are no connected edges, other than a reverse edge */ private boolean hasNoConnectedEdges(final Edge edge) { // Loop through all edges that are connected to the edge you are looking at final Iterable<Edge> connectedEdges = edge.connectedEdges(); for (final Edge connectedEdge : connectedEdges) { // if edge is not null (ie. valid) and not the reverse edge then immediately return // false, and it can safely assumed that this particular edge is not a floating edge if (connectedEdge != null && !edge.isReversedEdge(connectedEdge)) { return false; } } return true; }
/** * Returns all connected master, non-visited {@link Edge}s that are a continuation of the same * OSM way * * @param edge * the {@link Edge} from which we're seeking connections * @return a set of {@link Edge}s */ protected Set<Edge> getConnectedMasterEdgeOfTheSameWay(final Edge edge) { return edge.connectedEdges().stream() .filter(connection -> connection.isMasterEdge() && connection.getOsmIdentifier() == edge.getOsmIdentifier() && !this.visitedEdges.contains(connection)) .collect(Collectors.toSet()); }
for (final Edge edge : polledEdge.connectedEdges())
/** * @param edge * The {@link Edge} to look at * @return The most significant {@link HighwayTag} directly connected to this {@link Edge} * (including itself) */ private HighwayTag mostSignificantConnectedHighwayType(final Edge edge) { HighwayTag edgeTag = edge.highwayTag(); for (final Edge connected : edge.connectedEdges()) { final HighwayTag connectedTag = connected.highwayTag(); if (connectedTag.isMoreImportantThan(edgeTag)) { edgeTag = connectedTag; } } return edgeTag; }
/** * Returns all connected master {@link Edge}s that are NOT part of the same way as the given * target {@link Edge} * * @param edge * the target {@link Edge} for which we're seeking connections * @return the {@link Set} of {@link Edge}s we found */ private Set<Edge> getMasterEdgesForConnectedEdgesOfDifferentWays(final Edge edge) { return Iterables.stream(edge.connectedEdges()).filter(candidate -> candidate.isMasterEdge() && candidate.getOsmIdentifier() != edge.getOsmIdentifier()).collectToSet(); }