added vh for motorway exit
This commit is contained in:
parent
f2cba63c8a
commit
b76cb40daf
@ -49,7 +49,7 @@ public class FormatGpx extends Formatter {
|
|||||||
sb.append("<!-- cmd idx lon lat d2next geometry -->\n");
|
sb.append("<!-- cmd idx lon lat d2next geometry -->\n");
|
||||||
sb.append("<!-- $turn-instruction-start$\n");
|
sb.append("<!-- $turn-instruction-start$\n");
|
||||||
for (VoiceHint hint : t.voiceHints.list) {
|
for (VoiceHint hint : t.voiceHints.list) {
|
||||||
sb.append(String.format(" $turn$%6s;%6d;%10s;%10s;%6d;%s$\n", hint.getCommandString(), hint.indexInTrack,
|
sb.append(String.format(" $turn$%6s;%6d;%10s;%10s;%6d;%s$\n", hint.getCommandString(turnInstructionMode), hint.indexInTrack,
|
||||||
formatILon(hint.ilon), formatILat(hint.ilat), (int) (hint.distanceToNext), hint.formatGeometry()));
|
formatILon(hint.ilon), formatILat(hint.ilat), (int) (hint.distanceToNext), hint.formatGeometry()));
|
||||||
}
|
}
|
||||||
sb.append(" $turn-instruction-end$ -->\n");
|
sb.append(" $turn-instruction-end$ -->\n");
|
||||||
@ -121,7 +121,7 @@ public class FormatGpx extends Formatter {
|
|||||||
sb.append(" <rtept lat=\"").append(formatILat(hint.ilat)).append("\" lon=\"")
|
sb.append(" <rtept lat=\"").append(formatILat(hint.ilat)).append("\" lon=\"")
|
||||||
.append(formatILon(hint.ilon)).append("\">\n")
|
.append(formatILon(hint.ilon)).append("\">\n")
|
||||||
.append(" <desc>")
|
.append(" <desc>")
|
||||||
.append(turnInstructionMode == 3 ? hint.getMessageString() : hint.getCruiserMessageString())
|
.append(turnInstructionMode == 3 ? hint.getMessageString(turnInstructionMode) : hint.getCruiserMessageString())
|
||||||
.append("</desc>\n <extensions>\n");
|
.append("</desc>\n <extensions>\n");
|
||||||
|
|
||||||
rteTime = t.getVoiceHintTime(i + 1);
|
rteTime = t.getVoiceHintTime(i + 1);
|
||||||
@ -132,7 +132,7 @@ public class FormatGpx extends Formatter {
|
|||||||
lastRteTime = rteTime;
|
lastRteTime = rteTime;
|
||||||
}
|
}
|
||||||
sb.append(" <turn>")
|
sb.append(" <turn>")
|
||||||
.append(turnInstructionMode == 3 ? hint.getCommandString() : hint.getCruiserCommandString())
|
.append(turnInstructionMode == 3 ? hint.getCommandString(turnInstructionMode) : hint.getCruiserCommandString())
|
||||||
.append("</turn>\n <turn-angle>").append("" + (int) hint.angle)
|
.append("</turn>\n <turn-angle>").append("" + (int) hint.angle)
|
||||||
.append("</turn-angle>\n <offset>").append("" + hint.indexInTrack).append("</offset>\n </extensions>\n </rtept>\n");
|
.append("</turn-angle>\n <offset>").append("" + hint.indexInTrack).append("</offset>\n </extensions>\n </rtept>\n");
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ public class FormatGpx extends Formatter {
|
|||||||
.append(formatILat(hint.ilat)).append("\">")
|
.append(formatILat(hint.ilat)).append("\">")
|
||||||
.append(hint.selev == Short.MIN_VALUE ? "" : "<ele>" + (hint.selev / 4.) + "</ele>")
|
.append(hint.selev == Short.MIN_VALUE ? "" : "<ele>" + (hint.selev / 4.) + "</ele>")
|
||||||
.append("<name>")
|
.append("<name>")
|
||||||
.append(hint.getMessageString())
|
.append(hint.getMessageString(turnInstructionMode))
|
||||||
.append("</name>")
|
.append("</name>")
|
||||||
.append("<extensions><locus:rteDistance>").append("" + hint.distanceToNext).append("</locus:rteDistance>");
|
.append("<extensions><locus:rteDistance>").append("" + hint.distanceToNext).append("</locus:rteDistance>");
|
||||||
float rteTime = t.getVoiceHintTime(i + 1);
|
float rteTime = t.getVoiceHintTime(i + 1);
|
||||||
@ -173,9 +173,9 @@ public class FormatGpx extends Formatter {
|
|||||||
for (VoiceHint hint : t.voiceHints.list) {
|
for (VoiceHint hint : t.voiceHints.list) {
|
||||||
sb.append(" <wpt lon=\"").append(formatILon(hint.ilon)).append("\" lat=\"")
|
sb.append(" <wpt lon=\"").append(formatILon(hint.ilon)).append("\" lat=\"")
|
||||||
.append(formatILat(hint.ilat)).append("\">")
|
.append(formatILat(hint.ilat)).append("\">")
|
||||||
.append("<name>").append(hint.getMessageString()).append("</name>")
|
.append("<name>").append(hint.getMessageString(turnInstructionMode)).append("</name>")
|
||||||
.append("<sym>").append(hint.getSymbolString().toLowerCase()).append("</sym>")
|
.append("<sym>").append(hint.getSymbolString(turnInstructionMode).toLowerCase()).append("</sym>")
|
||||||
.append("<type>").append(hint.getSymbolString()).append("</type>")
|
.append("<type>").append(hint.getSymbolString(turnInstructionMode)).append("</type>")
|
||||||
.append("</wpt>\n");
|
.append("</wpt>\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,7 +270,7 @@ public class FormatGpx extends Formatter {
|
|||||||
sele += "<name>" + mwpt.name + "</name>";
|
sele += "<name>" + mwpt.name + "</name>";
|
||||||
}
|
}
|
||||||
sele += "<desc>" + hint.getCruiserMessageString() + "</desc>";
|
sele += "<desc>" + hint.getCruiserMessageString() + "</desc>";
|
||||||
sele += "<sym>" + hint.getCommandString(hint.cmd) + "</sym>";
|
sele += "<sym>" + hint.getCommandString(hint.cmd, turnInstructionMode) + "</sym>";
|
||||||
if (mwpt != null) {
|
if (mwpt != null) {
|
||||||
sele += "<type>Via</type>";
|
sele += "<type>Via</type>";
|
||||||
}
|
}
|
||||||
@ -287,7 +287,7 @@ public class FormatGpx extends Formatter {
|
|||||||
sele += "<brouter:speed>" + (((int) (speed * 10)) / 10.f) + "</brouter:speed>";
|
sele += "<brouter:speed>" + (((int) (speed * 10)) / 10.f) + "</brouter:speed>";
|
||||||
}
|
}
|
||||||
|
|
||||||
sele += "<brouter:voicehint>" + hint.getCommandString() + ";" + (int) (hint.distanceToNext) + "," + hint.formatGeometry() + "</brouter:voicehint>";
|
sele += "<brouter:voicehint>" + hint.getCommandString(turnInstructionMode) + ";" + (int) (hint.distanceToNext) + "," + hint.formatGeometry() + "</brouter:voicehint>";
|
||||||
if (n.message != null && n.message.wayKeyValues != null && !n.message.wayKeyValues.equals(lastway)) {
|
if (n.message != null && n.message.wayKeyValues != null && !n.message.wayKeyValues.equals(lastway)) {
|
||||||
sele += "<brouter:way>" + n.message.wayKeyValues + "</brouter:way>";
|
sele += "<brouter:way>" + n.message.wayKeyValues + "</brouter:way>";
|
||||||
lastway = n.message.wayKeyValues;
|
lastway = n.message.wayKeyValues;
|
||||||
|
|||||||
@ -41,13 +41,13 @@ public class FormatJson extends Formatter {
|
|||||||
for (VoiceHint hint : t.voiceHints.list) {
|
for (VoiceHint hint : t.voiceHints.list) {
|
||||||
sb.append(" [");
|
sb.append(" [");
|
||||||
sb.append(hint.indexInTrack);
|
sb.append(hint.indexInTrack);
|
||||||
sb.append(',').append(hint.getJsonCommandIndex());
|
sb.append(',').append(hint.getJsonCommandIndex(turnInstructionMode));
|
||||||
sb.append(',').append(hint.getExitNumber());
|
sb.append(',').append(hint.getExitNumber());
|
||||||
sb.append(',').append(hint.distanceToNext);
|
sb.append(',').append(hint.distanceToNext);
|
||||||
sb.append(',').append((int) hint.angle);
|
sb.append(',').append((int) hint.angle);
|
||||||
|
|
||||||
// not always include geometry because longer and only needed for comment style
|
// not always include geometry because longer and only needed for comment style
|
||||||
if (turnInstructionMode == 4) { // comment style
|
if (turnInstructionMode == 4 || turnInstructionMode == 9) { // comment style
|
||||||
sb.append(",\"").append(hint.formatGeometry()).append("\"");
|
sb.append(",\"").append(hint.formatGeometry()).append("\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ public class FormatJson extends Formatter {
|
|||||||
.append(sele).append("],\n");
|
.append(sele).append("],\n");
|
||||||
nn = n;
|
nn = n;
|
||||||
}
|
}
|
||||||
if (t.nodes != null && !t.nodes.isEmpty()) sb.deleteCharAt(sb.lastIndexOf(","));
|
sb.deleteCharAt(sb.lastIndexOf(","));
|
||||||
|
|
||||||
sb.append(" ]\n");
|
sb.append(" ]\n");
|
||||||
sb.append(" }\n");
|
sb.append(" }\n");
|
||||||
|
|||||||
@ -26,6 +26,8 @@ public class VoiceHint {
|
|||||||
static final int RNLB = 14; // Roundabout left
|
static final int RNLB = 14; // Roundabout left
|
||||||
static final int TU = 15; // 180 degree u-turn
|
static final int TU = 15; // 180 degree u-turn
|
||||||
static final int BL = 16; // Beeline routing
|
static final int BL = 16; // Beeline routing
|
||||||
|
static final int EL = 17; // Beeline routing
|
||||||
|
static final int ER = 18; // Beeline routing
|
||||||
|
|
||||||
int ilon;
|
int ilon;
|
||||||
int ilat;
|
int ilat;
|
||||||
@ -65,7 +67,7 @@ public class VoiceHint {
|
|||||||
badWays.add(badWay);
|
badWays.add(badWay);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getJsonCommandIndex() {
|
public int getJsonCommandIndex(int timode) {
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case TLU:
|
case TLU:
|
||||||
return 10;
|
return 10;
|
||||||
@ -97,6 +99,10 @@ public class VoiceHint {
|
|||||||
return 14;
|
return 14;
|
||||||
case BL:
|
case BL:
|
||||||
return 16;
|
return 16;
|
||||||
|
case EL:
|
||||||
|
return timode == 2 || timode == 9 ? 17 : 8;
|
||||||
|
case ER:
|
||||||
|
return timode == 2 || timode == 9 ? 18 : 9;
|
||||||
case OFFR:
|
case OFFR:
|
||||||
return 12;
|
return 12;
|
||||||
default:
|
default:
|
||||||
@ -111,7 +117,7 @@ public class VoiceHint {
|
|||||||
/*
|
/*
|
||||||
* used by comment style, osmand style
|
* used by comment style, osmand style
|
||||||
*/
|
*/
|
||||||
public String getCommandString() {
|
public String getCommandString(int timode) {
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case TLU:
|
case TLU:
|
||||||
return "TU"; // should be changed to TLU when osmand uses new voice hint constants
|
return "TU"; // should be changed to TLU when osmand uses new voice hint constants
|
||||||
@ -143,6 +149,10 @@ public class VoiceHint {
|
|||||||
return "RNLB" + (-roundaboutExit);
|
return "RNLB" + (-roundaboutExit);
|
||||||
case BL:
|
case BL:
|
||||||
return "BL";
|
return "BL";
|
||||||
|
case EL:
|
||||||
|
return timode == 2 || timode == 9 ? "EL" : "KL";
|
||||||
|
case ER:
|
||||||
|
return timode == 2 || timode == 9 ? "ER" : "KR";
|
||||||
case OFFR:
|
case OFFR:
|
||||||
return "OFFR";
|
return "OFFR";
|
||||||
default:
|
default:
|
||||||
@ -153,7 +163,7 @@ public class VoiceHint {
|
|||||||
/*
|
/*
|
||||||
* used by trkpt/sym style
|
* used by trkpt/sym style
|
||||||
*/
|
*/
|
||||||
public String getCommandString(int c) {
|
public String getCommandString(int c, int timode) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case TLU:
|
case TLU:
|
||||||
return "TLU";
|
return "TLU";
|
||||||
@ -185,6 +195,10 @@ public class VoiceHint {
|
|||||||
return "RNLB" + (-roundaboutExit);
|
return "RNLB" + (-roundaboutExit);
|
||||||
case BL:
|
case BL:
|
||||||
return "BL";
|
return "BL";
|
||||||
|
case EL:
|
||||||
|
return timode == 2 || timode == 9 ? "EL" : "KL";
|
||||||
|
case ER:
|
||||||
|
return timode == 2 || timode == 9 ? "ER" : "KR";
|
||||||
case OFFR:
|
case OFFR:
|
||||||
return "OFFR";
|
return "OFFR";
|
||||||
default:
|
default:
|
||||||
@ -195,7 +209,7 @@ public class VoiceHint {
|
|||||||
/*
|
/*
|
||||||
* used by gpsies style
|
* used by gpsies style
|
||||||
*/
|
*/
|
||||||
public String getSymbolString() {
|
public String getSymbolString(int timode) {
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case TLU:
|
case TLU:
|
||||||
return "TU";
|
return "TU";
|
||||||
@ -227,6 +241,10 @@ public class VoiceHint {
|
|||||||
return "RNLB" + (-roundaboutExit);
|
return "RNLB" + (-roundaboutExit);
|
||||||
case BL:
|
case BL:
|
||||||
return "BL";
|
return "BL";
|
||||||
|
case EL:
|
||||||
|
return timode == 2 || timode == 9 ? "EL" : "KL";
|
||||||
|
case ER:
|
||||||
|
return timode == 2 || timode == 9 ? "ER" : "KR";
|
||||||
case OFFR:
|
case OFFR:
|
||||||
return "OFFR";
|
return "OFFR";
|
||||||
default:
|
default:
|
||||||
@ -269,6 +287,10 @@ public class VoiceHint {
|
|||||||
return "roundabout_e" + (-roundaboutExit);
|
return "roundabout_e" + (-roundaboutExit);
|
||||||
case BL:
|
case BL:
|
||||||
return "beeline";
|
return "beeline";
|
||||||
|
case EL:
|
||||||
|
return "exit_left";
|
||||||
|
case ER:
|
||||||
|
return "exit_right";
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("unknown command: " + cmd);
|
throw new IllegalArgumentException("unknown command: " + cmd);
|
||||||
}
|
}
|
||||||
@ -277,7 +299,7 @@ public class VoiceHint {
|
|||||||
/*
|
/*
|
||||||
* used by osmand style
|
* used by osmand style
|
||||||
*/
|
*/
|
||||||
public String getMessageString() {
|
public String getMessageString(int timode) {
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case TLU:
|
case TLU:
|
||||||
return "u-turn"; // should be changed to u-turn-left when osmand uses new voice hint constants
|
return "u-turn"; // should be changed to u-turn-left when osmand uses new voice hint constants
|
||||||
@ -307,6 +329,10 @@ public class VoiceHint {
|
|||||||
return "Take exit " + roundaboutExit;
|
return "Take exit " + roundaboutExit;
|
||||||
case RNLB:
|
case RNLB:
|
||||||
return "Take exit " + (-roundaboutExit);
|
return "Take exit " + (-roundaboutExit);
|
||||||
|
case EL:
|
||||||
|
return timode == 2 || timode == 9 ? "exit left" : "keep left";
|
||||||
|
case ER:
|
||||||
|
return timode == 2 || timode == 9 ? "exit right" : "keep right";
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("unknown command: " + cmd);
|
throw new IllegalArgumentException("unknown command: " + cmd);
|
||||||
}
|
}
|
||||||
@ -345,6 +371,10 @@ public class VoiceHint {
|
|||||||
return 26 + roundaboutExit;
|
return 26 + roundaboutExit;
|
||||||
case RNLB:
|
case RNLB:
|
||||||
return 26 - roundaboutExit;
|
return 26 - roundaboutExit;
|
||||||
|
case EL:
|
||||||
|
return 9;
|
||||||
|
case ER:
|
||||||
|
return 10;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("unknown command: " + cmd);
|
throw new IllegalArgumentException("unknown command: " + cmd);
|
||||||
}
|
}
|
||||||
@ -383,6 +413,10 @@ public class VoiceHint {
|
|||||||
return 1008 + roundaboutExit;
|
return 1008 + roundaboutExit;
|
||||||
case RNLB:
|
case RNLB:
|
||||||
return 1008 + roundaboutExit;
|
return 1008 + roundaboutExit;
|
||||||
|
case EL:
|
||||||
|
return 1015;
|
||||||
|
case ER:
|
||||||
|
return 1014;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("unknown command: " + cmd);
|
throw new IllegalArgumentException("unknown command: " + cmd);
|
||||||
}
|
}
|
||||||
@ -423,6 +457,10 @@ public class VoiceHint {
|
|||||||
return "RNLB" + (-roundaboutExit);
|
return "RNLB" + (-roundaboutExit);
|
||||||
case BL:
|
case BL:
|
||||||
return "BL";
|
return "BL";
|
||||||
|
case EL:
|
||||||
|
return "EL";
|
||||||
|
case ER:
|
||||||
|
return "ER";
|
||||||
case OFFR:
|
case OFFR:
|
||||||
return "OFFR";
|
return "OFFR";
|
||||||
default:
|
default:
|
||||||
@ -465,6 +503,10 @@ public class VoiceHint {
|
|||||||
return "take exit " + (-roundaboutExit);
|
return "take exit " + (-roundaboutExit);
|
||||||
case BL:
|
case BL:
|
||||||
return "beeline";
|
return "beeline";
|
||||||
|
case EL:
|
||||||
|
return "exit left";
|
||||||
|
case ER:
|
||||||
|
return "exit right";
|
||||||
case OFFR:
|
case OFFR:
|
||||||
return "offroad";
|
return "offroad";
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -334,6 +334,17 @@ public final class VoiceHintProcessor {
|
|||||||
inputLastSaved.distanceToNext += input.distanceToNext;
|
inputLastSaved.distanceToNext += input.distanceToNext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if ((input.goodWay.getPrio() == 29 && input.maxBadPrio == 30) &&
|
||||||
|
((hintIdx + 1 < inputs.size() && inputs.get(hintIdx+1).goodWay.getPrio() < 29) ||
|
||||||
|
(hintIdx + 2 < inputs.size() && inputs.get(hintIdx+2).goodWay.getPrio() < 29))) {
|
||||||
|
// leave motorway
|
||||||
|
if (input.cmd == VoiceHint.KR || input.cmd == VoiceHint.TSLR) {
|
||||||
|
input.cmd = VoiceHint.ER;
|
||||||
|
} else if (input.cmd == VoiceHint.KL || input.cmd == VoiceHint.TSLL) {
|
||||||
|
input.cmd = VoiceHint.EL;
|
||||||
|
}
|
||||||
|
results.add(input);
|
||||||
|
inputLastSaved = input;
|
||||||
} else {
|
} else {
|
||||||
// add all others
|
// add all others
|
||||||
// ignore motorway / primary continue
|
// ignore motorway / primary continue
|
||||||
@ -384,6 +395,14 @@ public final class VoiceHintProcessor {
|
|||||||
inputLastSaved.distanceToNext += input.distanceToNext;
|
inputLastSaved.distanceToNext += input.distanceToNext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if ((input.goodWay.getPrio() == 29 && input.maxBadPrio == 30)) {
|
||||||
|
// leave motorway
|
||||||
|
if (input.cmd == VoiceHint.KR || input.cmd == VoiceHint.TSLR) {
|
||||||
|
input.cmd = VoiceHint.ER;
|
||||||
|
} else if (input.cmd == VoiceHint.KL || input.cmd == VoiceHint.TSLL) {
|
||||||
|
input.cmd = VoiceHint.EL;
|
||||||
|
}
|
||||||
|
save = true;
|
||||||
} else if (VoiceHint.is180DegAngle(input.angle)) {
|
} else if (VoiceHint.is180DegAngle(input.angle)) {
|
||||||
// add u-turn, 180 degree
|
// add u-turn, 180 degree
|
||||||
save = true;
|
save = true;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ And there are other rules
|
|||||||
* merge two hints when near to each other - e.g. left, left to u-turn left
|
* merge two hints when near to each other - e.g. left, left to u-turn left
|
||||||
* marker when highway exit and continue nearly same direction
|
* marker when highway exit and continue nearly same direction
|
||||||
* beeline goes direct from via to via point
|
* beeline goes direct from via to via point
|
||||||
|
* junction on motorway via motorway_link and next way less then motorway_link is a motorway exit
|
||||||
|
|
||||||
There are some variables in the profiles that affect on the voice hint generation:
|
There are some variables in the profiles that affect on the voice hint generation:
|
||||||
* considerTurnRestrictions -
|
* considerTurnRestrictions -
|
||||||
@ -51,4 +52,6 @@ Voice hint variables
|
|||||||
| RNDB | roundabout |
|
| RNDB | roundabout |
|
||||||
| RNLB | roundabout left |
|
| RNLB | roundabout left |
|
||||||
| BL | beeline routing |
|
| BL | beeline routing |
|
||||||
|
| EL | exit left |
|
||||||
|
| ER | exit right |
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user