voice commands on exits

This commit is contained in:
veliymolfar 2020-01-15 18:41:52 +02:00
parent 6c93dc4878
commit b2508cb189
3 changed files with 24 additions and 20 deletions

View file

@ -709,12 +709,11 @@ public class VoiceRouter {
boolean isPlay = true;
ExitInfo exitInfo = next.getExitInfo();
if (tParam != null) {
p.turn(tParam, dist, getSpeakableStreetName(currentSegment, next, true));
// if (exitInfo != null) {
// p.takeExit(tParam, dist, getSpeakableExitName(next, exitInfo, true));
// } else {
// p.turn(tParam, dist, getSpeakableStreetName(currentSegment, next, true));
// }
if (exitInfo != null) {
p.takeExit(tParam, dist, Integer.parseInt(exitInfo.getRef()), getSpeakableExitName(next, exitInfo, true));
} else {
p.turn(tParam, dist, getSpeakableStreetName(currentSegment, next, true));
}
suppressDest = true;
} else if (next.getTurnType().isRoundAbout()) {
p.roundAbout(dist, next.getTurnType().getTurnAngle(), next.getTurnType().getExitOut(), getSpeakableStreetName(currentSegment, next, true));
@ -783,12 +782,11 @@ public class VoiceRouter {
ExitInfo exitInfo = next.getExitInfo();
boolean isplay = true;
if (tParam != null) {
p.turn(tParam, getSpeakableStreetName(currentSegment, next, !suppressDest));
// if (exitInfo != null) {
// p.takeExit(tParam, getSpeakableExitName(next, exitInfo, !suppressDest));
// } else {
// p.turn(tParam, getSpeakableStreetName(currentSegment, next, !suppressDest));
// }
if (exitInfo != null) {
p.takeExit(tParam, Integer.parseInt(exitInfo.getRef()), getSpeakableExitName(next, exitInfo, !suppressDest));
} else {
p.turn(tParam, getSpeakableStreetName(currentSegment, next, !suppressDest));
}
} else if (next.getTurnType().isRoundAbout()) {
p.roundAbout(next.getTurnType().getTurnAngle(), next.getTurnType().getExitOut(), getSpeakableStreetName(currentSegment, next, !suppressDest));
} 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));
}
public CommandBuilder takeExit(String turnType, StreetName streetName) {
return alt(prepareStruct(C_TAKE_EXIT, turnType, streetName), prepareStruct(C_TAKE_EXIT, turnType));
public CommandBuilder takeExit(String turnType, int exit, StreetName streetName) {
return alt(prepareStruct(C_TAKE_EXIT, turnType, exit, streetName), prepareStruct(C_TAKE_EXIT, turnType,exit));
}
public CommandBuilder takeExit(String turnType, double dist, StreetName streetName) {
return alt(prepareStruct(C_TAKE_EXIT, turnType, dist, streetName), prepareStruct(C_TAKE_EXIT, turnType, dist));
public CommandBuilder takeExit(String turnType, double dist, int exit, StreetName streetName) {
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;
}
private boolean isCommandExist(String name) {
return jsScope.get(name) instanceof Function;
}
public JSCommandBuilder goAhead(){
return goAhead(-1, new StreetName());
}
@ -115,12 +119,14 @@ public class JSCommandBuilder extends CommandBuilder {
return addCommand(C_TURN, param, dist, convertStreetName(streetName));
}
public JSCommandBuilder takeExit(String turnType, StreetName streetName) {
return takeExit(turnType, -1, streetName);
public JSCommandBuilder takeExit(String turnType, int exit, StreetName streetName) {
return takeExit(turnType, -1, exit, streetName);
}
public JSCommandBuilder takeExit(String turnType, double dist, StreetName streetName) {
return addCommand(C_TAKE_EXIT, turnType, dist, convertStreetName(streetName));
public JSCommandBuilder takeExit(String turnType, double dist, int exit, StreetName streetName) {
return isCommandExist(C_TAKE_EXIT) ?
addCommand(C_TAKE_EXIT, turnType, dist, exit, convertStreetName(streetName)) :
addCommand(C_TURN, turnType, dist, convertStreetName(streetName));
}
/**