Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-04-01 01:25:26 +02:00
commit e2b0c836f4
3 changed files with 12 additions and 13 deletions

View file

@ -146,11 +146,11 @@ public class TargetPointsHelper {
Location lastKnownLocation = ctx.getLocationProvider().getLastKnownLocation();
if((routingHelper.isFollowingMode() && lastKnownLocation != null) || start == null) {
routingHelper.setFinalAndCurrentLocation(settings.getPointToNavigate(),
settings.getIntermediatePoints(), lastKnownLocation, routingHelper.getCurrentGPXRoute());
settings.getIntermediatePoints(), lastKnownLocation);
} else {
Location loc = wrap(start);
routingHelper.setFinalAndCurrentLocation(settings.getPointToNavigate(),
settings.getIntermediatePoints(), loc, routingHelper.getCurrentGPXRoute());
settings.getIntermediatePoints(), loc);
}
}

View file

@ -834,8 +834,7 @@ public class MapActivityActions implements DialogProvider {
if(getMyApplication().getLocationProvider().getLocationSimulation().isRouteAnimating()) {
getMyApplication().getLocationProvider().getLocationSimulation().startStopRouteAnimation(mapActivity);
}
routingHelper.setFinalAndCurrentLocation(null, new ArrayList<LatLon>(), getLastKnownLocation(),
routingHelper.getCurrentGPXRoute());
routingHelper.clearCurrentRoute(null, new ArrayList<LatLon>());
routingHelper.setRoutePlanningMode(false);
settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get());
mapActivity.updateApplicationModeSettings();

View file

@ -116,14 +116,11 @@ public class RoutingHelper {
public synchronized void setFinalAndCurrentLocation(LatLon finalLocation, List<LatLon> intermediatePoints, Location currentLocation,
GPXRouteParamsBuilder gpxRoute){
public synchronized void setFinalAndCurrentLocation(LatLon finalLocation, List<LatLon> intermediatePoints, Location currentLocation){
RouteCalculationResult previousRoute = route;
clearCurrentRoute(finalLocation, intermediatePoints);
setGpxParams(gpxRoute);
// to update route
setCurrentLocation(currentLocation, false);
setCurrentLocation(currentLocation, false, previousRoute);
}
public synchronized void clearCurrentRoute(LatLon newFinalLocation, List<LatLon> newIntermediatePoints) {
@ -210,8 +207,11 @@ public class RoutingHelper {
}
}
public Location setCurrentLocation(Location currentLocation, boolean returnUpdatedLocation) {
return setCurrentLocation(currentLocation, returnUpdatedLocation, route);
}
public Location setCurrentLocation(Location currentLocation, boolean returnUpdatedLocation ) {
private Location setCurrentLocation(Location currentLocation, boolean returnUpdatedLocation, RouteCalculationResult previousRoute) {
Location locationProjection = currentLocation;
if (finalLocation == null || currentLocation == null) {
makeUturnWhenPossible = false;
@ -286,8 +286,8 @@ public class RoutingHelper {
}
if (calculateRoute) {
recalculateRouteInBackground(false, currentLocation, finalLocation, intermediatePoints, currentGPXRoute, route.isCalculated() ? route
: null);
recalculateRouteInBackground(false, currentLocation, finalLocation, intermediatePoints, currentGPXRoute,
previousRoute.isCalculated() ? previousRoute : null);
}
double projectDist = mode.hasFastSpeed() ? posTolerance : posTolerance / 2;
if(returnUpdatedLocation && locationProjection != null && currentLocation.distanceTo(locationProjection) < projectDist) {