prepare rerouting
This commit is contained in:
parent
ae7411d4a0
commit
e5ecd14ce1
2 changed files with 16 additions and 1 deletions
|
@ -32,6 +32,8 @@ public class RoutingEngine extends Thread {
|
||||||
public final static int BROUTER_ENGINEMODE_SEED = 1;
|
public final static int BROUTER_ENGINEMODE_SEED = 1;
|
||||||
public final static int BROUTER_ENGINEMODE_GETELEV = 2;
|
public final static int BROUTER_ENGINEMODE_GETELEV = 2;
|
||||||
|
|
||||||
|
public final static int BROUTER_ENGINEMODE_PREPARE_REROUTE = 6;
|
||||||
|
|
||||||
private NodesCache nodesCache;
|
private NodesCache nodesCache;
|
||||||
private SortedHeap<OsmPath> openSet = new SortedHeap<>();
|
private SortedHeap<OsmPath> openSet = new SortedHeap<>();
|
||||||
private boolean finished = false;
|
private boolean finished = false;
|
||||||
|
@ -160,6 +162,7 @@ public class RoutingEngine extends Thread {
|
||||||
|
|
||||||
switch (engineMode) {
|
switch (engineMode) {
|
||||||
case BROUTER_ENGINEMODE_ROUTING:
|
case BROUTER_ENGINEMODE_ROUTING:
|
||||||
|
case BROUTER_ENGINEMODE_PREPARE_REROUTE:
|
||||||
if (waypoints.size() < 2) {
|
if (waypoints.size() < 2) {
|
||||||
throw new IllegalArgumentException("we need two lat/lon points at least!");
|
throw new IllegalArgumentException("we need two lat/lon points at least!");
|
||||||
}
|
}
|
||||||
|
@ -191,6 +194,9 @@ public class RoutingEngine extends Thread {
|
||||||
ArrayList<String> messageList = new ArrayList<>();
|
ArrayList<String> messageList = new ArrayList<>();
|
||||||
for (int i = 0; ; i++) {
|
for (int i = 0; ; i++) {
|
||||||
track = findTrack(refTracks, lastTracks);
|
track = findTrack(refTracks, lastTracks);
|
||||||
|
|
||||||
|
if (engineMode==BROUTER_ENGINEMODE_PREPARE_REROUTE) break; // no output for rerouting prepare
|
||||||
|
|
||||||
track.message = "track-length = " + track.distance + " filtered ascend = " + track.ascend
|
track.message = "track-length = " + track.distance + " filtered ascend = " + track.ascend
|
||||||
+ " plain-ascend = " + track.plainAscend + " cost=" + track.cost;
|
+ " plain-ascend = " + track.plainAscend + " cost=" + track.cost;
|
||||||
if (track.energy != 0) {
|
if (track.energy != 0) {
|
||||||
|
@ -577,6 +583,10 @@ public class RoutingEngine extends Thread {
|
||||||
boolean dirty = found && nearbyTrack.isDirty;
|
boolean dirty = found && nearbyTrack.isDirty;
|
||||||
logInfo("read referenceTrack, found=" + found + " dirty=" + dirty + " " + debugInfo);
|
logInfo("read referenceTrack, found=" + found + " dirty=" + dirty + " " + debugInfo);
|
||||||
}
|
}
|
||||||
|
if (nearbyTrack != null &&
|
||||||
|
engineMode==BROUTER_ENGINEMODE_PREPARE_REROUTE) {
|
||||||
|
return null; // already rerouting prepared
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matchedWaypoints == null) { // could exist from the previous alternative level
|
if (matchedWaypoints == null) { // could exist from the previous alternative level
|
||||||
|
@ -1067,6 +1077,10 @@ public class RoutingEngine extends Thread {
|
||||||
track.profileTimestamp = routingContext.profileTimestamp;
|
track.profileTimestamp = routingContext.profileTimestamp;
|
||||||
track.isDirty = isDirty;
|
track.isDirty = isDirty;
|
||||||
foundRawTrack = track;
|
foundRawTrack = track;
|
||||||
|
if (engineMode==BROUTER_ENGINEMODE_PREPARE_REROUTE) {
|
||||||
|
return null; // rerouting prepared
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wasClean && isDirty) {
|
if (!wasClean && isDirty) {
|
||||||
|
|
|
@ -110,7 +110,8 @@ public class BRouter {
|
||||||
}
|
}
|
||||||
re.doRun(0);
|
re.doRun(0);
|
||||||
|
|
||||||
if (engineMode == RoutingEngine.BROUTER_ENGINEMODE_ROUTING) {
|
if (engineMode == RoutingEngine.BROUTER_ENGINEMODE_ROUTING ||
|
||||||
|
engineMode == RoutingEngine.BROUTER_ENGINEMODE_PREPARE_REROUTE) {
|
||||||
// store new reference track if any
|
// store new reference track if any
|
||||||
// (can exist for timed-out search)
|
// (can exist for timed-out search)
|
||||||
if (re.getFoundRawTrack() != null) {
|
if (re.getFoundRawTrack() != null) {
|
||||||
|
|
Loading…
Reference in a new issue