Fix turn type issue

This commit is contained in:
Victor Shcherb 2016-05-30 11:08:31 +02:00
parent 1d60b41dc7
commit 62ab13547d
2 changed files with 11 additions and 0 deletions

View file

@ -821,9 +821,15 @@ public class RouteResultPreparation {
} else {
for (int k = 0; k < rawLanes.length; k++) {
int turn = TurnType.getPrimaryTurn(rawLanes[k]);
int sturn = TurnType.getSecondaryTurn(rawLanes[k]);
boolean active = false;
if (turn == TurnType.C) {
active = true;
if ((TurnType.isRightTurn(sturn) && rs.roadsOnRight == 0)
|| (TurnType.isLeftTurn(sturn) && rs.roadsOnLeft == 0)) {
TurnType.setPrimaryTurn(rawLanes, k, sturn);
TurnType.setSecondaryTurn(rawLanes, k, turn);
}
} else if (TurnType.isRightTurn(turn) && rs.roadsOnRight == 0) {
// some turns go through many segments (to turn right or left)
// so on one first segment the lane could be available and may be only 1 possible

View file

@ -178,6 +178,11 @@ public class TurnType {
lanes[lane] &= ~(15 << 5);
lanes[lane] |= (turnType << 5);
}
public static void setPrimaryTurn(int[] lanes, int lane, int turnType) {
lanes[lane] &= ~(15 << 1);
lanes[lane] |= (turnType << 1);
}
public static int getSecondaryTurn(int laneValue) {
// Get the secondary turn modifier for the lane