repair vh END problems
This commit is contained in:
parent
60b7cf658d
commit
b9b0e21cb6
@ -469,6 +469,17 @@ public final class OsmTrack {
|
|||||||
List<VoiceHint> inputs = new ArrayList<>();
|
List<VoiceHint> inputs = new ArrayList<>();
|
||||||
while (node != null) {
|
while (node != null) {
|
||||||
if (node.origin != null) {
|
if (node.origin != null) {
|
||||||
|
if (nodeNr == nodes.size() - 1) {
|
||||||
|
VoiceHint input = new VoiceHint();
|
||||||
|
inputs.add(0, input);
|
||||||
|
input.ilat = node.getILat();
|
||||||
|
input.ilon = node.getILon();
|
||||||
|
input.selev = node.getSElev();
|
||||||
|
input.goodWay = node.message;
|
||||||
|
input.oldWay = node.message;
|
||||||
|
input.indexInTrack = nodes.size() - 1;
|
||||||
|
input.cmd = VoiceHint.END;
|
||||||
|
}
|
||||||
VoiceHint input = new VoiceHint();
|
VoiceHint input = new VoiceHint();
|
||||||
inputs.add(input);
|
inputs.add(input);
|
||||||
input.ilat = node.origin.getILat();
|
input.ilat = node.origin.getILat();
|
||||||
|
|||||||
@ -29,7 +29,7 @@ public final class VoiceHintProcessor {
|
|||||||
float angle = 0.f;
|
float angle = 0.f;
|
||||||
while (offset >= 0 && distance < range) {
|
while (offset >= 0 && distance < range) {
|
||||||
VoiceHint input = inputs.get(offset--);
|
VoiceHint input = inputs.get(offset--);
|
||||||
if (input.turnAngleConsumed) {
|
if (input.turnAngleConsumed || input.cmd == VoiceHint.BL || input.cmd == VoiceHint.END) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
angle += input.goodWay.turnangle;
|
angle += input.goodWay.turnangle;
|
||||||
@ -72,15 +72,10 @@ public final class VoiceHintProcessor {
|
|||||||
results.add(input);
|
results.add(input);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (hintIdx == 0) {
|
|
||||||
input.cmd = VoiceHint.END;
|
|
||||||
input.distanceToNext = input.goodWay.linkdist;
|
|
||||||
results.add(input);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
float turnAngle = input.goodWay.turnangle;
|
float turnAngle = input.goodWay.turnangle;
|
||||||
distance += input.goodWay.linkdist;
|
if (hintIdx != 0) distance += input.goodWay.linkdist;
|
||||||
|
// System.out.println("range " + distance);
|
||||||
int currentPrio = input.goodWay.getPrio();
|
int currentPrio = input.goodWay.getPrio();
|
||||||
int oldPrio = input.oldWay.getPrio();
|
int oldPrio = input.oldWay.getPrio();
|
||||||
int minPrio = Math.min(oldPrio, currentPrio);
|
int minPrio = Math.min(oldPrio, currentPrio);
|
||||||
@ -260,6 +255,10 @@ public final class VoiceHintProcessor {
|
|||||||
if (hint.cmd == 0) {
|
if (hint.cmd == 0) {
|
||||||
hint.calcCommand();
|
hint.calcCommand();
|
||||||
}
|
}
|
||||||
|
if (hint.cmd == VoiceHint.END) {
|
||||||
|
results2.add(hint);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!(hint.needsRealTurn && (hint.cmd == VoiceHint.C || hint.cmd == VoiceHint.BL))) {
|
if (!(hint.needsRealTurn && (hint.cmd == VoiceHint.C || hint.cmd == VoiceHint.BL))) {
|
||||||
double dist = hint.distanceToNext;
|
double dist = hint.distanceToNext;
|
||||||
// sum up other hints within the catching range (e.g. 40m)
|
// sum up other hints within the catching range (e.g. 40m)
|
||||||
@ -455,6 +454,10 @@ public final class VoiceHintProcessor {
|
|||||||
}
|
}
|
||||||
inputLast = input;
|
inputLast = input;
|
||||||
}
|
}
|
||||||
|
if (results.size() > 0) {
|
||||||
|
// don't use END tag
|
||||||
|
if (results.get(results.size()-1).cmd == VoiceHint.END) results.remove(results.size()-1);
|
||||||
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user