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 EL = 17; // exit left
|
||||||
static final int ER = 18; // exit right
|
static final int ER = 18; // exit right
|
||||||
|
|
||||||
|
static final int END = 100; // end point
|
||||||
|
|
||||||
int ilon;
|
int ilon;
|
||||||
int ilat;
|
int ilat;
|
||||||
short selev;
|
short selev;
|
||||||
@ -155,6 +157,8 @@ public class VoiceHint {
|
|||||||
return timode == 2 || timode == 9 ? "ER" : "KR";
|
return timode == 2 || timode == 9 ? "ER" : "KR";
|
||||||
case OFFR:
|
case OFFR:
|
||||||
return "OFFR";
|
return "OFFR";
|
||||||
|
case END:
|
||||||
|
return "END";
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("unknown command: " + cmd);
|
throw new IllegalArgumentException("unknown command: " + cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,6 +72,12 @@ public final class VoiceHintProcessor {
|
|||||||
results.add(input);
|
results.add(input);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (hintIdx == 0) {
|
||||||
|
input.cmd = VoiceHint.END;
|
||||||
|
results.add(input);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
float turnAngle = input.goodWay.turnangle;
|
float turnAngle = input.goodWay.turnangle;
|
||||||
distance += input.goodWay.linkdist;
|
distance += input.goodWay.linkdist;
|
||||||
int currentPrio = input.goodWay.getPrio();
|
int currentPrio = input.goodWay.getPrio();
|
||||||
@ -119,7 +125,7 @@ public final class VoiceHintProcessor {
|
|||||||
float tmpangle = 0;
|
float tmpangle = 0;
|
||||||
VoiceHint tmpRndAbt = new VoiceHint();
|
VoiceHint tmpRndAbt = new VoiceHint();
|
||||||
tmpRndAbt.badWays = new ArrayList<>();
|
tmpRndAbt.badWays = new ArrayList<>();
|
||||||
for (int i = hintIdx-1; i > roundaboudStartIdx; i--) {
|
for (int i = hintIdx - 1; i > roundaboudStartIdx; i--) {
|
||||||
VoiceHint vh = inputs.get(i);
|
VoiceHint vh = inputs.get(i);
|
||||||
tmpangle += inputs.get(i).goodWay.turnangle;
|
tmpangle += inputs.get(i).goodWay.turnangle;
|
||||||
if (vh.badWays != null) {
|
if (vh.badWays != null) {
|
||||||
@ -172,12 +178,14 @@ public final class VoiceHintProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (badWay.isBadOneway()) {
|
if (badWay.isBadOneway()) {
|
||||||
if (minAbsAngeRaw == 180f) minAbsAngeRaw = turnAngle; // disable hasSomethingMoreStraight
|
if (minAbsAngeRaw == 180f)
|
||||||
|
minAbsAngeRaw = turnAngle; // disable hasSomethingMoreStraight
|
||||||
continue; // ignore wrong oneways
|
continue; // ignore wrong oneways
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Math.abs(badTurn) - Math.abs(turnAngle) > 80.f) {
|
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
|
continue; // ways from the back should not trigger a slight turn
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,7 +308,9 @@ public final class VoiceHintProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nextInput == null) {
|
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.KR ||
|
||||||
input.cmd == VoiceHint.KL)
|
input.cmd == VoiceHint.KL)
|
||||||
&& !input.goodWay.isLinktType()) {
|
&& !input.goodWay.isLinktType()) {
|
||||||
@ -335,8 +345,8 @@ public final class VoiceHintProcessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ((input.goodWay.getPrio() == 29 && input.maxBadPrio == 30) &&
|
} else if ((input.goodWay.getPrio() == 29 && input.maxBadPrio == 30) &&
|
||||||
((hintIdx + 1 < inputs.size() && inputs.get(hintIdx+1).goodWay.getPrio() < 29) ||
|
checkForNextNoneMotorway(inputs, hintIdx, 3)
|
||||||
(hintIdx + 2 < inputs.size() && inputs.get(hintIdx+2).goodWay.getPrio() < 29))) {
|
) {
|
||||||
// leave motorway
|
// leave motorway
|
||||||
if (input.cmd == VoiceHint.KR || input.cmd == VoiceHint.TSLR) {
|
if (input.cmd == VoiceHint.KR || input.cmd == VoiceHint.TSLR) {
|
||||||
input.cmd = VoiceHint.ER;
|
input.cmd = VoiceHint.ER;
|
||||||
@ -448,5 +458,14 @@ public final class VoiceHintProcessor {
|
|||||||
return results;
|
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