diff --git a/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java b/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java index 69a6ab03e0..0fe5aa7a7a 100644 --- a/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java +++ b/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java @@ -648,11 +648,13 @@ public class RouteResultPreparation { boolean leftTurn = TurnType.isLeftTurn(mainTurnType); int ind = leftTurn? 0 : lanesArray.length - 1; final int tt = TurnType.getPrimaryTurn(lanesArray[ind]); + final int st = TurnType.getSecondaryTurn(lanesArray[ind]); if (leftTurn) { if (!TurnType.isLeftTurn(tt)) { // This was just to make sure that there's no bad data. TurnType.setPrimaryTurnAndReset(lanesArray, ind, TurnType.TL); TurnType.setSecondaryTurn(lanesArray, ind, tt); + TurnType.setTertiaryTurn(lanesArray, ind, st); lanesArray[ind] |= 1; } } else { @@ -660,6 +662,7 @@ public class RouteResultPreparation { // This was just to make sure that there's no bad data. TurnType.setPrimaryTurnAndReset(lanesArray, ind, TurnType.TR); TurnType.setSecondaryTurn(lanesArray, ind, tt); + TurnType.setTertiaryTurn(lanesArray, ind, st); lanesArray[ind] |= 1; } } @@ -1031,10 +1034,9 @@ public class RouteResultPreparation { (TurnType.isRightTurn(calcTurnType) && TurnType.isRightTurn(turn)) || (TurnType.isLeftTurn(calcTurnType) && TurnType.isLeftTurn(turn)) ) { - TurnType.setPrimaryTurnAndReset(lanes, i, turn); - TurnType.setSecondaryTurn(lanes, i, primary); + TurnType.setPrimaryTurnShiftOthers(lanes, i, turn); } else { - TurnType.setSecondaryTurn(lanes, i, turn); + TurnType.setSecondaryTurnShiftOthers(lanes, i, turn); } break; // Move on to the next lane } @@ -1055,12 +1057,18 @@ public class RouteResultPreparation { if (TurnType.getSecondaryTurn(oLanes[i]) != 0) { possibleTurns.add(TurnType.getSecondaryTurn(oLanes[i])); } + if (TurnType.getTertiaryTurn(oLanes[i]) != 0) { + possibleTurns.add(TurnType.getTertiaryTurn(oLanes[i])); + } } else { TIntArrayList laneTurns = new TIntArrayList(); laneTurns.add(TurnType.getPrimaryTurn(oLanes[i])); if (TurnType.getSecondaryTurn(oLanes[i]) != 0) { laneTurns.add(TurnType.getSecondaryTurn(oLanes[i])); } + if (TurnType.getTertiaryTurn(oLanes[i]) != 0) { + laneTurns.add(TurnType.getTertiaryTurn(oLanes[i])); + } possibleTurns.retainAll(laneTurns); if (possibleTurns.isEmpty()) { // No common turns, so can't determine anything. @@ -1076,6 +1084,9 @@ public class RouteResultPreparation { if (TurnType.getSecondaryTurn(oLanes[i]) != 0) { possibleTurns.remove((Integer) TurnType.getSecondaryTurn(oLanes[i])); } + if (TurnType.getTertiaryTurn(oLanes[i]) != 0) { + possibleTurns.remove((Integer) TurnType.getTertiaryTurn(oLanes[i])); + } } } diff --git a/OsmAnd-java/src/net/osmand/router/TurnType.java b/OsmAnd-java/src/net/osmand/router/TurnType.java index ada4a472dc..8fea638dd7 100644 --- a/OsmAnd-java/src/net/osmand/router/TurnType.java +++ b/OsmAnd-java/src/net/osmand/router/TurnType.java @@ -158,6 +158,7 @@ public class TurnType { // 0 bit - 0/1 - to use or not // 1-5 bits - additional turn info // 6-10 bits - secondary turn + // 11-15 bits - tertiary turn public void setLanes(int[] lanes) { this.lanes = lanes; } @@ -182,6 +183,32 @@ public class TurnType { // Get the primary turn modifier for the lane return (laneValue >> 5); } + + public static void setPrimaryTurnShiftOthers(int[] lanes, int lane, int turnType) { + int pt = getPrimaryTurn(lanes[lane]); + int st = getSecondaryTurn(lanes[lane]); + //int tt = getTertiaryTurn(lanes[lane]); + setPrimaryTurnAndReset(lanes, lane, turnType); + setSecondaryTurn(lanes, lane, pt); + setTertiaryTurn(lanes, lane, st); + } + + public static void setSecondaryTurnShiftOthers(int[] lanes, int lane, int turnType) { + int st = getSecondaryTurn(lanes[lane]); + //int tt = getTertiaryTurn(lanes[lane]); + setSecondaryTurn(lanes, lane, turnType); + setTertiaryTurn(lanes, lane, st); + } + + public static void setTertiaryTurn(int[] lanes, int lane, int turnType) { + lanes[lane] &= ~(15 << 10); + lanes[lane] |= (turnType << 10); + } + + public static int getTertiaryTurn(int laneValue) { + // Get the primary turn modifier for the lane + return (laneValue >> 10); + } public int[] getLanes() { @@ -241,11 +268,11 @@ public class TurnType { } public static boolean isLeftTurn(int type) { - return type == TL || type == TSHL || type == TSLL || type == TRU; + return type == TL || type == TSHL || type == TSLL || type == TU || type == KL; } public static boolean isRightTurn(int type) { - return type == TR || type == TSHR || type == TSLR || type == TU; + return type == TR || type == TSHR || type == TSLR || type == TRU || type == KR; } public static boolean isSlightTurn(int type) { diff --git a/OsmAnd/no_translate.xml b/OsmAnd/no_translate.xml index 702dd1adfc..5778a33e00 100644 --- a/OsmAnd/no_translate.xml +++ b/OsmAnd/no_translate.xml @@ -1,7 +1,7 @@ OsmAnd~ - 2.3.0 + 2.4.0