fix defining driving region #7668
This commit is contained in:
parent
9b010305b9
commit
e5ca877802
3 changed files with 19 additions and 4 deletions
|
@ -746,9 +746,11 @@ public class OsmandRegions {
|
|||
boolean isRegion = true;
|
||||
for (int i = 0; i < o.getTypes().length; i++) {
|
||||
TagValuePair tp = o.getMapIndex().decodeType(o.getTypes()[i]);
|
||||
if ("boundary".equals(tp.value)) {
|
||||
isRegion = false;
|
||||
break;
|
||||
if (o.getTypes().length > 1) {
|
||||
if ("boundary".equals(tp.value)) {
|
||||
isRegion = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
WorldRegion downloadRegion = getRegionData(getFullName(o));
|
||||
|
|
|
@ -155,7 +155,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
|||
return movingToMyLocation;
|
||||
}
|
||||
|
||||
private void detectDrivingRegion(final LatLon latLon) {
|
||||
public void detectDrivingRegion(final LatLon latLon) {
|
||||
new DetectDrivingRegionTask(app).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, latLon);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ public class RoutingHelper {
|
|||
private List<LatLon> intermediatePoints;
|
||||
private Location lastProjection;
|
||||
private Location lastFixedLocation;
|
||||
private LatLon lastStartingLocation = null;
|
||||
|
||||
private static final int RECALCULATE_THRESHOLD_COUNT_CAUSING_FULL_RECALCULATE = 3;
|
||||
private static final int RECALCULATE_THRESHOLD_CAUSING_FULL_RECALCULATE_INTERVAL = 2*60*1000;
|
||||
|
@ -174,6 +175,7 @@ public class RoutingHelper {
|
|||
|
||||
public synchronized void setFinalAndCurrentLocation(LatLon finalLocation, List<LatLon> intermediatePoints, Location currentLocation){
|
||||
RouteCalculationResult previousRoute = route;
|
||||
setLastStartingLocation(currentLocation);
|
||||
clearCurrentRoute(finalLocation, intermediatePoints);
|
||||
// to update route
|
||||
setCurrentLocation(currentLocation, false, previousRoute, true);
|
||||
|
@ -260,6 +262,17 @@ public class RoutingHelper {
|
|||
return finalLocation;
|
||||
}
|
||||
|
||||
public void setLastStartingLocation(Location nextStartLocation) {
|
||||
LatLon start = new LatLon(nextStartLocation.getLatitude(), nextStartLocation.getLongitude());
|
||||
if (lastStartingLocation == null) {
|
||||
lastStartingLocation = new LatLon(nextStartLocation.getLatitude(), nextStartLocation.getLongitude());
|
||||
app.getMapViewTrackingUtilities().detectDrivingRegion(lastStartingLocation);
|
||||
} else if (MapUtils.getDistance(start, lastStartingLocation) > 100000) {
|
||||
lastStartingLocation = start;
|
||||
app.getMapViewTrackingUtilities().detectDrivingRegion(lastStartingLocation);
|
||||
}
|
||||
}
|
||||
|
||||
public List<LatLon> getIntermediatePoints() {
|
||||
return intermediatePoints;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue