use of com.graphhopper.matching.EdgeMatch in project graphhopper by graphhopper.
the class MapMatchingTest method fetchStreets.
static List<String> fetchStreets(List<EdgeMatch> emList) {
List<String> list = new ArrayList<>();
int prevNode = -1;
List<String> errors = new ArrayList<>();
for (EdgeMatch em : emList) {
// + ":" + em.getEdgeState().getBaseNode() +
String str = em.getEdgeState().getName();
// "->" + em.getEdgeState().getAdjNode();
if (list.size() == 0 || !list.get(list.size() - 1).equals(str))
list.add(str);
if (prevNode >= 0) {
if (em.getEdgeState().getBaseNode() != prevNode) {
errors.add(str);
}
}
prevNode = em.getEdgeState().getAdjNode();
}
if (!errors.isEmpty()) {
throw new IllegalStateException("Errors:" + errors);
}
return list;
}
Aggregations