change use of direct routing

This commit is contained in:
afischerdev 2022-12-05 11:50:52 +01:00
parent 3e53659f18
commit d67b3c0ec9
4 changed files with 41 additions and 15 deletions

View file

@ -290,9 +290,20 @@ public final class NodesCache {
if (first_file_access_failed) {
throw new IllegalArgumentException("datafile " + first_file_access_name + " not found");
}
for (MatchedWaypoint mwp : unmatchedWaypoints) {
int len = unmatchedWaypoints.size();
for (int i = 0; i < len; i++) {
MatchedWaypoint mwp = unmatchedWaypoints.get(i);
if (mwp.crosspoint == null) {
throw new IllegalArgumentException(mwp.name + "-position not mapped in existing datafile");
if (unmatchedWaypoints.size() > 1 && i == unmatchedWaypoints.size()-1 && unmatchedWaypoints.get(i-1).direct) {
mwp.crosspoint = new OsmNode(mwp.waypoint.ilon, mwp.waypoint.ilat);
mwp.direct = true;
} else {
throw new IllegalArgumentException(mwp.name + "-position not mapped in existing datafile");
}
}
if (unmatchedWaypoints.size() > 1 && i == unmatchedWaypoints.size()-1 && unmatchedWaypoints.get(i-1).direct) {
mwp.crosspoint = new OsmNode(mwp.waypoint.ilon, mwp.waypoint.ilat);
mwp.direct = true;
}
}
}