Merge pull request #741 from afischerdev/beeline

Enable beeline voicehints when there are no detours
This commit is contained in:
afischerdev 2024-11-18 17:31:21 +01:00 committed by GitHub
commit f2cba63c8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 8 deletions

View File

@ -452,7 +452,8 @@ public final class OsmTrack {
voiceHints.setTransportMode(rc.carMode, rc.bikeMode); voiceHints.setTransportMode(rc.carMode, rc.bikeMode);
voiceHints.turnInstructionMode = rc.turnInstructionMode; voiceHints.turnInstructionMode = rc.turnInstructionMode;
if (detourMap == null) { if (detourMap == null && !rc.hasDirectRouting) {
// only when no direct way points
return; return;
} }
int nodeNr = nodes.size() - 1; int nodeNr = nodes.size() - 1;
@ -487,13 +488,15 @@ public final class OsmTrack {
input.distanceToNext = node.calcDistance(node.origin); input.distanceToNext = node.calcDistance(node.origin);
} }
} }
OsmPathElementHolder detours = detourMap.get(node.origin.getIdFromPos()); if (detourMap != null) {
if (nodeNr >= 0 && detours != null) { OsmPathElementHolder detours = detourMap.get(node.origin.getIdFromPos());
OsmPathElementHolder h = detours; if (nodeNr >= 0 && detours != null) {
while (h != null) { OsmPathElementHolder h = detours;
OsmPathElement e = h.node; while (h != null) {
input.addBadWay(startSection(e, node.origin)); OsmPathElement e = h.node;
h = h.nextHolder; input.addBadWay(startSection(e, node.origin));
h = h.nextHolder;
}
} }
} }
/* else if (nodeNr == 0 && detours != null) { /* else if (nodeNr == 0 && detours != null) {

View File

@ -203,6 +203,7 @@ public final class RoutingContext {
public boolean showSpeedProfile; public boolean showSpeedProfile;
public boolean inverseRouting; public boolean inverseRouting;
public boolean showTime; public boolean showTime;
public boolean hasDirectRouting;
public String outputFormat = "gpx"; public String outputFormat = "gpx";
public boolean exportWaypoints = false; public boolean exportWaypoints = false;

View File

@ -631,6 +631,8 @@ public class RoutingEngine extends Thread {
} }
} }
routingContext.hasDirectRouting = hasDirectRouting;
OsmPath.seg = 1; // set segment counter OsmPath.seg = 1; // set segment counter
for (int i = 0; i < matchedWaypoints.size() - 1; i++) { for (int i = 0; i < matchedWaypoints.size() - 1; i++) {
if (lastTracks[i] != null) { if (lastTracks[i] != null) {

View File

@ -294,6 +294,11 @@ public final class VoiceHintProcessor {
nextInput = inputs.get(hintIdx + 1); nextInput = inputs.get(hintIdx + 1);
} }
if (input.cmd == VoiceHint.BL) {
results.add(input);
continue;
}
if (nextInput == null) { if (nextInput == null) {
if ((input.cmd == VoiceHint.C || if ((input.cmd == VoiceHint.C ||
input.cmd == VoiceHint.KR || input.cmd == VoiceHint.KR ||