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(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);
}
}
}

View file

@ -510,7 +510,7 @@ public class MapInfoLayer extends OsmandMapLayer {
boolean visible = false;
if (routeLayer != null && routingHelper.isRouteCalculated() && routingHelper.isFollowingMode()) {
boolean uturnWhenPossible = routingHelper.makeUturnWhenPossible() ;
NextDirectionInfo r = routingHelper.getNextRouteDirectionInfo(calc1, false);
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;
}
}

View file

@ -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,