Lefthand routes are not shown correctly in automatic mode
This commit is contained in:
parent
128c08ca7f
commit
a6adf50553
5 changed files with 21 additions and 12 deletions
|
@ -445,7 +445,7 @@ public class TargetPointsHelper {
|
||||||
Location lastKnownLocation = ctx.getLocationProvider().getLastKnownLocation();
|
Location lastKnownLocation = ctx.getLocationProvider().getLastKnownLocation();
|
||||||
LatLon latLon = lastKnownLocation != null ?
|
LatLon latLon = lastKnownLocation != null ?
|
||||||
new LatLon(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude()) : null;
|
new LatLon(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude()) : null;
|
||||||
RoutingHelperUtils.checkAndUpdateStartLocation(ctx, latLon);
|
RoutingHelperUtils.checkAndUpdateStartLocation(ctx, latLon, false);
|
||||||
setMyLocationPoint(latLon, false, null);
|
setMyLocationPoint(latLon, false, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1408,6 +1408,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
updateMapSettings();
|
updateMapSettings();
|
||||||
app.getPoiFilters().loadSelectedPoiFilters();
|
app.getPoiFilters().loadSelectedPoiFilters();
|
||||||
mapViewTrackingUtilities.updateSettings();
|
mapViewTrackingUtilities.updateSettings();
|
||||||
|
mapViewTrackingUtilities.resetDrivingRegionUpdate();
|
||||||
//app.getRoutingHelper().setAppMode(settings.getApplicationMode());
|
//app.getRoutingHelper().setAppMode(settings.getApplicationMode());
|
||||||
if (mapLayers.getMapInfoLayer() != null) {
|
if (mapLayers.getMapInfoLayer() != null) {
|
||||||
mapLayers.getMapInfoLayer().recreateControls();
|
mapLayers.getMapInfoLayer().recreateControls();
|
||||||
|
|
|
@ -13,8 +13,6 @@ import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.map.IMapLocationListener;
|
import net.osmand.map.IMapLocationListener;
|
||||||
import net.osmand.map.WorldRegion;
|
import net.osmand.map.WorldRegion;
|
||||||
import net.osmand.plus.mapmarkers.MapMarker;
|
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener;
|
|
||||||
import net.osmand.plus.OsmAndConstants;
|
import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmAndLocationProvider;
|
import net.osmand.plus.OsmAndLocationProvider;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||||
|
@ -22,10 +20,14 @@ import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||||
|
import net.osmand.plus.helpers.enums.DrivingRegion;
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
|
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
|
||||||
|
import net.osmand.plus.mapmarkers.MapMarker;
|
||||||
|
import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.routing.RoutingHelperUtils;
|
import net.osmand.plus.routing.RoutingHelperUtils;
|
||||||
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
@ -176,7 +178,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
||||||
locationProvider = location.getProvider();
|
locationProvider = location.getProvider();
|
||||||
if (settings.DRIVING_REGION_AUTOMATIC.get() && !drivingRegionUpdated && !app.isApplicationInitializing()) {
|
if (settings.DRIVING_REGION_AUTOMATIC.get() && !drivingRegionUpdated && !app.isApplicationInitializing()) {
|
||||||
drivingRegionUpdated = true;
|
drivingRegionUpdated = true;
|
||||||
RoutingHelperUtils.checkAndUpdateStartLocation(app, location);
|
RoutingHelperUtils.checkAndUpdateStartLocation(app, location, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mapView != null) {
|
if (mapView != null) {
|
||||||
|
@ -489,7 +491,15 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(WorldRegion worldRegion) {
|
protected void onPostExecute(WorldRegion worldRegion) {
|
||||||
if (worldRegion != null) {
|
if (worldRegion != null) {
|
||||||
|
DrivingRegion oldRegion = app.getSettings().DRIVING_REGION.get();
|
||||||
|
|
||||||
app.setupDrivingRegion(worldRegion);
|
app.setupDrivingRegion(worldRegion);
|
||||||
|
|
||||||
|
DrivingRegion currentRegion = app.getSettings().DRIVING_REGION.get();
|
||||||
|
if (oldRegion.leftHandDriving != currentRegion.leftHandDriving) {
|
||||||
|
ApplicationMode mode = app.getRoutingHelper().getAppMode();
|
||||||
|
app.getRoutingHelper().onSettingsChanged(mode, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ public class RoutingHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void setFinalAndCurrentLocation(LatLon finalLocation, List<LatLon> intermediatePoints, Location currentLocation) {
|
public synchronized void setFinalAndCurrentLocation(LatLon finalLocation, List<LatLon> intermediatePoints, Location currentLocation) {
|
||||||
RoutingHelperUtils.checkAndUpdateStartLocation(app, currentLocation);
|
RoutingHelperUtils.checkAndUpdateStartLocation(app, currentLocation, false);
|
||||||
RouteCalculationResult previousRoute = route;
|
RouteCalculationResult previousRoute = route;
|
||||||
clearCurrentRoute(finalLocation, intermediatePoints);
|
clearCurrentRoute(finalLocation, intermediatePoints);
|
||||||
// to update route
|
// to update route
|
||||||
|
|
|
@ -8,9 +8,6 @@ import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.QuadRect;
|
import net.osmand.data.QuadRect;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.helpers.enums.MetricsConstants;
|
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -164,19 +161,20 @@ public class RoutingHelperUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void checkAndUpdateStartLocation(@NonNull OsmandApplication app, LatLon newStartLocation) {
|
public static void checkAndUpdateStartLocation(@NonNull OsmandApplication app, LatLon newStartLocation, boolean force) {
|
||||||
if (newStartLocation != null) {
|
if (newStartLocation != null) {
|
||||||
LatLon lastStartLocation = app.getSettings().getLastStartPoint();
|
LatLon lastStartLocation = app.getSettings().getLastStartPoint();
|
||||||
if (lastStartLocation == null || MapUtils.getDistance(newStartLocation, lastStartLocation) > CACHE_RADIUS) {
|
if (lastStartLocation == null || MapUtils.getDistance(newStartLocation, lastStartLocation) > CACHE_RADIUS || force) {
|
||||||
app.getMapViewTrackingUtilities().detectDrivingRegion(newStartLocation);
|
app.getMapViewTrackingUtilities().detectDrivingRegion(newStartLocation);
|
||||||
app.getSettings().setLastStartPoint(newStartLocation);
|
app.getSettings().setLastStartPoint(newStartLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkAndUpdateStartLocation(@NonNull OsmandApplication app, Location nextStartLocation) {
|
public static void checkAndUpdateStartLocation(@NonNull OsmandApplication app, Location nextStartLocation, boolean force) {
|
||||||
if (nextStartLocation != null) {
|
if (nextStartLocation != null) {
|
||||||
checkAndUpdateStartLocation(app, new LatLon(nextStartLocation.getLatitude(), nextStartLocation.getLongitude()));
|
LatLon newStartLocation = new LatLon(nextStartLocation.getLatitude(), nextStartLocation.getLongitude());
|
||||||
|
checkAndUpdateStartLocation(app, newStartLocation, force);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue