From 2520b7cb598557c8638b5779db04d74d2171376f Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 15 Jul 2012 15:20:21 +0200 Subject: [PATCH] Adjustify follow status and directions to buttons --- .../net/osmand/router/BinaryRoutePlanner.java | 4 +-- .../net/osmand/plus/views/MapInfoLayer.java | 25 +++++-------------- .../plus/views/NextTurnInfoControl.java | 8 +++--- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java index 7bfa33b4a3..5c80712989 100644 --- a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java +++ b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java @@ -904,10 +904,10 @@ public class BinaryRoutePlanner { if(tnext != null && result.get(i).getDistance() < 35) { if(tl && TurnType.TL.equals(tnext.getValue()) ) { next = i + 2; - t = TurnType.valueOf(TurnType.TU, true); + t = TurnType.valueOf(TurnType.TU, false); } else if(tr && TurnType.TR.equals(tnext.getValue()) ) { next = i + 2; - t = TurnType.valueOf(TurnType.TU, false); + t = TurnType.valueOf(TurnType.TU, true); } } } diff --git a/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java b/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java index 79d947c00d..6c515b1969 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java @@ -509,8 +509,8 @@ public class MapInfoLayer extends OsmandMapLayer { public boolean updateInfo() { boolean visible = false; if (routeLayer != null && routingHelper.isRouteCalculated() && routingHelper.isFollowingMode()) { - boolean uturnWhenPossible = routingHelper.makeUturnWhenPossible(); - NextDirectionInfo r = routingHelper.getNextRouteDirectionInfo(calc1, false); + boolean uturnWhenPossible = routingHelper.makeUturnWhenPossible() ; + NextDirectionInfo r = routingHelper.getNextRouteDirectionInfo(calc1, true); if (!uturnWhenPossible) { if (r != null) { // next turn is very close (show next next with false to speak) @@ -652,9 +652,8 @@ public class MapInfoLayer extends OsmandMapLayer { @Override public boolean updateInfo() { boolean visible = false; - if (routeLayer != null && routingHelper.isRouteCalculated() ) { - boolean follow = routingHelper.isFollowingMode(); - makeUturnWhenPossible = routingHelper.makeUturnWhenPossible() && follow; + if (routeLayer != null && routingHelper.isRouteCalculated() && routingHelper.isFollowingMode()) { + makeUturnWhenPossible = routingHelper.makeUturnWhenPossible() ; if (makeUturnWhenPossible) { visible = true; turnImminent = 1; @@ -663,19 +662,7 @@ public class MapInfoLayer extends OsmandMapLayer { invalidate(); } else { boolean showStraight = false; - NextDirectionInfo r = null; - if(follow) { - r = routingHelper.getNextRouteDirectionInfo(calc1, true); - } else { - int di = map.getMapLayers().getRouteInfoLayer().getDirectionInfo(); - if (di >= 0 && map.getMapLayers().getRouteInfoLayer().isVisible()) { - RouteDirectionInfo next = routingHelper.getRouteDirections().get(di); - r = new NextDirectionInfo(); - r.directionInfo = next; - r.distanceTo = 0; - r.imminent = 1; - } - } + NextDirectionInfo r = routingHelper.getNextRouteDirectionInfo(calc1, true); if (r != null && r.distanceTo > 0) { visible = true; if (r.directionInfo == null) { @@ -882,7 +869,7 @@ public class MapInfoLayer extends OsmandMapLayer { loclanes = r.directionInfo.getTurnType().getLanes(); locimminent = r.imminent; // Do not show too far - if(r.distanceTo > 700 || (r.distanceTo > 1200 && !r.directionInfo.getTurnType().isSkipToSpeak())) { + if ((r.distanceTo > 700 && r.directionInfo.getTurnType().isSkipToSpeak()) || r.distanceTo > 1200) { loclanes = null; } } diff --git a/OsmAnd/src/net/osmand/plus/views/NextTurnInfoControl.java b/OsmAnd/src/net/osmand/plus/views/NextTurnInfoControl.java index a22fdfd813..42943ea1c6 100644 --- a/OsmAnd/src/net/osmand/plus/views/NextTurnInfoControl.java +++ b/OsmAnd/src/net/osmand/plus/views/NextTurnInfoControl.java @@ -75,7 +75,7 @@ public class NextTurnInfoControl extends MapInfoControl { if (!horisontalMini) { h = (int) (8 * scaleCoefficient + Math.max(textPaint.getTextSize(), subtextPaint.getTextSize())); } else { - h = (int) (6 * scaleCoefficient); + h = (int) (7 * scaleCoefficient); w = (int) textPaint.measureText(OsmAndFormatter.getFormattedDistance(nextTurnDirection, getContext())); } setWDimensions((int) width + w, (int) height + h); @@ -97,8 +97,8 @@ public class NextTurnInfoControl extends MapInfoControl { canvas.drawPath(pathForTurn, paintRouteDirection); canvas.drawPath(pathForTurn, paintBlack); if (exitOut != null && !horisontalMini) { - drawShadowText(canvas, exitOut, (getWWidth()) / 2 - 7 * scaleCoefficient, - getWHeight() / 2 - textPaint.getTextSize() / 2 + 3 * scaleCoefficient, textPaint); + drawShadowText(canvas, exitOut, width / 2 - 7 * scaleCoefficient, + height / 2 + textPaint.getTextSize() / 2 - 3 * scaleCoefficient, textPaint); } String text = OsmAndFormatter.getFormattedDistance(nextTurnDirection, getContext()); String subtext = null; @@ -119,7 +119,7 @@ public class NextTurnInfoControl extends MapInfoControl { float startX = Math.max((getWWidth() - st - mt) / 2, 2 * scaleCoefficient); drawShadowText(canvas, text, startX, getWHeight() - 3 * scaleCoefficient, textPaint); if (subtext != null) { - drawShadowText(canvas, subtext, startX + 2 * scaleCoefficient + mt, getWHeight() - 3 * scaleCoefficient, subtextPaint); + drawShadowText(canvas, subtext, startX + 2 * scaleCoefficient + mt, getWHeight() - 4 * scaleCoefficient, subtextPaint); } } else { drawShadowText(canvas, text, 72 * scaleCoefficient / miniCoeff + 2 * scaleCoefficient,