List<Edge> extraEdges) {
LOG.debug("Looking for/making a vertex near {}", location);
// first, check for intersections very close by
Coordinate coord = location.getCoordinate();
StreetVertex intersection = getIntersectionAt(coord);
String calculatedName = location.name;
if (intersection != null) {
// We have an intersection vertex. Check that this vertex has edges we can traverse.
boolean canEscape = false;
if (options == null) {
canEscape = true; // Some tests do not supply options.
} else {
TraversalRequirements reqs = new TraversalRequirements(options);
for (StreetEdge e : Iterables.filter ( options.arriveBy ?
intersection.getIncoming() : intersection.getOutgoing(),
StreetEdge.class)) {
if (reqs.canBeTraversed(e)) {
canEscape = true;
break;
}
}
}
if (canEscape) {
// Coordinate is at an intersection or street endpoint, and has traversible edges.
if (!location.hasName()) {
LOG.debug("found intersection {}. not splitting.", intersection);
// generate names for corners when no name was given
Set<String> uniqueNameSet = new HashSet<String>();
for (Edge e : intersection.getOutgoing()) {
if (e instanceof StreetEdge) {
uniqueNameSet.add(e.getName());
}
}
List<String> uniqueNames = new ArrayList<String>(uniqueNameSet);