recalc when wpt starts/ends in island situation
This commit is contained in:
parent
05420acc04
commit
aa1473861f
@ -550,17 +550,12 @@ public class RoutingEngine extends Thread {
|
|||||||
try {
|
try {
|
||||||
return tryFindTrack(refTracks, lastTracks);
|
return tryFindTrack(refTracks, lastTracks);
|
||||||
} catch (RoutingIslandException rie) {
|
} catch (RoutingIslandException rie) {
|
||||||
if (routingContext.useDynamicDistance && !useNodePoints) {
|
if (routingContext.useDynamicDistance) {
|
||||||
useNodePoints = true;
|
|
||||||
boolean useNodeOne = true;
|
|
||||||
if (extraWaypoints != null) useNodeOne = false;
|
|
||||||
extraWaypoints = new ArrayList<>();
|
|
||||||
for (MatchedWaypoint mwp : matchedWaypoints) {
|
for (MatchedWaypoint mwp : matchedWaypoints) {
|
||||||
if (mwp.name.contains("_add")) {
|
if (mwp.name.contains("_add")) {
|
||||||
OsmNodeNamed wp = new OsmNodeNamed(useNodeOne ? mwp.node1 : mwp.node1);
|
long n1 = mwp.node1.getIdFromPos();
|
||||||
wp.name = mwp.name;
|
long n2 = mwp.node2.getIdFromPos();
|
||||||
wp.direct = mwp.direct;
|
islandNodePairs.addTempPair(n1, n2);
|
||||||
extraWaypoints.add(wp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -634,6 +629,10 @@ public class RoutingEngine extends Thread {
|
|||||||
hasDirectRouting = true;
|
hasDirectRouting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (MatchedWaypoint mwp : matchedWaypoints) {
|
||||||
|
if (hasInfo()) logInfo("new wp=" + mwp.waypoint + " " + mwp.crosspoint + (mwp.direct ? " direct" : ""));
|
||||||
|
}
|
||||||
|
|
||||||
routingContext.checkMatchedWaypointAgainstNogos(matchedWaypoints);
|
routingContext.checkMatchedWaypointAgainstNogos(matchedWaypoints);
|
||||||
|
|
||||||
// detect target islands: restricted search in inverse direction
|
// detect target islands: restricted search in inverse direction
|
||||||
@ -1030,7 +1029,7 @@ public class RoutingEngine extends Thread {
|
|||||||
range = -MAX_DYNAMIC_RANGE;
|
range = -MAX_DYNAMIC_RANGE;
|
||||||
List<MatchedWaypoint> tmp = new ArrayList<>();
|
List<MatchedWaypoint> tmp = new ArrayList<>();
|
||||||
for (MatchedWaypoint mwp : unmatchedWaypoints) {
|
for (MatchedWaypoint mwp : unmatchedWaypoints) {
|
||||||
if (mwp.crosspoint == null) tmp.add(mwp);
|
if (mwp.crosspoint == null || mwp.radius >= routingContext.waypointCatchingRange) tmp.add(mwp);
|
||||||
}
|
}
|
||||||
ok = nodesCache.matchWaypointsToNodes(tmp, range, islandNodePairs);
|
ok = nodesCache.matchWaypointsToNodes(tmp, range, islandNodePairs);
|
||||||
}
|
}
|
||||||
@ -1057,6 +1056,9 @@ public class RoutingEngine extends Thread {
|
|||||||
onn = new OsmNodeNamed(wp.crosspoint);
|
onn = new OsmNodeNamed(wp.crosspoint);
|
||||||
onn.name = wp.name + "_add";
|
onn.name = wp.name + "_add";
|
||||||
wp.waypoint = onn;
|
wp.waypoint = onn;
|
||||||
|
waypoints.add(nmw);
|
||||||
|
wp.name = wp.name + "_add";
|
||||||
|
waypoints.add(wp);
|
||||||
} else {
|
} else {
|
||||||
OsmNodeNamed onn = new OsmNodeNamed(wp.crosspoint);
|
OsmNodeNamed onn = new OsmNodeNamed(wp.crosspoint);
|
||||||
onn.name = wp.name + "_add";
|
onn.name = wp.name + "_add";
|
||||||
@ -1065,13 +1067,30 @@ public class RoutingEngine extends Thread {
|
|||||||
nmw.node1 = new OsmNode(wp.node1.ilon, wp.node1.ilat);
|
nmw.node1 = new OsmNode(wp.node1.ilon, wp.node1.ilat);
|
||||||
nmw.node2 = new OsmNode(wp.node2.ilon, wp.node2.ilat);
|
nmw.node2 = new OsmNode(wp.node2.ilon, wp.node2.ilat);
|
||||||
nmw.direct = true;
|
nmw.direct = true;
|
||||||
wp.crosspoint = new OsmNode(wp.waypoint.ilon, wp.waypoint.ilat);
|
|
||||||
}
|
|
||||||
if (wp.name != null) nmw.name = wp.name;
|
if (wp.name != null) nmw.name = wp.name;
|
||||||
waypoints.add(nmw);
|
waypoints.add(nmw);
|
||||||
wp.name = wp.name + "_add";
|
wp.name = wp.name + "_add";
|
||||||
}
|
|
||||||
waypoints.add(wp);
|
waypoints.add(wp);
|
||||||
|
if (wp.name.startsWith("via")) {
|
||||||
|
wp.direct = true;
|
||||||
|
MatchedWaypoint emw = new MatchedWaypoint();
|
||||||
|
OsmNodeNamed onn2 = new OsmNodeNamed(wp.crosspoint);
|
||||||
|
onn2.name = wp.name + "_2";
|
||||||
|
emw.name = onn2.name;
|
||||||
|
emw.waypoint = onn2;
|
||||||
|
emw.crosspoint = new OsmNode(nmw.crosspoint.ilon, nmw.crosspoint.ilat);
|
||||||
|
emw.node1 = new OsmNode(nmw.node1.ilon, nmw.node1.ilat);
|
||||||
|
emw.node2 = new OsmNode(nmw.node2.ilon, nmw.node2.ilat);
|
||||||
|
emw.direct = false;
|
||||||
|
waypoints.add(emw);
|
||||||
|
}
|
||||||
|
wp.crosspoint = new OsmNode(wp.waypoint.ilon, wp.waypoint.ilat);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
waypoints.add(wp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
unmatchedWaypoints.clear();
|
unmatchedWaypoints.clear();
|
||||||
unmatchedWaypoints.addAll(waypoints);
|
unmatchedWaypoints.addAll(waypoints);
|
||||||
|
|||||||
@ -18,8 +18,11 @@ import btools.expressions.BExpressionContextWay;
|
|||||||
|
|
||||||
public final class NodesCache {
|
public final class NodesCache {
|
||||||
|
|
||||||
|
final static int RETRY_RANGE = 250;
|
||||||
|
|
||||||
private int MAX_DYNAMIC_CATCHES = 20; // used with RoutingEngiine MAX_DYNAMIC_RANGE = 60000m
|
private int MAX_DYNAMIC_CATCHES = 20; // used with RoutingEngiine MAX_DYNAMIC_RANGE = 60000m
|
||||||
|
|
||||||
|
|
||||||
private File segmentDir;
|
private File segmentDir;
|
||||||
private File secondarySegmentsDir = null;
|
private File secondarySegmentsDir = null;
|
||||||
|
|
||||||
@ -292,7 +295,7 @@ public final class NodesCache {
|
|||||||
int cellsize = 12500;
|
int cellsize = 12500;
|
||||||
preloadPosition(mwp.waypoint, cellsize, 1, false);
|
preloadPosition(mwp.waypoint, cellsize, 1, false);
|
||||||
// get a second chance
|
// get a second chance
|
||||||
if (mwp.crosspoint == null || mwp.radius > Math.abs(maxDistance)) {
|
if (mwp.crosspoint == null || mwp.radius > RETRY_RANGE) {
|
||||||
cellsize = 1000000 / 32;
|
cellsize = 1000000 / 32;
|
||||||
preloadPosition(mwp.waypoint, cellsize, maxDistance < 0 ? MAX_DYNAMIC_CATCHES : 2, maxDistance < 0);
|
preloadPosition(mwp.waypoint, cellsize, maxDistance < 0 ? MAX_DYNAMIC_CATCHES : 2, maxDistance < 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user