Skip to content

Commit

Permalink
Merge pull request #547 from afischerdev/roundabout
Browse files Browse the repository at this point in the history
Rework on roundabout
  • Loading branch information
afischerdev committed May 8, 2023
2 parents 2c707c9 + 43ea1ef commit 7b04e0b
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public List<VoiceHint> process(List<VoiceHint> inputs) {
float roundAboutTurnAngle = 0.f; // sums up angles in roundabout

int roundaboutExit = 0;
int roundaboudStartIdx = -1;

for (int hintIdx = 0; hintIdx < inputs.size(); hintIdx++) {
VoiceHint input = inputs.get(hintIdx);
Expand All @@ -77,7 +78,8 @@ public List<VoiceHint> process(List<VoiceHint> inputs) {
boolean isLink2Highway = input.oldWay.isLinktType() && !input.goodWay.isLinktType();
boolean isHighway2Link = !input.oldWay.isLinktType() && input.goodWay.isLinktType();

if (input.oldWay.isRoundabout()) {
if (explicitRoundabouts && input.oldWay.isRoundabout()) {
if (roundaboudStartIdx == -1) roundaboudStartIdx = hintIdx;
roundAboutTurnAngle += sumNonConsumedWithinCatchingRange(inputs, hintIdx);
boolean isExit = roundaboutExit == 0; // exit point is always exit
if (input.badWays != null) {
Expand All @@ -94,13 +96,15 @@ public List<VoiceHint> process(List<VoiceHint> inputs) {
}
if (roundaboutExit > 0) {
roundAboutTurnAngle += sumNonConsumedWithinCatchingRange(inputs, hintIdx);
double startTurn = (roundaboudStartIdx != -1 ? inputs.get(roundaboudStartIdx).goodWay.turnangle : turnAngle);
input.angle = roundAboutTurnAngle;
input.distanceToNext = distance;
input.roundaboutExit = turnAngle < 0 ? -roundaboutExit : roundaboutExit;
input.roundaboutExit = startTurn < 0 ? -roundaboutExit : roundaboutExit;
distance = 0.;
results.add(input);
roundAboutTurnAngle = 0.f;
roundaboutExit = 0;
roundaboudStartIdx = -1;
continue;
}
int maxPrioAll = -1; // max prio of all detours
Expand Down

0 comments on commit 7b04e0b

Please sign in to comment.