diff --git a/OsmAnd-java/src/main/java/net/osmand/map/OsmandRegions.java b/OsmAnd-java/src/main/java/net/osmand/map/OsmandRegions.java index 2738ea17f8..7fb87d477c 100644 --- a/OsmAnd-java/src/main/java/net/osmand/map/OsmandRegions.java +++ b/OsmAnd-java/src/main/java/net/osmand/map/OsmandRegions.java @@ -743,19 +743,8 @@ public class OsmandRegions { while (it.hasNext()) { BinaryMapDataObject o = it.next(); 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)); - if (!isRegion - || downloadRegion == null + if ( downloadRegion == null || !downloadRegion.isRegionMapDownload() || !contain(o, point31x, point31y)) { it.remove(); diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 32bd59b209..0bcc44c9a8 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -1319,9 +1319,8 @@ public class OsmandSettings { return DrivingRegion.JAPAN; } else if (df.getCountry().equalsIgnoreCase("au")) { return DrivingRegion.AUSTRALIA; -// potentially wrong in Europe -// } else if(df.getCountry().equalsIgnoreCase(Locale.UK.getCountry())) { -// return DrivingRegion.UK_AND_OTHERS; + } else if(df.getCountry().equalsIgnoreCase(Locale.UK.getCountry())) { + return DrivingRegion.UK_AND_OTHERS; } return DrivingRegion.EUROPE_ASIA; } diff --git a/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java b/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java index 4e3a79e032..8df561b05d 100644 --- a/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java +++ b/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java @@ -167,8 +167,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc locationProvider = location.getProvider(); if (settings.DRIVING_REGION_AUTOMATIC.get() && !drivingRegionUpdated && !app.isApplicationInitializing()) { drivingRegionUpdated = true; - detectDrivingRegion(new LatLon(location.getLatitude(), location.getLongitude())); - app.getRoutingHelper().setLastStartingLocation(location); + app.getRoutingHelper().cacheStartLocation(location); } } if (mapView != null) { diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index e52639b2bc..0adf9194cf 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -57,7 +57,7 @@ public class RoutingHelper { private List intermediatePoints; private Location lastProjection; 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_CAUSING_FULL_RECALCULATE_INTERVAL = 2*60*1000; @@ -175,7 +175,7 @@ public class RoutingHelper { public synchronized void setFinalAndCurrentLocation(LatLon finalLocation, List intermediatePoints, Location currentLocation){ RouteCalculationResult previousRoute = route; - setLastStartingLocation(currentLocation); + cacheStartLocation(currentLocation); clearCurrentRoute(finalLocation, intermediatePoints); // to update route setCurrentLocation(currentLocation, false, previousRoute, true); @@ -262,14 +262,14 @@ public class RoutingHelper { return finalLocation; } - public void setLastStartingLocation(Location nextStartLocation) { + public void cacheStartLocation(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); + if (lastStartLocation == null) { + lastStartLocation = new LatLon(nextStartLocation.getLatitude(), nextStartLocation.getLongitude()); + app.getMapViewTrackingUtilities().detectDrivingRegion(lastStartLocation); + } else if (MapUtils.getDistance(start, lastStartLocation) > 100000) { + lastStartLocation = start; + app.getMapViewTrackingUtilities().detectDrivingRegion(lastStartLocation); } }