This commit is contained in:
Victor Shcherb 2017-04-11 23:41:52 +02:00
parent 981ad9d0c2
commit 2cf480bb94
2 changed files with 31 additions and 27 deletions

View file

@ -1124,7 +1124,7 @@ public class RouteResultPreparation {
List<int[]> lanesInfo, int roads, int addRoads) { List<int[]> lanesInfo, int roads, int addRoads) {
int activeStartIndex = -1; int activeStartIndex = -1;
boolean lookupSlightTurn = addRoads > 0; boolean lookupSlightTurn = addRoads > 0;
Set<String> addedTurns = new TreeSet<String>(); TIntHashSet addedTurns = new TIntHashSet();
// if we have information increase number of roads per each turn direction // if we have information increase number of roads per each turn direction
int diffTurnRoads = roads; int diffTurnRoads = roads;
int increaseTurnRoads = 0; int increaseTurnRoads = 0;
@ -1145,7 +1145,7 @@ public class RouteResultPreparation {
String[] laneTurns = splitLaneOptions[ind].split(";"); String[] laneTurns = splitLaneOptions[ind].split(";");
int cnt = 0; int cnt = 0;
for(String lTurn : laneTurns) { for(String lTurn : laneTurns) {
boolean added = addedTurns.add(lTurn); boolean added = addedTurns.add(TurnType.convertType(lTurn));
if(added) { if(added) {
cnt++; cnt++;
diffTurnRoads --; diffTurnRoads --;
@ -1361,31 +1361,7 @@ public class RouteResultPreparation {
String[] laneOptions = splitLaneOptions[i].split(";"); String[] laneOptions = splitLaneOptions[i].split(";");
boolean isTertiaryTurn = false; boolean isTertiaryTurn = false;
for (int j = 0; j < laneOptions.length; j++) { for (int j = 0; j < laneOptions.length; j++) {
int turn; int turn = TurnType.convertType(laneOptions[j]);
if (laneOptions[j].equals("none") || laneOptions[j].equals("through")) {
turn = TurnType.C;
} else if (laneOptions[j].equals("slight_right") ||
laneOptions[j].equals("merge_to_right")) {
turn = TurnType.TSLR;
} else if (laneOptions[j].equals("slight_left") ||
laneOptions[j].equals("merge_to_left")) {
turn = TurnType.TSLL;
} else if (laneOptions[j].equals("right")) {
turn = TurnType.TR;
} else if (laneOptions[j].equals("left")) {
turn = TurnType.TL;
} else if (laneOptions[j].equals("sharp_right")) {
turn = TurnType.TSHR;
} else if (laneOptions[j].equals("sharp_left")) {
turn = TurnType.TSHL;
} else if (laneOptions[j].equals("reverse")) {
turn = TurnType.TU;
} else {
// Unknown string
turn = TurnType.C;
// continue;
}
final int primary = TurnType.getPrimaryTurn(lanes[i]); final int primary = TurnType.getPrimaryTurn(lanes[i]);
if (primary == 0) { if (primary == 0) {

View file

@ -413,6 +413,34 @@ public class TurnType {
} }
} }
public static int convertType(String lane) {
int turn;
if (lane.equals("none") || lane.equals("through")) {
turn = TurnType.C;
} else if (lane.equals("slight_right") ||
lane.equals("merge_to_right")) {
turn = TurnType.TSLR;
} else if (lane.equals("slight_left") ||
lane.equals("merge_to_left")) {
turn = TurnType.TSLL;
} else if (lane.equals("right")) {
turn = TurnType.TR;
} else if (lane.equals("left")) {
turn = TurnType.TL;
} else if (lane.equals("sharp_right")) {
turn = TurnType.TSHR;
} else if (lane.equals("sharp_left")) {
turn = TurnType.TSHL;
} else if (lane.equals("reverse")) {
turn = TurnType.TU;
} else {
// Unknown string
turn = TurnType.C;
// continue;
}
return turn;
}
} }