Skip to content

Commit

Permalink
Merge pull request #594 from rkflx/PR/only-revert-voicehint-reindexing
Browse files Browse the repository at this point in the history
Revert voice hint reindexing
  • Loading branch information
afischerdev committed Jul 17, 2023
2 parents bd6d221 + d98b106 commit 22cf0bb
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 8 deletions.
2 changes: 1 addition & 1 deletion brouter-core/src/main/java/btools/router/OsmTrack.java
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ public String formatAsGeoJson() {
for (VoiceHint hint : voiceHints.list) {
sb.append(" [");
sb.append(hint.indexInTrack);
sb.append(',').append(hint.getCommand());
sb.append(',').append(hint.getJsonCommandIndex());
sb.append(',').append(hint.getExitNumber());
sb.append(',').append(hint.distanceToNext);
sb.append(',').append((int) hint.angle);
Expand Down
49 changes: 42 additions & 7 deletions brouter-core/src/main/java/btools/router/VoiceHint.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public class VoiceHint {
static final int KL = 8; // keep left
static final int KR = 9; // keep right
static final int TLU = 10; // U-turn
static final int TU = 11; // 180 degree u-turn
static final int TRU = 12; // Right U-turn
static final int OFFR = 13; // Off route
static final int RNDB = 14; // Roundabout
static final int RNLB = 15; // Roundabout left
static final int TRU = 11; // Right U-turn
static final int OFFR = 12; // Off route
static final int RNDB = 13; // Roundabout
static final int RNLB = 14; // Roundabout left
static final int TU = 15; // 180 degree u-turn
static final int BL = 16; // Beeline routing

int ilon;
Expand Down Expand Up @@ -61,8 +61,43 @@ public void addBadWay(MessageData badWay) {
badWays.add(badWay);
}

public int getCommand() {
return cmd;
public int getJsonCommandIndex() {
switch (cmd) {
case TLU:
return 10;
case TU:
return 15;
case TSHL:
return 4;
case TL:
return 2;
case TSLL:
return 3;
case KL:
return 8;
case C:
return 1;
case KR:
return 9;
case TSLR:
return 6;
case TR:
return 5;
case TSHR:
return 7;
case TRU:
return 11;
case RNDB:
return 13;
case RNLB:
return 14;
case BL:
return 16;
case OFFR:
return 12;
default:
throw new IllegalArgumentException("unknown command: " + cmd);
}
}

public int getExitNumber() {
Expand Down

0 comments on commit 22cf0bb

Please sign in to comment.