From 133e2ff1420642dd598b137c21add21dffaba1cc Mon Sep 17 00:00:00 2001 From: MadWasp79 Date: Thu, 9 Jan 2020 17:34:53 +0200 Subject: [PATCH] fix for #8198 --- .../net/osmand/router/RouteResultPreparation.java | 7 ++++--- .../src/net/osmand/plus/views/TurnPathHelper.java | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java index 53976a1b74..3356a60e56 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java @@ -1087,14 +1087,15 @@ public class RouteResultPreparation { t = attachKeepLeftInfoAndLanes(leftSide, prev, rr); } if (t != null) { - t.setTurnAngle((float) -mpi); + t.setTurnAngle((float) - mpi); } } return t; } - private int[] getTurnLanesInfo(RouteSegmentResult prevSegm, int mainTurnType) { String turnLanes = getTurnLanesString(prevSegm); - int[] lanesArray ; + private int[] getTurnLanesInfo(RouteSegmentResult prevSegm, int mainTurnType) { + String turnLanes = getTurnLanesString(prevSegm); + int[] lanesArray; if (turnLanes == null) { if(prevSegm.getTurnType() != null && prevSegm.getTurnType().getLanes() != null && prevSegm.getDistance() < 100) { diff --git a/OsmAnd/src/net/osmand/plus/views/TurnPathHelper.java b/OsmAnd/src/net/osmand/plus/views/TurnPathHelper.java index 8b4ba4d8e2..d65a8396c9 100644 --- a/OsmAnd/src/net/osmand/plus/views/TurnPathHelper.java +++ b/OsmAnd/src/net/osmand/plus/views/TurnPathHelper.java @@ -568,7 +568,6 @@ public class TurnPathHelper { public static Path getPathFromTurnType(Resources res, int firstTurn, int secondTurn, int thirdTurn, int turnIndex, float coef, boolean leftSide, boolean smallArrow) { - int firstTurnType = TurnType.valueOf(firstTurn, leftSide).getValue(); int secondTurnType = TurnType.valueOf(secondTurn, leftSide).getValue(); int thirdTurnType = TurnType.valueOf(thirdTurn, leftSide).getValue(); @@ -606,6 +605,14 @@ public class TurnPathHelper { } else { turnResource = null; } + } else if (TurnType.isSlightTurn(firstTurnType) && !TurnType.isSlightTurn(secondTurnType) + && !TurnType.isSlightTurn(thirdTurnType)) { + if (TurnType.isLeftTurn(firstTurnType) && TurnType.isRightTurn(secondTurnType) + && TurnType.isLeftTurn(thirdTurnType)){ + turnResource = new TurnResource(secondTurnType, true, false, leftSide); + } else if (TurnType.isRightTurn(firstTurnType) && TurnType.isLeftTurn(secondTurnType) + && TurnType.isRightTurn(thirdTurnType)) { + turnResource = new TurnResource(secondTurnType, true, false, leftSide); } } else if (firstTurnType == TurnType.C || thirdTurnType == TurnType.C) { // get the small one turnResource = new TurnResource(secondTurnType, true, false, leftSide); @@ -613,9 +620,11 @@ public class TurnPathHelper { turnResource = new TurnResource(secondTurnType, false, false, leftSide); } } else if (turnIndex == THIRD_TURN) { - if ((TurnType.isLeftTurn(firstTurnType) || TurnType.isLeftTurn(secondTurnType)) && TurnType.isLeftTurn(thirdTurnType)) { + if (((TurnType.isLeftTurn(firstTurnType) && !TurnType.isSlightTurn(firstTurnType)) + || TurnType.isLeftTurn(secondTurnType)) && TurnType.isLeftTurn(thirdTurnType)) { turnResource = null; - } else if ((TurnType.isRightTurn(firstTurnType) || TurnType.isRightTurn(secondTurnType)) && TurnType.isRightTurn(thirdTurnType)) { + } else if (((TurnType.isRightTurn(firstTurnType) && !TurnType.isSlightTurn(firstTurnType)) + || TurnType.isRightTurn(secondTurnType)) && TurnType.isRightTurn(thirdTurnType)) { turnResource = null; } else { turnResource = new TurnResource(thirdTurnType, true, false, leftSide);