From 5336b59495c0ccdc69e55d5ab3cd5452e5a27cd2 Mon Sep 17 00:00:00 2001 From: Roman Inflianskas Date: Tue, 5 Apr 2016 12:58:05 +0300 Subject: [PATCH] Support three turn options for one segment in the result route description --- .../net/osmand/router/RouteResultPreparation.java | 8 ++++++-- OsmAnd-java/src/net/osmand/router/TurnType.java | 4 ++-- OsmAnd-java/test/resources/test_turn_lanes.json | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java b/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java index ef5331547b..afe7693fb2 100644 --- a/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java +++ b/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java @@ -1006,6 +1006,7 @@ public class RouteResultPreparation { int[] lanes = new int[splitLaneOptions.length]; for (int i = 0; i < splitLaneOptions.length; i++) { String[] laneOptions = splitLaneOptions[i].split(";"); + boolean is_tertiary_turn = false; for (int j = 0; j < laneOptions.length; j++) { int turn; @@ -1039,10 +1040,13 @@ public class RouteResultPreparation { (TurnType.isLeftTurn(calcTurnType) && TurnType.isLeftTurn(turn)) ) { TurnType.setPrimaryTurnShiftOthers(lanes, i, turn); - } else { + } else if (!is_tertiary_turn) { TurnType.setSecondaryTurnShiftOthers(lanes, i, turn); + is_tertiary_turn = true; + } else { + TurnType.setTertiaryTurn(lanes, i, turn); + break; } - break; // Move on to the next lane } } } diff --git a/OsmAnd-java/src/net/osmand/router/TurnType.java b/OsmAnd-java/src/net/osmand/router/TurnType.java index 8fea638dd7..e7928a6b19 100644 --- a/OsmAnd-java/src/net/osmand/router/TurnType.java +++ b/OsmAnd-java/src/net/osmand/router/TurnType.java @@ -180,7 +180,7 @@ public class TurnType { } public static int getSecondaryTurn(int laneValue) { - // Get the primary turn modifier for the lane + // Get the secondary turn modifier for the lane return (laneValue >> 5); } @@ -206,7 +206,7 @@ public class TurnType { } public static int getTertiaryTurn(int laneValue) { - // Get the primary turn modifier for the lane + // Get the tertiary turn modifier for the lane return (laneValue >> 10); } diff --git a/OsmAnd-java/test/resources/test_turn_lanes.json b/OsmAnd-java/test/resources/test_turn_lanes.json index 65908a4011..67ea477150 100644 --- a/OsmAnd-java/test/resources/test_turn_lanes.json +++ b/OsmAnd-java/test/resources/test_turn_lanes.json @@ -216,6 +216,21 @@ "expectedResults": { "14418": "TL, +TL, C, C, TR" } + }, + { + "testName": "11.Figure 8 TL", + "startPoint": { + "latitude": 45.69816447596442, + "longitude": 35.74885922431952 + }, + "endPoint": { + "latitude": 45.700075267731705, + "longitude": 35.7467134571076 + }, + "expectedResults": { + "43906": null, + "43905": "+TL;C;TR" + } } ] \ No newline at end of file