Coordinate coordinate = v.getCoordinate();
/* is there a bundle of edges nearby to use or split? */
GenericLocation location = new GenericLocation(coordinate);
TraversalRequirements reqs = new TraversalRequirements(options);
CandidateEdgeBundle edges = linker.index.getClosestEdges(location, reqs, null,
nearbyRouteEdges, possibleTransitLinksOnly);
if (edges == null || edges.size() < 1) {
// no edges were found nearby, or a bidirectional/loop bundle of edges was not identified
LOG.debug("found too few edges: {} {}", v.getName(), v.getCoordinate());
return null;
}
// if the bundle was caught endwise (T intersections and dead ends),
// get the intersection instead.
if (edges.endwise()) {
List<StreetVertex> list = Arrays.asList(edges.endwiseVertex);
linker.splitVertices.put(v, list);
return list;
} else {
/* is the stop right at an intersection? */
StreetVertex atIntersection = linker.index.getIntersectionAt(coordinate);
if (atIntersection != null) {
// if so, the stop can be linked directly to all vertices at the intersection
if (edges.getScore() > distanceLibrary.distance(atIntersection.getCoordinate(), coordinate))
return Arrays.asList(atIntersection);
}
return getSplitterVertices(vertexLabel, edges.toEdgeList(), coordinate);
}
}