Adjustify follow status and directions to buttons

This commit is contained in:
Victor Shcherb 2012-07-15 15:20:21 +02:00
parent 6005c0a546
commit 2520b7cb59
3 changed files with 12 additions and 25 deletions

View file

@ -904,10 +904,10 @@ public class BinaryRoutePlanner {
if(tnext != null && result.get(i).getDistance() < 35) { if(tnext != null && result.get(i).getDistance() < 35) {
if(tl && TurnType.TL.equals(tnext.getValue()) ) { if(tl && TurnType.TL.equals(tnext.getValue()) ) {
next = i + 2; next = i + 2;
t = TurnType.valueOf(TurnType.TU, true); t = TurnType.valueOf(TurnType.TU, false);
} else if(tr && TurnType.TR.equals(tnext.getValue()) ) { } else if(tr && TurnType.TR.equals(tnext.getValue()) ) {
next = i + 2; next = i + 2;
t = TurnType.valueOf(TurnType.TU, false); t = TurnType.valueOf(TurnType.TU, true);
} }
} }
} }

View file

@ -510,7 +510,7 @@ public class MapInfoLayer extends OsmandMapLayer {
boolean visible = false; boolean visible = false;
if (routeLayer != null && routingHelper.isRouteCalculated() && routingHelper.isFollowingMode()) { if (routeLayer != null && routingHelper.isRouteCalculated() && routingHelper.isFollowingMode()) {
boolean uturnWhenPossible = routingHelper.makeUturnWhenPossible() ; boolean uturnWhenPossible = routingHelper.makeUturnWhenPossible() ;
NextDirectionInfo r = routingHelper.getNextRouteDirectionInfo(calc1, false); NextDirectionInfo r = routingHelper.getNextRouteDirectionInfo(calc1, true);
if (!uturnWhenPossible) { if (!uturnWhenPossible) {
if (r != null) { if (r != null) {
// next turn is very close (show next next with false to speak) // next turn is very close (show next next with false to speak)
@ -652,9 +652,8 @@ public class MapInfoLayer extends OsmandMapLayer {
@Override @Override
public boolean updateInfo() { public boolean updateInfo() {
boolean visible = false; boolean visible = false;
if (routeLayer != null && routingHelper.isRouteCalculated() ) { if (routeLayer != null && routingHelper.isRouteCalculated() && routingHelper.isFollowingMode()) {
boolean follow = routingHelper.isFollowingMode(); makeUturnWhenPossible = routingHelper.makeUturnWhenPossible() ;
makeUturnWhenPossible = routingHelper.makeUturnWhenPossible() && follow;
if (makeUturnWhenPossible) { if (makeUturnWhenPossible) {
visible = true; visible = true;
turnImminent = 1; turnImminent = 1;
@ -663,19 +662,7 @@ public class MapInfoLayer extends OsmandMapLayer {
invalidate(); invalidate();
} else { } else {
boolean showStraight = false; boolean showStraight = false;
NextDirectionInfo r = null; NextDirectionInfo r = routingHelper.getNextRouteDirectionInfo(calc1, true);
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;
}
}
if (r != null && r.distanceTo > 0) { if (r != null && r.distanceTo > 0) {
visible = true; visible = true;
if (r.directionInfo == null) { if (r.directionInfo == null) {
@ -882,7 +869,7 @@ public class MapInfoLayer extends OsmandMapLayer {
loclanes = r.directionInfo.getTurnType().getLanes(); loclanes = r.directionInfo.getTurnType().getLanes();
locimminent = r.imminent; locimminent = r.imminent;
// Do not show too far // 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; loclanes = null;
} }
} }

View file

@ -75,7 +75,7 @@ public class NextTurnInfoControl extends MapInfoControl {
if (!horisontalMini) { if (!horisontalMini) {
h = (int) (8 * scaleCoefficient + Math.max(textPaint.getTextSize(), subtextPaint.getTextSize())); h = (int) (8 * scaleCoefficient + Math.max(textPaint.getTextSize(), subtextPaint.getTextSize()));
} else { } else {
h = (int) (6 * scaleCoefficient); h = (int) (7 * scaleCoefficient);
w = (int) textPaint.measureText(OsmAndFormatter.getFormattedDistance(nextTurnDirection, getContext())); w = (int) textPaint.measureText(OsmAndFormatter.getFormattedDistance(nextTurnDirection, getContext()));
} }
setWDimensions((int) width + w, (int) height + h); setWDimensions((int) width + w, (int) height + h);
@ -97,8 +97,8 @@ public class NextTurnInfoControl extends MapInfoControl {
canvas.drawPath(pathForTurn, paintRouteDirection); canvas.drawPath(pathForTurn, paintRouteDirection);
canvas.drawPath(pathForTurn, paintBlack); canvas.drawPath(pathForTurn, paintBlack);
if (exitOut != null && !horisontalMini) { if (exitOut != null && !horisontalMini) {
drawShadowText(canvas, exitOut, (getWWidth()) / 2 - 7 * scaleCoefficient, drawShadowText(canvas, exitOut, width / 2 - 7 * scaleCoefficient,
getWHeight() / 2 - textPaint.getTextSize() / 2 + 3 * scaleCoefficient, textPaint); height / 2 + textPaint.getTextSize() / 2 - 3 * scaleCoefficient, textPaint);
} }
String text = OsmAndFormatter.getFormattedDistance(nextTurnDirection, getContext()); String text = OsmAndFormatter.getFormattedDistance(nextTurnDirection, getContext());
String subtext = null; String subtext = null;
@ -119,7 +119,7 @@ public class NextTurnInfoControl extends MapInfoControl {
float startX = Math.max((getWWidth() - st - mt) / 2, 2 * scaleCoefficient); float startX = Math.max((getWWidth() - st - mt) / 2, 2 * scaleCoefficient);
drawShadowText(canvas, text, startX, getWHeight() - 3 * scaleCoefficient, textPaint); drawShadowText(canvas, text, startX, getWHeight() - 3 * scaleCoefficient, textPaint);
if (subtext != null) { 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 { } else {
drawShadowText(canvas, text, 72 * scaleCoefficient / miniCoeff + 2 * scaleCoefficient, drawShadowText(canvas, text, 72 * scaleCoefficient / miniCoeff + 2 * scaleCoefficient,