fix defining driving region 3 #7668
This commit is contained in:
parent
d0aaddf28c
commit
42a7a5d88d
4 changed files with 13 additions and 26 deletions
|
@ -743,19 +743,8 @@ public class OsmandRegions {
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
BinaryMapDataObject o = it.next();
|
BinaryMapDataObject o = it.next();
|
||||||
if (o.getTypes() != null) {
|
if (o.getTypes() != null) {
|
||||||
boolean isRegion = true;
|
|
||||||
for (int i = 0; i < o.getTypes().length; i++) {
|
|
||||||
TagValuePair tp = o.getMapIndex().decodeType(o.getTypes()[i]);
|
|
||||||
if (o.getTypes().length > 1) {
|
|
||||||
if ("boundary".equals(tp.value)) {
|
|
||||||
isRegion = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
WorldRegion downloadRegion = getRegionData(getFullName(o));
|
WorldRegion downloadRegion = getRegionData(getFullName(o));
|
||||||
if (!isRegion
|
if ( downloadRegion == null
|
||||||
|| downloadRegion == null
|
|
||||||
|| !downloadRegion.isRegionMapDownload()
|
|| !downloadRegion.isRegionMapDownload()
|
||||||
|| !contain(o, point31x, point31y)) {
|
|| !contain(o, point31x, point31y)) {
|
||||||
it.remove();
|
it.remove();
|
||||||
|
|
|
@ -1319,9 +1319,8 @@ public class OsmandSettings {
|
||||||
return DrivingRegion.JAPAN;
|
return DrivingRegion.JAPAN;
|
||||||
} else if (df.getCountry().equalsIgnoreCase("au")) {
|
} else if (df.getCountry().equalsIgnoreCase("au")) {
|
||||||
return DrivingRegion.AUSTRALIA;
|
return DrivingRegion.AUSTRALIA;
|
||||||
// potentially wrong in Europe
|
} else if(df.getCountry().equalsIgnoreCase(Locale.UK.getCountry())) {
|
||||||
// } else if(df.getCountry().equalsIgnoreCase(Locale.UK.getCountry())) {
|
return DrivingRegion.UK_AND_OTHERS;
|
||||||
// return DrivingRegion.UK_AND_OTHERS;
|
|
||||||
}
|
}
|
||||||
return DrivingRegion.EUROPE_ASIA;
|
return DrivingRegion.EUROPE_ASIA;
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,8 +167,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;
|
||||||
detectDrivingRegion(new LatLon(location.getLatitude(), location.getLongitude()));
|
app.getRoutingHelper().cacheStartLocation(location);
|
||||||
app.getRoutingHelper().setLastStartingLocation(location);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mapView != null) {
|
if (mapView != null) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class RoutingHelper {
|
||||||
private List<LatLon> intermediatePoints;
|
private List<LatLon> intermediatePoints;
|
||||||
private Location lastProjection;
|
private Location lastProjection;
|
||||||
private Location lastFixedLocation;
|
private Location lastFixedLocation;
|
||||||
private LatLon lastStartingLocation = null;
|
private LatLon lastStartLocation = null;
|
||||||
|
|
||||||
private static final int RECALCULATE_THRESHOLD_COUNT_CAUSING_FULL_RECALCULATE = 3;
|
private static final int RECALCULATE_THRESHOLD_COUNT_CAUSING_FULL_RECALCULATE = 3;
|
||||||
private static final int RECALCULATE_THRESHOLD_CAUSING_FULL_RECALCULATE_INTERVAL = 2*60*1000;
|
private static final int RECALCULATE_THRESHOLD_CAUSING_FULL_RECALCULATE_INTERVAL = 2*60*1000;
|
||||||
|
@ -175,7 +175,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){
|
||||||
RouteCalculationResult previousRoute = route;
|
RouteCalculationResult previousRoute = route;
|
||||||
setLastStartingLocation(currentLocation);
|
cacheStartLocation(currentLocation);
|
||||||
clearCurrentRoute(finalLocation, intermediatePoints);
|
clearCurrentRoute(finalLocation, intermediatePoints);
|
||||||
// to update route
|
// to update route
|
||||||
setCurrentLocation(currentLocation, false, previousRoute, true);
|
setCurrentLocation(currentLocation, false, previousRoute, true);
|
||||||
|
@ -262,14 +262,14 @@ public class RoutingHelper {
|
||||||
return finalLocation;
|
return finalLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastStartingLocation(Location nextStartLocation) {
|
public void cacheStartLocation(Location nextStartLocation) {
|
||||||
LatLon start = new LatLon(nextStartLocation.getLatitude(), nextStartLocation.getLongitude());
|
LatLon start = new LatLon(nextStartLocation.getLatitude(), nextStartLocation.getLongitude());
|
||||||
if (lastStartingLocation == null) {
|
if (lastStartLocation == null) {
|
||||||
lastStartingLocation = new LatLon(nextStartLocation.getLatitude(), nextStartLocation.getLongitude());
|
lastStartLocation = new LatLon(nextStartLocation.getLatitude(), nextStartLocation.getLongitude());
|
||||||
app.getMapViewTrackingUtilities().detectDrivingRegion(lastStartingLocation);
|
app.getMapViewTrackingUtilities().detectDrivingRegion(lastStartLocation);
|
||||||
} else if (MapUtils.getDistance(start, lastStartingLocation) > 100000) {
|
} else if (MapUtils.getDistance(start, lastStartLocation) > 100000) {
|
||||||
lastStartingLocation = start;
|
lastStartLocation = start;
|
||||||
app.getMapViewTrackingUtilities().detectDrivingRegion(lastStartingLocation);
|
app.getMapViewTrackingUtilities().detectDrivingRegion(lastStartLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue