change use of direct routing
This commit is contained in:
parent
3e53659f18
commit
d67b3c0ec9
4 changed files with 41 additions and 15 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class OsmNode extends OsmLink implements OsmPos {
|
|||
/**
|
||||
* The elevation
|
||||
*/
|
||||
public short selev;
|
||||
public short selev = Short.MIN_VALUE;
|
||||
|
||||
/**
|
||||
* The node-tags, if any
|
||||
|
|
|
|||
|
|
@ -46,7 +46,24 @@ public final class WaypointMatcherImpl implements WaypointMatcher {
|
|||
if (d == 0.)
|
||||
return;
|
||||
|
||||
for (MatchedWaypoint mwp : waypoints) {
|
||||
int len = waypoints.size();
|
||||
for (int i = 0; i < len; i++) {
|
||||
MatchedWaypoint mwp = waypoints.get(i);
|
||||
|
||||
if (mwp.direct &&
|
||||
(i == 0 ||
|
||||
waypoints.get(i - 1).direct)
|
||||
) {
|
||||
if (mwp.crosspoint == null) {
|
||||
mwp.crosspoint = new OsmNode();
|
||||
mwp.crosspoint.ilon = mwp.waypoint.ilon;
|
||||
mwp.crosspoint.ilat = mwp.waypoint.ilat;
|
||||
mwp.hasUpdate = true;
|
||||
anyUpdate = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
OsmNode wp = mwp.waypoint;
|
||||
|
||||
double x1 = (lon1 - wp.ilon) * dlon2m;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue