Update route from current location

This commit is contained in:
vshcherb 2014-03-30 19:25:32 +02:00
parent fb87f9093c
commit e6580e8829
4 changed files with 5 additions and 17 deletions

View file

@ -5,15 +5,6 @@
android:orientation="vertical" >
<!-- <LinearLayout
android:id="@+id/TopBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal" /> -->
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"

View file

@ -143,9 +143,8 @@ public class TargetPointsHelper {
public void updateRoutingHelper() {
LatLon start = settings.getPointToStart();
if((routingHelper.isFollowingMode() && routingHelper.getLastProjection() != null) || start == null) {
Location lastKnownLocation = ctx.getLocationProvider().getLastKnownLocation();
//Location lastKnownLocation = routingHelper.getLastProjection();
Location lastKnownLocation = ctx.getLocationProvider().getLastKnownLocation();
if((routingHelper.isFollowingMode() && lastKnownLocation != null) || start == null) {
routingHelper.setFinalAndCurrentLocation(settings.getPointToNavigate(),
settings.getIntermediatePoints(), lastKnownLocation, routingHelper.getCurrentGPXRoute());
} else {

View file

@ -468,9 +468,7 @@ public class MapActivityActions implements DialogProvider {
loc = ps.get(0);
tg.setStartPoint(new LatLon(loc.getLatitude(), loc.getLongitude()), false, null);
}
tg.updateRoutingHelper();
}
}
}
@ -515,9 +513,8 @@ public class MapActivityActions implements DialogProvider {
targets.setStartPoint(from, false, fromName);
// then set gpx
setGPXRouteParams(gpxFile);
if(from != null) {
targets.updateRoutingHelper();
}
// then update start and destination point
targets.updateRoutingHelper();
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
mapActivity.getMapView().refreshMap(true);

View file

@ -306,6 +306,7 @@ public class MapRoutePreferencesControl extends MapControls {
@Override
public boolean processResult(GPXFile result) {
mapActivity.getMapActions().setGPXRouteParams(result);
mapActivity.getMyApplication().getTargetPointsHelper().updateRoutingHelper();
updateSpinnerItems(gpxSpinner);
updateParameters();
mapActivity.getRoutingHelper().recalculateRouteDueToSettingsChange();