Fix osm live restrictions

This commit is contained in:
Victor Shcherb 2016-04-27 00:10:12 +02:00
parent d3244224ee
commit b2fe950755

View file

@ -326,8 +326,12 @@ public class RoutingContext {
if(excludeNotAllowed != null && !excludeNotAllowed.contains(ro.getId())) { if(excludeNotAllowed != null && !excludeNotAllowed.contains(ro.getId())) {
ts.add(ro); ts.add(ro);
} }
} else if(excludeNotAllowed != null){ } else if(excludeNotAllowed != null && ro.getId() > 0){
excludeNotAllowed.add(ro.getId()); excludeNotAllowed.add(ro.getId());
if(ts.excludedIds == null ){
ts.excludedIds = new TLongHashSet();
}
ts.excludedIds.add(ro.getId());
} }
} }
} }
@ -506,10 +510,22 @@ public class RoutingContext {
} }
List<RoutingSubregionTile> subregions = indexedSubregions.get(tileId); List<RoutingSubregionTile> subregions = indexedSubregions.get(tileId);
if (subregions != null) { if (subregions != null) {
TLongHashSet duplicates = new TLongHashSet(); boolean load = false;
for (RoutingSubregionTile ts : subregions) { for (RoutingSubregionTile ts : subregions) {
if (!ts.isLoaded()) { if (!ts.isLoaded()) {
loadSubregionTile(ts, loadOptions == OPTION_IN_MEMORY_LOAD, null, duplicates); load = true;
}
}
if (load) {
TLongHashSet excludeIds = new TLongHashSet();
for (RoutingSubregionTile ts : subregions) {
if (!ts.isLoaded()) {
loadSubregionTile(ts, loadOptions == OPTION_IN_MEMORY_LOAD, null, excludeIds);
} else {
if(ts.excludedIds != null) {
excludeIds.addAll(ts.excludedIds);
}
}
} }
} }
} }
@ -628,6 +644,7 @@ public class RoutingContext {
private NativeRouteSearchResult searchResult = null; private NativeRouteSearchResult searchResult = null;
private int isLoaded = 0; private int isLoaded = 0;
private TLongObjectMap<RouteSegment> routes = null; private TLongObjectMap<RouteSegment> routes = null;
private TLongHashSet excludedIds = null;
public RoutingSubregionTile(RouteSubregion subregion) { public RoutingSubregionTile(RouteSubregion subregion) {
this.subregion = subregion; this.subregion = subregion;
@ -738,6 +755,7 @@ public class RoutingContext {
} }
searchResult = null; searchResult = null;
routes = null; routes = null;
excludedIds = null;
} }
public void setLoadedNonNative(){ public void setLoadedNonNative(){