Skip to content

Commit

Permalink
Merge pull request #741 from afischerdev/beeline
Browse files Browse the repository at this point in the history
Enable beeline voicehints when there are no detours
  • Loading branch information
afischerdev authored Nov 18, 2024
2 parents adf6bb5 + b76dc9b commit f2cba63
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
19 changes: 11 additions & 8 deletions brouter-core/src/main/java/btools/router/OsmTrack.java
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,8 @@ public void processVoiceHints(RoutingContext rc) {
voiceHints.setTransportMode(rc.carMode, rc.bikeMode);
voiceHints.turnInstructionMode = rc.turnInstructionMode;

if (detourMap == null) {
if (detourMap == null && !rc.hasDirectRouting) {
// only when no direct way points
return;
}
int nodeNr = nodes.size() - 1;
Expand Down Expand Up @@ -487,13 +488,15 @@ public void processVoiceHints(RoutingContext rc) {
input.distanceToNext = node.calcDistance(node.origin);
}
}
OsmPathElementHolder detours = detourMap.get(node.origin.getIdFromPos());
if (nodeNr >= 0 && detours != null) {
OsmPathElementHolder h = detours;
while (h != null) {
OsmPathElement e = h.node;
input.addBadWay(startSection(e, node.origin));
h = h.nextHolder;
if (detourMap != null) {
OsmPathElementHolder detours = detourMap.get(node.origin.getIdFromPos());
if (nodeNr >= 0 && detours != null) {
OsmPathElementHolder h = detours;
while (h != null) {
OsmPathElement e = h.node;
input.addBadWay(startSection(e, node.origin));
h = h.nextHolder;
}
}
}
/* else if (nodeNr == 0 && detours != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ public void readGlobalConfig() {
public boolean showSpeedProfile;
public boolean inverseRouting;
public boolean showTime;
public boolean hasDirectRouting;

public String outputFormat = "gpx";
public boolean exportWaypoints = false;
Expand Down
2 changes: 2 additions & 0 deletions brouter-core/src/main/java/btools/router/RoutingEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@ private OsmTrack tryFindTrack(OsmTrack[] refTracks, OsmTrack[] lastTracks) {
}
}

routingContext.hasDirectRouting = hasDirectRouting;

OsmPath.seg = 1; // set segment counter
for (int i = 0; i < matchedWaypoints.size() - 1; i++) {
if (lastTracks[i] != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ public List<VoiceHint> postProcess(List<VoiceHint> inputs, double catchingRange,
nextInput = inputs.get(hintIdx + 1);
}

if (input.cmd == VoiceHint.BL) {
results.add(input);
continue;
}

if (nextInput == null) {
if ((input.cmd == VoiceHint.C ||
input.cmd == VoiceHint.KR ||
Expand Down

0 comments on commit f2cba63

Please sign in to comment.