Skip to content

Commit

Permalink
rework for vh on roundabouts abrensch#664
Browse files Browse the repository at this point in the history
  • Loading branch information
afischerdev committed Jan 30, 2024
1 parent e73d0e8 commit b3002a7
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions brouter-core/src/main/java/btools/router/VoiceHintProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ public List<VoiceHint> process(List<VoiceHint> inputs) {
}
if (roundaboutExit > 0) {
roundAboutTurnAngle += sumNonConsumedWithinCatchingRange(inputs, hintIdx);
double startTurn = (roundaboudStartIdx != -1 ? inputs.get(roundaboudStartIdx).goodWay.turnangle : turnAngle);
double startTurn = (roundaboudStartIdx != -1 ? inputs.get(roundaboudStartIdx + 1).goodWay.turnangle : turnAngle);
input.angle = roundAboutTurnAngle;
input.distanceToNext = distance;
input.roundaboutExit = startTurn < 0 ? -roundaboutExit : roundaboutExit;
input.roundaboutExit = startTurn < 0 ? roundaboutExit : -roundaboutExit;
distance = 0.;
results.add(input);
roundAboutTurnAngle = 0.f;
Expand Down Expand Up @@ -284,15 +284,14 @@ public List<VoiceHint> postProcess(List<VoiceHint> inputs, double catchingRange,
inputLastSaved.distanceToNext += input.distanceToNext;
}
}
}
else {
} else {
// add all others
// ignore motorway / primary continue
if (
((input.goodWay.getPrio() != 28) &&
(input.goodWay.getPrio() != 30) &&
(input.goodWay.getPrio() != 26))
|| Math.abs(input.angle) > 5.f) { // motorway / primary exit
if (((input.goodWay.getPrio() != 28) &&
(input.goodWay.getPrio() != 30) &&
(input.goodWay.getPrio() != 26))
|| input.isRoundabout()
|| Math.abs(input.angle) > 21.f) {
results.add(input);
inputLastSaved = input;
} else {
Expand All @@ -314,8 +313,7 @@ public List<VoiceHint> postProcess(List<VoiceHint> inputs, double catchingRange,
if (input.goodWay.getPrio() < input.maxBadPrio) {
if (inputLastSaved != null && inputLastSaved.cmd != VoiceHint.C
&& (inputLastSaved != null && inputLastSaved.distanceToNext > minRange)
&& transportMode != VoiceHintList.TRANS_MODE_CAR)
{
&& transportMode != VoiceHintList.TRANS_MODE_CAR) {
// add when straight and not linktype
// and last vh not straight
save = true;
Expand Down Expand Up @@ -353,8 +351,8 @@ public List<VoiceHint> postProcess(List<VoiceHint> inputs, double catchingRange,
// add when angle above 22.5 deg
save = true;
} else if (Math.abs(input.angle) < SIGNIFICANT_ANGLE) {
// add when angle below 22.5 deg
save = true;
// add when angle below 22.5 deg ???
// save = true;
} else {
// otherwise ignore but add distance to next
if (nextInput != null) { // when drop add distance to last
Expand Down

0 comments on commit b3002a7

Please sign in to comment.