Recalculate avoid roads after maps downloaded
This commit is contained in:
parent
f429cd69ab
commit
7de0a92ca6
2 changed files with 10 additions and 4 deletions
|
@ -118,6 +118,7 @@ public class DownloadIndexesThread {
|
||||||
if (app.getDownloadService() != null) {
|
if (app.getDownloadService() != null) {
|
||||||
app.getDownloadService().stopService(app);
|
app.getDownloadService().stopService(app);
|
||||||
}
|
}
|
||||||
|
app.getAvoidSpecificRoads().initRouteObjects(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initSettingsFirstMap(WorldRegion reg) {
|
public void initSettingsFirstMap(WorldRegion reg) {
|
||||||
|
|
|
@ -66,12 +66,17 @@ public class AvoidSpecificRoads {
|
||||||
public void initRouteObjects(boolean force) {
|
public void initRouteObjects(boolean force) {
|
||||||
for (Map.Entry<LatLon, AvoidRoadInfo> entry : impassableRoads.entrySet()) {
|
for (Map.Entry<LatLon, AvoidRoadInfo> entry : impassableRoads.entrySet()) {
|
||||||
AvoidRoadInfo roadInfo = entry.getValue();
|
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) {
|
if (force || roadInfo.id == 0) {
|
||||||
addImpassableRoad(null, entry.getKey(), false, true, roadInfo.appModeKey);
|
addImpassableRoad(null, entry.getKey(), false, true, roadInfo.appModeKey);
|
||||||
} else {
|
|
||||||
for (RoutingConfiguration.Builder builder : app.getAllRoutingConfigs()) {
|
|
||||||
builder.addImpassableRoad(roadInfo.id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue