public List<DirectEdge> getOutgoingEdges(Vertex vertex) { Graph graph = _graphService.getGraph(); GraphVertex gv = graph.getGraphVertex(vertex); if (gv == null) { return Collections.emptyList(); } List<DirectEdge> result = new ArrayList<DirectEdge>(); for (Edge out : gv.getOutgoing()) { if (!(out instanceof TurnEdge || out instanceof OutEdge || out instanceof PlainStreetEdge)) { continue; } result.add((StreetEdge) out); } return result; }
public boolean multipleOptionsBefore(Edge edge, State state) { Graph graph = _graphService.getGraph(); boolean foundAlternatePaths = false; Vertex start = edge.getFromVertex(); GraphVertex gv = graph.getGraphVertex(start); if (gv == null) { return false; } for (Edge out : gv.getOutgoing()) { if (out == edge) { continue; } if (!(out instanceof TurnEdge || out instanceof OutEdge || out instanceof PlainStreetEdge)) { continue; } if (state != null && out.traverse(state) == null) { continue; } // there were paths we didn't take. foundAlternatePaths = true; break; } return foundAlternatePaths; }