added motorway exit check on short distance
This commit is contained in:
parent
0056a9d008
commit
5f86e2f2cd
@ -29,6 +29,8 @@ public class VoiceHint {
|
||||
static final int EL = 17; // exit left
|
||||
static final int ER = 18; // exit right
|
||||
|
||||
static final int END = 100; // end point
|
||||
|
||||
int ilon;
|
||||
int ilat;
|
||||
short selev;
|
||||
@ -155,6 +157,8 @@ public class VoiceHint {
|
||||
return timode == 2 || timode == 9 ? "ER" : "KR";
|
||||
case OFFR:
|
||||
return "OFFR";
|
||||
case END:
|
||||
return "END";
|
||||
default:
|
||||
throw new IllegalArgumentException("unknown command: " + cmd);
|
||||
}
|
||||
|
||||
@ -72,6 +72,12 @@ public final class VoiceHintProcessor {
|
||||
results.add(input);
|
||||
continue;
|
||||
}
|
||||
if (hintIdx == 0) {
|
||||
input.cmd = VoiceHint.END;
|
||||
results.add(input);
|
||||
continue;
|
||||
}
|
||||
|
||||
float turnAngle = input.goodWay.turnangle;
|
||||
distance += input.goodWay.linkdist;
|
||||
int currentPrio = input.goodWay.getPrio();
|
||||
@ -172,12 +178,14 @@ public final class VoiceHintProcessor {
|
||||
}
|
||||
|
||||
if (badWay.isBadOneway()) {
|
||||
if (minAbsAngeRaw == 180f) minAbsAngeRaw = turnAngle; // disable hasSomethingMoreStraight
|
||||
if (minAbsAngeRaw == 180f)
|
||||
minAbsAngeRaw = turnAngle; // disable hasSomethingMoreStraight
|
||||
continue; // ignore wrong oneways
|
||||
}
|
||||
|
||||
if (Math.abs(badTurn) - Math.abs(turnAngle) > 80.f) {
|
||||
if (minAbsAngeRaw == 180f) minAbsAngeRaw = turnAngle; // disable hasSomethingMoreStraight
|
||||
if (minAbsAngeRaw == 180f)
|
||||
minAbsAngeRaw = turnAngle; // disable hasSomethingMoreStraight
|
||||
continue; // ways from the back should not trigger a slight turn
|
||||
}
|
||||
|
||||
@ -300,7 +308,9 @@ public final class VoiceHintProcessor {
|
||||
}
|
||||
|
||||
if (nextInput == null) {
|
||||
if ((input.cmd == VoiceHint.C ||
|
||||
if (input.cmd == VoiceHint.END) {
|
||||
continue;
|
||||
} else if ((input.cmd == VoiceHint.C ||
|
||||
input.cmd == VoiceHint.KR ||
|
||||
input.cmd == VoiceHint.KL)
|
||||
&& !input.goodWay.isLinktType()) {
|
||||
@ -335,8 +345,8 @@ public final class VoiceHintProcessor {
|
||||
}
|
||||
}
|
||||
} else if ((input.goodWay.getPrio() == 29 && input.maxBadPrio == 30) &&
|
||||
((hintIdx + 1 < inputs.size() && inputs.get(hintIdx+1).goodWay.getPrio() < 29) ||
|
||||
(hintIdx + 2 < inputs.size() && inputs.get(hintIdx+2).goodWay.getPrio() < 29))) {
|
||||
checkForNextNoneMotorway(inputs, hintIdx, 3)
|
||||
) {
|
||||
// leave motorway
|
||||
if (input.cmd == VoiceHint.KR || input.cmd == VoiceHint.TSLR) {
|
||||
input.cmd = VoiceHint.ER;
|
||||
@ -448,5 +458,14 @@ public final class VoiceHintProcessor {
|
||||
return results;
|
||||
}
|
||||
|
||||
boolean checkForNextNoneMotorway(List<VoiceHint> inputs, int offset, int testsize) {
|
||||
for (int i = 1; i < testsize + 1 && offset + i < inputs.size(); i++) {
|
||||
int prio = inputs.get(offset + i).goodWay.getPrio();
|
||||
if (prio < 29) return true;
|
||||
if (prio == 30) return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user