Recalculate avoid roads after maps downloaded

This commit is contained in:
Vitaliy 2020-02-18 18:56:24 +02:00
parent f429cd69ab
commit 7de0a92ca6
2 changed files with 10 additions and 4 deletions

View file

@ -118,6 +118,7 @@ public class DownloadIndexesThread {
if (app.getDownloadService() != null) {
app.getDownloadService().stopService(app);
}
app.getAvoidSpecificRoads().initRouteObjects(true);
}
public void initSettingsFirstMap(WorldRegion reg) {

View file

@ -66,12 +66,17 @@ public class AvoidSpecificRoads {
public void initRouteObjects(boolean force) {
for (Map.Entry<LatLon, AvoidRoadInfo> entry : impassableRoads.entrySet()) {
AvoidRoadInfo roadInfo = entry.getValue();
if (roadInfo.id != 0) {
for (RoutingConfiguration.Builder builder : app.getAllRoutingConfigs()) {
if (force) {
builder.removeImpassableRoad(roadInfo.id);
} else {
builder.addImpassableRoad(roadInfo.id);
}
}
}
if (force || roadInfo.id == 0) {
addImpassableRoad(null, entry.getKey(), false, true, roadInfo.appModeKey);
} else {
for (RoutingConfiguration.Builder builder : app.getAllRoutingConfigs()) {
builder.addImpassableRoad(roadInfo.id);
}
}
}
}