Merge pull request #8240 from osmandapp/exit_and_shield_widget

Exit and shield widget
This commit is contained in:
max-klaus 2020-01-16 11:33:44 +03:00 committed by GitHub
commit 87789c612d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 20 deletions

View file

@ -709,12 +709,11 @@ public class VoiceRouter {
boolean isPlay = true; boolean isPlay = true;
ExitInfo exitInfo = next.getExitInfo(); ExitInfo exitInfo = next.getExitInfo();
if (tParam != null) { if (tParam != null) {
p.turn(tParam, dist, getSpeakableStreetName(currentSegment, next, true)); if (exitInfo != null) {
// if (exitInfo != null) { p.takeExit(tParam, dist, Integer.parseInt(exitInfo.getRef()), getSpeakableExitName(next, exitInfo, true));
// p.takeExit(tParam, dist, getSpeakableExitName(next, exitInfo, true)); } else {
// } else { p.turn(tParam, dist, getSpeakableStreetName(currentSegment, next, true));
// p.turn(tParam, dist, getSpeakableStreetName(currentSegment, next, true)); }
// }
suppressDest = true; suppressDest = true;
} else if (next.getTurnType().isRoundAbout()) { } else if (next.getTurnType().isRoundAbout()) {
p.roundAbout(dist, next.getTurnType().getTurnAngle(), next.getTurnType().getExitOut(), getSpeakableStreetName(currentSegment, next, true)); p.roundAbout(dist, next.getTurnType().getTurnAngle(), next.getTurnType().getExitOut(), getSpeakableStreetName(currentSegment, next, true));
@ -783,12 +782,11 @@ public class VoiceRouter {
ExitInfo exitInfo = next.getExitInfo(); ExitInfo exitInfo = next.getExitInfo();
boolean isplay = true; boolean isplay = true;
if (tParam != null) { if (tParam != null) {
p.turn(tParam, getSpeakableStreetName(currentSegment, next, !suppressDest)); if (exitInfo != null) {
// if (exitInfo != null) { p.takeExit(tParam, Integer.parseInt(exitInfo.getRef()), getSpeakableExitName(next, exitInfo, !suppressDest));
// p.takeExit(tParam, getSpeakableExitName(next, exitInfo, !suppressDest)); } else {
// } else { p.turn(tParam, getSpeakableStreetName(currentSegment, next, !suppressDest));
// p.turn(tParam, getSpeakableStreetName(currentSegment, next, !suppressDest)); }
// }
} else if (next.getTurnType().isRoundAbout()) { } else if (next.getTurnType().isRoundAbout()) {
p.roundAbout(next.getTurnType().getTurnAngle(), next.getTurnType().getExitOut(), getSpeakableStreetName(currentSegment, next, !suppressDest)); p.roundAbout(next.getTurnType().getTurnAngle(), next.getTurnType().getExitOut(), getSpeakableStreetName(currentSegment, next, !suppressDest));
} else if (next.getTurnType().getValue() == TurnType.TU || next.getTurnType().getValue() == TurnType.TRU) { } else if (next.getTurnType().getValue() == TurnType.TU || next.getTurnType().getValue() == TurnType.TRU) {

View file

@ -179,12 +179,12 @@ public class CommandBuilder {
return alt(prepareStruct(C_TURN, param, dist, streetName), prepareStruct(C_TURN, param, dist)); return alt(prepareStruct(C_TURN, param, dist, streetName), prepareStruct(C_TURN, param, dist));
} }
public CommandBuilder takeExit(String turnType, StreetName streetName) { public CommandBuilder takeExit(String turnType, int exit, StreetName streetName) {
return alt(prepareStruct(C_TAKE_EXIT, turnType, streetName), prepareStruct(C_TAKE_EXIT, turnType)); return alt(prepareStruct(C_TAKE_EXIT, turnType, exit, streetName), prepareStruct(C_TAKE_EXIT, turnType, exit));
} }
public CommandBuilder takeExit(String turnType, double dist, StreetName streetName) { public CommandBuilder takeExit(String turnType, double dist, int exit, StreetName streetName) {
return alt(prepareStruct(C_TAKE_EXIT, turnType, dist, streetName), prepareStruct(C_TAKE_EXIT, turnType, dist)); return alt(prepareStruct(C_TAKE_EXIT, turnType, dist, exit, streetName), prepareStruct(C_TAKE_EXIT, turnType, dist, exit));
} }
/** /**

View file

@ -65,6 +65,10 @@ public class JSCommandBuilder extends CommandBuilder {
return this; return this;
} }
private boolean isJSCommandExists(String name) {
return jsScope.get(name) instanceof Function;
}
public JSCommandBuilder goAhead(){ public JSCommandBuilder goAhead(){
return goAhead(-1, new StreetName()); return goAhead(-1, new StreetName());
} }
@ -115,12 +119,14 @@ public class JSCommandBuilder extends CommandBuilder {
return addCommand(C_TURN, param, dist, convertStreetName(streetName)); return addCommand(C_TURN, param, dist, convertStreetName(streetName));
} }
public JSCommandBuilder takeExit(String turnType, StreetName streetName) { public JSCommandBuilder takeExit(String turnType, int exit, StreetName streetName) {
return takeExit(turnType, -1, streetName); return takeExit(turnType, -1, exit, streetName);
} }
public JSCommandBuilder takeExit(String turnType, double dist, StreetName streetName) { public JSCommandBuilder takeExit(String turnType, double dist, int exit, StreetName streetName) {
return addCommand(C_TAKE_EXIT, turnType, dist, convertStreetName(streetName)); return isJSCommandExists(C_TAKE_EXIT) ?
addCommand(C_TAKE_EXIT, turnType, dist, exit, convertStreetName(streetName)) :
addCommand(C_TURN, turnType, dist, convertStreetName(streetName));
} }
/** /**