Fix display zoom out to the full route

This commit is contained in:
Victor Shcherb 2014-12-06 00:38:27 +01:00
parent c900b6d37f
commit ab5d5deeb1
2 changed files with 10 additions and 10 deletions

View file

@ -297,6 +297,9 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
if(newRoute && rh.isRoutePlanningMode() && mapView != null) { if(newRoute && rh.isRoutePlanningMode() && mapView != null) {
RotatedTileBox rt = mapView.getCurrentRotatedTileBox(); RotatedTileBox rt = mapView.getCurrentRotatedTileBox();
Location lt = rh.getLastProjection(); Location lt = rh.getLastProjection();
if(lt == null) {
lt = app.getTargetPointsHelper().getPointToStartLocation();
}
if(lt != null) { if(lt != null) {
double left = lt.getLongitude(), right = lt.getLongitude(); double left = lt.getLongitude(), right = lt.getLongitude();
double top = lt.getLatitude(), bottom = lt.getLatitude(); double top = lt.getLatitude(), bottom = lt.getLatitude();

View file

@ -544,8 +544,8 @@ public class RoutingHelper {
return false; return false;
} }
private void setNewRoute(RouteCalculationResult res, Location start){ private void setNewRoute(RouteCalculationResult prevRoute, RouteCalculationResult res, Location start){
final boolean newRoute = !this.route.isCalculated(); final boolean newRoute = !prevRoute.isCalculated();
if (isFollowingMode) { if (isFollowingMode) {
if(lastFixedLocation != null) { if(lastFixedLocation != null) {
start = lastFixedLocation; start = lastFixedLocation;
@ -574,8 +574,7 @@ public class RoutingHelper {
if (!wrongMovementDirection || newRoute) { if (!wrongMovementDirection || newRoute) {
voiceRouter.newRouteIsCalculated(newRoute); voiceRouter.newRouteIsCalculated(newRoute);
} }
} }
app.getWaypointHelper().setNewRoute(res);
app.runInUIThread(new Runnable() { app.runInUIThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -584,7 +583,7 @@ public class RoutingHelper {
} }
} }
}); });
app.getWaypointHelper().setNewRoute(res);
} }
public int getLeftDistance(){ public int getLeftDistance(){
@ -737,7 +736,7 @@ public class RoutingHelper {
res = provider.recalculatePartOfflineRoute(res, params); res = provider.recalculatePartOfflineRoute(res, params);
} }
} }
RouteCalculationResult prev = route;
synchronized (RoutingHelper.this) { synchronized (RoutingHelper.this) {
if (res.isCalculated()) { if (res.isCalculated()) {
route = res; route = res;
@ -748,10 +747,8 @@ public class RoutingHelper {
currentRunningJob = null; currentRunningJob = null;
} }
if(res.isCalculated()){ if(res.isCalculated()){
setNewRoute(res, params.start); setNewRoute(prev, res, params.start);
}
if (res.isCalculated()) {
String msg = app.getString(R.string.new_route_calculated_dist) + ": " + String msg = app.getString(R.string.new_route_calculated_dist) + ": " +
OsmAndFormatter.getFormattedDistance(res.getWholeDistance(), app); OsmAndFormatter.getFormattedDistance(res.getWholeDistance(), app);
if (res.getRoutingTime() != 0f) { if (res.getRoutingTime() != 0f) {