Temporary commit

This commit is contained in:
Victor Shcherb 2012-07-03 19:27:42 +02:00
parent 023576b6a1
commit 3bd9dc1b61
2 changed files with 74 additions and 2 deletions

View file

@ -108,6 +108,12 @@ public class RouteCalculationResult {
if(turn != null) {
RouteDirectionInfo info = new RouteDirectionInfo(s.getSegmentSpeed(), turn);
if(routeInd + 1< list.size()) {
RouteSegmentResult next = list.get(routeInd);
info.setRef(next.getObject().getRef());
info.setStreetName(next.getObject().getName());
}
String description = toString(turn, ctx);
info.setDescriptionRoute(description);
info.routePointOffset = prevLocationSize;
@ -448,7 +454,7 @@ public class RouteCalculationResult {
}
public List<RouteDirectionInfo> getDirections() {
return directions ;
return directions;
}
@ -459,6 +465,22 @@ public class RouteCalculationResult {
return Collections.emptyList();
}
public RouteSegmentResult getCurrentSegmentResult() {
int cs = currentRoute > 0 ? currentRoute - 1 : 0;
if(cs < segments.size()) {
return segments.get(cs);
}
return null;
}
public float getCurrentMaxSpeed() {
RouteSegmentResult res = getCurrentSegmentResult();
if(res != null) {
return res.getObject().getMaximumSpeed();
}
return 0;
}
public int[] getListDistance() {
return listDistance;

View file

@ -164,6 +164,7 @@ public class MapInfoLayer extends OsmandMapLayer {
leftStack.addStackView(createNextInfoControl());
leftStack.addStackView(createMiniMapControl());
leftStack.addStackView(createNextNextInfoControl());
// leftStack.addStackView(createAlarmInfoControl());
// 2. Preparations
Rect topRectPadding = new Rect();
@ -548,6 +549,55 @@ public class MapInfoLayer extends OsmandMapLayer {
return nextTurnInfo;
}
private NextTurnInfoControl createAlarmInfoControl() {
final RoutingHelper routingHelper = routeLayer.getHelper();
final NextTurnInfoControl nextTurnInfo = new NextTurnInfoControl(map, paintSmallText, paintSmallSubText, true) {
@Override
public boolean updateInfo() {
boolean visible = false;
if (routeLayer != null && routingHelper.isRouterEnabled() && routingHelper.isFollowingMode()) {
boolean uturnWhenPossible = routingHelper.makeUturnWhenPossible();
int d;
if(uturnWhenPossible) {
d = routingHelper.getDistanceToNextRouteDirection() ;
} else {
d = routingHelper.getDistanceToNextNextRouteDirection();
}
if (d >= 0 && !showMiniMap) {
visible = true;
RouteDirectionInfo next = uturnWhenPossible? routingHelper.getNextRouteDirectionInfo() :
routingHelper.getNextNextRouteDirectionInfo();
if (next == null) {
if (turnType != null) {
turnType = null;
invalidate();
}
} else if (!Algoritms.objectEquals(turnType, next.getTurnType())) {
turnType = next.getTurnType();
TurnPathHelper.calcTurnPath(pathForTurn, turnType, pathTransform);
invalidate();
}
if (distChanged(d, nextTurnDirection)) {
invalidate();
nextTurnDirection = d;
}
int imminent = uturnWhenPossible? routingHelper.getNextTurnImminent() : routingHelper.getNextNextTurnImminent();
if (turnImminent != imminent) {
turnImminent = imminent;
invalidate();
}
}
}
updateVisibility(visible);
return true;
}
};
// initial state
// nextTurnInfo.setVisibility(View.GONE);
return nextTurnInfo;
}
private NextTurnInfoControl createNextInfoControl() {
final RoutingHelper routingHelper = routeLayer.getHelper();
final NextTurnInfoControl nextTurnInfo = new NextTurnInfoControl(map, paintText, paintSubText, false) {