fix 8299
This commit is contained in:
parent
840bb33b83
commit
de011e1afc
5 changed files with 30 additions and 15 deletions
|
@ -217,6 +217,19 @@ public class Algorithms {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find end index of first number in string if contains letters else return -1
|
||||||
|
*/
|
||||||
|
public static int findFirstNumberEndIndexInString(String value) {
|
||||||
|
for (int i = 0; i < value.length(); i++) {
|
||||||
|
if (i + 1 < value.length() && Character.isLetter(i + 1)) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isDigit(char charAt) {
|
public static boolean isDigit(char charAt) {
|
||||||
return charAt >= '0' && charAt <= '9';
|
return charAt >= '0' && charAt <= '9';
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,9 +169,10 @@ public class TestVoiceActivity extends OsmandActionBarActivity {
|
||||||
addButton(ll, "\u25BA (3.4) After 3100m turn right onto 'SR 80' toward 'Rome'", builder(p).prepareTurn(AbstractPrologCommandPlayer.A_RIGHT, 3100, street(p, "SR 80", "", "Rome")));
|
addButton(ll, "\u25BA (3.4) After 3100m turn right onto 'SR 80' toward 'Rome'", builder(p).prepareTurn(AbstractPrologCommandPlayer.A_RIGHT, 3100, street(p, "SR 80", "", "Rome")));
|
||||||
addButton(ll, "\u25BA (3.5) In 370m turn slightly right onto 'Route 23' 'Main Street', then bear left", builder(p).turn(AbstractPrologCommandPlayer.A_RIGHT_SL, 370, street(p, "Route 23", "Main Street", "")).then().bearLeft(street(p, "")));
|
addButton(ll, "\u25BA (3.5) In 370m turn slightly right onto 'Route 23' 'Main Street', then bear left", builder(p).turn(AbstractPrologCommandPlayer.A_RIGHT_SL, 370, street(p, "Route 23", "Main Street", "")).then().bearLeft(street(p, "")));
|
||||||
addButton(ll, "\u25BA (3.6) Turn sharply right onto 'Dr.-Quinn-Stra"+"\u00df"+"e'", builder(p).turn(AbstractPrologCommandPlayer.A_RIGHT_SH, street(p, "", "Dr.-Quinn-Straße", "")));
|
addButton(ll, "\u25BA (3.6) Turn sharply right onto 'Dr.-Quinn-Stra"+"\u00df"+"e'", builder(p).turn(AbstractPrologCommandPlayer.A_RIGHT_SH, street(p, "", "Dr.-Quinn-Straße", "")));
|
||||||
addButton(ll, "\u25BA (3.7) Turn slightly right to exit 6 onto 'Amsterdam-Osdorp'", builder(p).takeExit(AbstractPrologCommandPlayer.A_RIGHT_SL, "6", street(p, "", "Amsterdam-Osdorp", "")));
|
addButton(ll, "\u25BA (3.7) Turn slightly right to exit 6 onto 'Amsterdam-Osdorp'", builder(p).takeExit(AbstractPrologCommandPlayer.A_RIGHT_SL, "6", -1, street(p, "", "Amsterdam-Osdorp", "")));
|
||||||
addButton(ll, "\u25BA (3.8) In 350m turn slightly right to exit 6 onto 'Amsterdam-Osdorp'", builder(p).takeExit(AbstractPrologCommandPlayer.A_RIGHT_SL, 350, "6", street(p, "", "Amsterdam-Osdorp", "")));
|
addButton(ll, "\u25BA (3.8) In 350m turn slightly right to exit 6 onto 'Amsterdam-Osdorp'", builder(p).takeExit(AbstractPrologCommandPlayer.A_RIGHT_SL, 350, "6", -1, street(p, "", "Amsterdam-Osdorp", "")));
|
||||||
addButton(ll, "\u25BA (3.9) Turn slightly right to exit 260B ", builder(p).takeExit(AbstractPrologCommandPlayer.A_RIGHT_SL, "260 B.", street(p, "", "", "")));
|
addButton(ll, "\u25BA (3.9) Turn slightly right to exit 260B ", builder(p).takeExit(AbstractPrologCommandPlayer.A_RIGHT_SL, "260 B", 3, street(p, "", "", "")));
|
||||||
|
addButton(ll, "\u25BA (3.10) Turn slightly left to exit 15B ", builder(p).takeExit(AbstractPrologCommandPlayer.A_LEFT_SL, "15 B", 2, street(p, "", "", "")));
|
||||||
|
|
||||||
addButton(ll, "Keep left/right: prepareTurn, makeTurnIn, turn:", builder(p));
|
addButton(ll, "Keep left/right: prepareTurn, makeTurnIn, turn:", builder(p));
|
||||||
addButton(ll, "\u25BA (4.1) After 1810m keep left ' '", builder(p).prepareTurn(AbstractPrologCommandPlayer.A_LEFT_KEEP, 1810, street(p, "")));
|
addButton(ll, "\u25BA (4.1) After 1810m keep left ' '", builder(p).prepareTurn(AbstractPrologCommandPlayer.A_LEFT_KEEP, 1810, street(p, "")));
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.routing;
|
||||||
|
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.media.SoundPool;
|
import android.media.SoundPool;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.binary.RouteDataObject;
|
import net.osmand.binary.RouteDataObject;
|
||||||
|
@ -718,8 +719,6 @@ public class VoiceRouter {
|
||||||
sb.append(exit.charAt(i));
|
sb.append(exit.charAt(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// For pronounce letter like in transcription
|
|
||||||
sb.append(".");
|
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
@ -732,7 +731,8 @@ public class VoiceRouter {
|
||||||
ExitInfo exitInfo = next.getExitInfo();
|
ExitInfo exitInfo = next.getExitInfo();
|
||||||
if (tParam != null) {
|
if (tParam != null) {
|
||||||
if (exitInfo != null && !Algorithms.isEmpty(exitInfo.getRef())) {
|
if (exitInfo != null && !Algorithms.isEmpty(exitInfo.getRef())) {
|
||||||
p.takeExit(tParam, dist, getSpeakableExitRef(exitInfo.getRef()), getSpeakableExitName(next, exitInfo, true));
|
String speakableExitRef = getSpeakableExitRef(exitInfo.getRef());
|
||||||
|
p.takeExit(tParam, dist, speakableExitRef, Algorithms.findFirstNumberEndIndexInString(speakableExitRef), getSpeakableExitName(next, exitInfo, true));
|
||||||
} else {
|
} else {
|
||||||
p.turn(tParam, dist, getSpeakableStreetName(currentSegment, next, true));
|
p.turn(tParam, dist, getSpeakableStreetName(currentSegment, next, true));
|
||||||
}
|
}
|
||||||
|
@ -805,7 +805,8 @@ public class VoiceRouter {
|
||||||
boolean isplay = true;
|
boolean isplay = true;
|
||||||
if (tParam != null) {
|
if (tParam != null) {
|
||||||
if (exitInfo != null && !Algorithms.isEmpty(exitInfo.getRef())) {
|
if (exitInfo != null && !Algorithms.isEmpty(exitInfo.getRef())) {
|
||||||
p.takeExit(tParam, getSpeakableExitRef(exitInfo.getRef()), getSpeakableExitName(next, exitInfo, !suppressDest));
|
String speakableExitRef = getSpeakableExitRef(exitInfo.getRef());
|
||||||
|
p.takeExit(tParam, speakableExitRef, Algorithms.findFirstNumberEndIndexInString(speakableExitRef), getSpeakableExitName(next, exitInfo, !suppressDest));
|
||||||
} else {
|
} else {
|
||||||
p.turn(tParam, getSpeakableStreetName(currentSegment, next, !suppressDest));
|
p.turn(tParam, getSpeakableStreetName(currentSegment, next, !suppressDest));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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, String exit, StreetName streetName) {
|
public CommandBuilder takeExit(String turnType, String exit, int firstNumEndIndex, StreetName streetName) {
|
||||||
return alt(prepareStruct(C_TAKE_EXIT, turnType, exit, streetName), prepareStruct(C_TAKE_EXIT, turnType, exit));
|
return alt(prepareStruct(C_TAKE_EXIT, turnType, exit, firstNumEndIndex, streetName), prepareStruct(C_TAKE_EXIT, turnType, exit, firstNumEndIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandBuilder takeExit(String turnType, double dist, String exit, StreetName streetName) {
|
public CommandBuilder takeExit(String turnType, double dist, String exit,int firstNumEndIndex, StreetName streetName) {
|
||||||
return alt(prepareStruct(C_TAKE_EXIT, turnType, dist, exit, streetName), prepareStruct(C_TAKE_EXIT, turnType, dist, exit));
|
return alt(prepareStruct(C_TAKE_EXIT, turnType, dist, exit, firstNumEndIndex, streetName), prepareStruct(C_TAKE_EXIT, turnType, dist, exit, firstNumEndIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -119,13 +119,13 @@ 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, String exit, StreetName streetName) {
|
public JSCommandBuilder takeExit(String turnType, String exit, int firstNumEndIndex, StreetName streetName) {
|
||||||
return takeExit(turnType, -1, exit, streetName);
|
return takeExit(turnType, -1, exit, firstNumEndIndex, streetName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSCommandBuilder takeExit(String turnType, double dist, String exit, StreetName streetName) {
|
public JSCommandBuilder takeExit(String turnType, double dist, String exit, int firstNumEndIndex, StreetName streetName) {
|
||||||
return isJSCommandExists(C_TAKE_EXIT) ?
|
return isJSCommandExists(C_TAKE_EXIT) ?
|
||||||
addCommand(C_TAKE_EXIT, turnType, dist, exit, convertStreetName(streetName)) :
|
addCommand(C_TAKE_EXIT, turnType, dist, exit, firstNumEndIndex, convertStreetName(streetName)) :
|
||||||
addCommand(C_TURN, turnType, dist, convertStreetName(streetName));
|
addCommand(C_TURN, turnType, dist, convertStreetName(streetName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue