diff --git a/OsmAnd/src/net/osmand/plus/views/TurnPathHelper.java b/OsmAnd/src/net/osmand/plus/views/TurnPathHelper.java index 48afc83a83..fb351f99f2 100644 --- a/OsmAnd/src/net/osmand/plus/views/TurnPathHelper.java +++ b/OsmAnd/src/net/osmand/plus/views/TurnPathHelper.java @@ -11,6 +11,11 @@ import java.util.Map; public class TurnPathHelper { + //Index of processed turn + public static final int FIRST_TURN = 1; + public static final int SECOND_TURN = 2; + public static final int THIRD_TURN = 3; + // 72x72 public static void calcTurnPath(Path pathForTurn, TurnType turnType, Matrix transform) { if(turnType == null){ @@ -400,7 +405,7 @@ public class TurnPathHelper { } - public static Bitmap getBitmapFromTurnType(Resources res, Map cache, int firstTurn, int secondTurn, int thirdTurn, int turn, Bitmap defaultType, float coef, boolean leftSide) { + public static Bitmap getBitmapFromTurnType(Resources res, Map cache, int firstTurn, int secondTurn, int thirdTurn, int turnIndex, Bitmap defaultType, float coef, boolean leftSide) { int firstTurnType = TurnType.valueOf(firstTurn, leftSide).getValue(); int secondTurnType = TurnType.valueOf(secondTurn, leftSide).getValue(); @@ -408,7 +413,7 @@ public class TurnPathHelper { TurnResource turnResource = new TurnResource(R.drawable.map_turn_forward_small, false); - if(turn == 1){ + if(turnIndex == FIRST_TURN){ if(firstTurn == 0) return defaultType; if(secondTurnType == 0) { turnResource = getTallArrow(firstTurnType); @@ -422,14 +427,14 @@ public class TurnPathHelper { // get the small one turnResource = getShortArrow(firstTurnType); } - }else if(turn == 2){ - if(firstTurnType == TurnType.C){ + }else if(turnIndex == SECOND_TURN){ + if(firstTurnType == TurnType.C || firstTurnType == TurnType.TR){ // get the small one turnResource = getShortArrow(secondTurnType); }else{ turnResource = getTallArrow(secondTurnType); } - }else if(turn == 3){ + }else if(turnIndex == THIRD_TURN){ if(secondTurnType == TurnType.C){ // get the small one turnResource = getShortArrow(thirdTurnType); diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java index 96ae130df2..423c5616d0 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java @@ -649,7 +649,7 @@ public class RouteInfoWidgetsFactory { this.scaleCoefficient = scaleCoefficent; laneStraight = getPathFromTurnType(paths, TurnType.C, null, scaleCoefficient / miniCoeff); - laneStraightBitmap = TurnPathHelper.getBitmapFromTurnType(ctx.getResources(), bitmapCache, TurnType.C, 0, 0, 1, null, scaleCoefficient / miniCoeff, leftSide); + laneStraightBitmap = TurnPathHelper.getBitmapFromTurnType(ctx.getResources(), bitmapCache, TurnType.C, 0, 0, TurnPathHelper.FIRST_TURN, null, scaleCoefficient / miniCoeff, leftSide); paintBlack = new Paint(); paintBlack.setStyle(Style.STROKE); paintBlack.setColor(Color.BLACK); @@ -704,11 +704,11 @@ public class RouteInfoWidgetsFactory { secondTurnType = TurnType.getSecondaryTurn(lanes[i]); float coef = scaleCoefficient / miniCoeff; - Bitmap b = TurnPathHelper.getBitmapFromTurnType(ctx.getResources(), bitmapCache, turnType, secondTurnType, 0, 1, laneStraightBitmap, coef, leftSide); + Bitmap b = TurnPathHelper.getBitmapFromTurnType(ctx.getResources(), bitmapCache, turnType, secondTurnType, 0, TurnPathHelper.FIRST_TURN, laneStraightBitmap, coef, leftSide); if(secondTurnType > 0){ Bitmap bSecond = null; - bSecond = TurnPathHelper.getBitmapFromTurnType(ctx.getResources(), bitmapCache, turnType, secondTurnType, 0, 2, laneStraightBitmap, coef, leftSide); + bSecond = TurnPathHelper.getBitmapFromTurnType(ctx.getResources(), bitmapCache, turnType, secondTurnType, 0, TurnPathHelper.SECOND_TURN, laneStraightBitmap, coef, leftSide); if (bSecond != null){ paintSecondTurn.setColorFilter(new PorterDuffColorFilter(paintSecondTurn.getColor(), PorterDuff.Mode.SRC_ATOP)); canvas.drawBitmap(bSecond, 0f, 0f, paintSecondTurn);