first stab at #2377

This commit is contained in:
sonora 2016-04-13 09:17:19 +02:00
parent c499d701d5
commit a2aac29e0e

View file

@ -429,7 +429,7 @@ public class VoiceRouter {
if (dist == 0) { if (dist == 0) {
return; return;
} else if (needsInforming()) { } else if (needsInforming()) {
playGoAhead(dist, getSpeakableStreetName(currentSegment, next)); playGoAhead(dist, getSpeakableStreetName(currentSegment, next, false));
return; return;
} else if (currentStatus == STATUS_TOLD) { } else if (currentStatus == STATUS_TOLD) {
// nothing said possibly that's wrong case we should say before that // nothing said possibly that's wrong case we should say before that
@ -490,7 +490,7 @@ public class VoiceRouter {
nextStatusAfter(STATUS_UNKNOWN); nextStatusAfter(STATUS_UNKNOWN);
} else if (repeat || (statusNotPassed(STATUS_PREPARE) && dist < playGoAheadDist)) { } else if (repeat || (statusNotPassed(STATUS_PREPARE) && dist < playGoAheadDist)) {
playGoAheadDist = 0; playGoAheadDist = 0;
playGoAhead(dist, getSpeakableStreetName(currentSegment, next)); playGoAhead(dist, getSpeakableStreetName(currentSegment, next, false));
} }
} }
@ -499,7 +499,7 @@ public class VoiceRouter {
RouteDirectionInfo next = nextInfo.directionInfo; RouteDirectionInfo next = nextInfo.directionInfo;
if(isTargetPoint(nextInfo) && (!playedAndArriveAtTarget || repeat)) { if(isTargetPoint(nextInfo) && (!playedAndArriveAtTarget || repeat)) {
if(next.getTurnType().goAhead()) { if(next.getTurnType().goAhead()) {
playGoAhead(nextInfo.distanceTo, getSpeakableStreetName(currentSegment, next)); playGoAhead(nextInfo.distanceTo, getSpeakableStreetName(currentSegment, next, true));
andSpeakArriveAtPoint(nextInfo); andSpeakArriveAtPoint(nextInfo);
playedAndArriveAtTarget = true; playedAndArriveAtTarget = true;
} else if(nextInfo.distanceTo <= 2 * TURN_IN_DISTANCE) { } else if(nextInfo.distanceTo <= 2 * TURN_IN_DISTANCE) {
@ -538,21 +538,35 @@ public class VoiceRouter {
} }
} }
public Term getSpeakableStreetName(RouteSegmentResult currentSegment, RouteDirectionInfo i) { public Term getSpeakableStreetName(RouteSegmentResult currentSegment, RouteDirectionInfo i, boolean fullDest) {
if(i == null || !router.getSettings().SPEAK_STREET_NAMES.get()){ if(i == null || !router.getSettings().SPEAK_STREET_NAMES.get()){
return empty; return empty;
} }
if (player != null && player.supportsStructuredStreetNames()) { if (player != null && player.supportsStructuredStreetNames()) {
Struct next = new Struct(new Term[] { getTermString(getSpeakablePointName(i.getRef())), if (fullDest == true) {
getTermString(getSpeakablePointName(i.getStreetName())), Struct next = new Struct(new Term[] { getTermString(getSpeakablePointName(i.getRef())),
getTermString(getSpeakablePointName(i.getDestinationName())) }); getTermString(getSpeakablePointName(i.getStreetName())),
getTermString(getSpeakablePointName(i.getDestinationName())) });
} else {
//Issue 2377: Using Dest in last turn prompt causes too much talking, so either delete or shorten Dest here
Struct next = new Struct(new Term[] { getTermString(getSpeakablePointName(i.getRef())),
getTermString(getSpeakablePointName(i.getStreetName())),
empty });
}
Term current = empty; Term current = empty;
if (currentSegment != null) { if (currentSegment != null) {
if (fullDest == true) {
RouteDataObject obj = currentSegment.getObject(); RouteDataObject obj = currentSegment.getObject();
current = new Struct(new Term[] { getTermString(getSpeakablePointName(obj.getRef())), current = new Struct(new Term[] { getTermString(getSpeakablePointName(obj.getRef())),
getTermString(getSpeakablePointName(obj.getName(settings.MAP_PREFERRED_LOCALE.get()))), getTermString(getSpeakablePointName(obj.getName(settings.MAP_PREFERRED_LOCALE.get()))),
getTermString(getSpeakablePointName(obj.getDestinationName(settings.MAP_PREFERRED_LOCALE.get()))) }); getTermString(getSpeakablePointName(obj.getDestinationName(settings.MAP_PREFERRED_LOCALE.get()))) });
} else {
//Issue 2377: Using Dest in last turn prompt causes too much talking, so either delete or shorten Dest here
RouteDataObject obj = currentSegment.getObject();
current = new Struct(new Term[] { getTermString(getSpeakablePointName(obj.getRef())),
getTermString(getSpeakablePointName(obj.getName(settings.MAP_PREFERRED_LOCALE.get()))),
empty });
}
} }
Struct voice = new Struct("voice", next, current ); Struct voice = new Struct("voice", next, current );
return voice; return voice;
@ -594,13 +608,13 @@ public class VoiceRouter {
String tParam = getTurnType(next.getTurnType()); String tParam = getTurnType(next.getTurnType());
if(tParam != null){ if(tParam != null){
notifyOnVoiceMessage(); notifyOnVoiceMessage();
play.prepareTurn(tParam, dist, getSpeakableStreetName(currentSegment, next)).play(); play.prepareTurn(tParam, dist, getSpeakableStreetName(currentSegment, next, true)).play();
} else if(next.getTurnType().isRoundAbout()){ } else if(next.getTurnType().isRoundAbout()){
notifyOnVoiceMessage(); notifyOnVoiceMessage();
play.prepareRoundAbout(dist, next.getTurnType().getExitOut(), getSpeakableStreetName(currentSegment, next)).play(); play.prepareRoundAbout(dist, next.getTurnType().getExitOut(), getSpeakableStreetName(currentSegment, next, true)).play();
} else if(next.getTurnType().getValue() == TurnType.TU || next.getTurnType().getValue() == TurnType.TRU){ } else if(next.getTurnType().getValue() == TurnType.TU || next.getTurnType().getValue() == TurnType.TRU){
notifyOnVoiceMessage(); notifyOnVoiceMessage();
play.prepareMakeUT(dist, getSpeakableStreetName(currentSegment, next)).play(); play.prepareMakeUT(dist, getSpeakableStreetName(currentSegment, next, true)).play();
} }
} }
} }
@ -611,11 +625,11 @@ public class VoiceRouter {
String tParam = getTurnType(next.getTurnType()); String tParam = getTurnType(next.getTurnType());
boolean isPlay = true; boolean isPlay = true;
if (tParam != null) { if (tParam != null) {
play.turn(tParam, dist, getSpeakableStreetName(currentSegment, next)); play.turn(tParam, dist, getSpeakableStreetName(currentSegment, next, true));
} else if (next.getTurnType().isRoundAbout()) { } else if (next.getTurnType().isRoundAbout()) {
play.roundAbout(dist, next.getTurnType().getTurnAngle(), next.getTurnType().getExitOut(), getSpeakableStreetName(currentSegment, next)); play.roundAbout(dist, next.getTurnType().getTurnAngle(), next.getTurnType().getExitOut(), getSpeakableStreetName(currentSegment, next, true));
} else if (next.getTurnType().getValue() == TurnType.TU || next.getTurnType().getValue() == TurnType.TRU) { } else if (next.getTurnType().getValue() == TurnType.TU || next.getTurnType().getValue() == TurnType.TRU) {
play.makeUT(dist, getSpeakableStreetName(currentSegment, next)); play.makeUT(dist, getSpeakableStreetName(currentSegment, next, true));
} else { } else {
isPlay = false; isPlay = false;
} }
@ -625,14 +639,14 @@ public class VoiceRouter {
isPlay = true; isPlay = true;
if (next.getTurnType().getValue() == TurnType.C && if (next.getTurnType().getValue() == TurnType.C &&
TurnType.C != t.getValue()) { TurnType.C != t.getValue()) {
play.goAhead(dist, getSpeakableStreetName(currentSegment, next)); play.goAhead(dist, getSpeakableStreetName(currentSegment, next, false));
} }
if (TurnType.TL == t.getValue() || TurnType.TSHL == t.getValue() || TurnType.TSLL == t.getValue() if (TurnType.TL == t.getValue() || TurnType.TSHL == t.getValue() || TurnType.TSLL == t.getValue()
|| TurnType.TU == t.getValue() || TurnType.KL == t.getValue()) { || TurnType.TU == t.getValue() || TurnType.KL == t.getValue()) {
play.then().bearLeft( getSpeakableStreetName(currentSegment, next)); play.then().bearLeft( getSpeakableStreetName(currentSegment, next, false));
} else if (TurnType.TR == t.getValue() || TurnType.TSHR == t.getValue() || TurnType.TSLR == t.getValue() } else if (TurnType.TR == t.getValue() || TurnType.TSHR == t.getValue() || TurnType.TSLR == t.getValue()
|| TurnType.KR == t.getValue()) { || TurnType.KR == t.getValue()) {
play.then().bearRight( getSpeakableStreetName(currentSegment, next)); play.then().bearRight( getSpeakableStreetName(currentSegment, next, false));
} }
} }
if(isPlay){ if(isPlay){
@ -663,11 +677,11 @@ public class VoiceRouter {
String tParam = getTurnType(next.getTurnType()); String tParam = getTurnType(next.getTurnType());
boolean isplay = true; boolean isplay = true;
if(tParam != null){ if(tParam != null){
play.turn(tParam, getSpeakableStreetName(currentSegment, next)); play.turn(tParam, getSpeakableStreetName(currentSegment, next, false));
} else if(next.getTurnType().isRoundAbout()){ } else if(next.getTurnType().isRoundAbout()){
play.roundAbout(next.getTurnType().getTurnAngle(), next.getTurnType().getExitOut(), getSpeakableStreetName(currentSegment, next)); play.roundAbout(next.getTurnType().getTurnAngle(), next.getTurnType().getExitOut(), getSpeakableStreetName(currentSegment, next, false));
} else if(next.getTurnType().getValue() == TurnType.TU || next.getTurnType().getValue() == TurnType.TRU){ } else if(next.getTurnType().getValue() == TurnType.TU || next.getTurnType().getValue() == TurnType.TRU){
play.makeUT( getSpeakableStreetName(currentSegment, next)); play.makeUT( getSpeakableStreetName(currentSegment, next, false));
// do not say it // do not say it
// } else if(next.getTurnType().getValue() == TurnType.C)){ // } else if(next.getTurnType().getValue() == TurnType.C)){
// play.goAhead(); // play.goAhead();