fix
This commit is contained in:
parent
b0bfbfa192
commit
59f379111a
1 changed files with 13 additions and 26 deletions
|
@ -655,39 +655,26 @@ public class RoutingContext {
|
|||
TLongObjectHashMap<RouteDataObject> excludeDuplications, RouteSegment original, List<RoutingSubregionTile> subregions, int subregionIndex) {
|
||||
access++;
|
||||
if (routes != null) {
|
||||
original = findOriginal(x31, y31, excludeDuplications, original, subregions, subregionIndex);
|
||||
} else if (searchResult != null && searchResult.objects != null && searchResult.objects.length > 0){
|
||||
RouteDataObject[] rdos = searchResult.objects;
|
||||
for (int n = 0; n < rdos.length; n++) {
|
||||
add(rdos[n]);
|
||||
long l = (((long) x31) << 31) + (long) y31;
|
||||
RouteSegment segment = routes.get(l);
|
||||
while (segment != null) {
|
||||
RouteDataObject ro = segment.road;
|
||||
RouteDataObject toCmp = excludeDuplications.get(calcRouteId(ro, segment.getSegmentStart()));
|
||||
if (!isExcluded(ro.id, subregions, subregionIndex)
|
||||
&& (toCmp == null || toCmp.getPointsLength() < ro.getPointsLength())) {
|
||||
excludeDuplications.put(calcRouteId(ro, segment.getSegmentStart()), ro);
|
||||
RouteSegment s = new RouteSegment(ro, segment.getSegmentStart());
|
||||
s.next = original;
|
||||
original = s;
|
||||
}
|
||||
segment = segment.next;
|
||||
}
|
||||
original = findOriginal(x31, y31, excludeDuplications, original, subregions, subregionIndex);
|
||||
} else {
|
||||
throw new UnsupportedOperationException("Not clear how it could be used with native");
|
||||
}
|
||||
return original;
|
||||
}
|
||||
|
||||
private RouteSegment findOriginal(int x31, int y31, TLongObjectHashMap<RouteDataObject> excludeDuplications,
|
||||
RouteSegment original, List<RoutingSubregionTile> subregions, int subregionIndex) {
|
||||
long l = (((long) x31) << 31) + (long) y31;
|
||||
|
||||
RouteSegment segment = routes.get(l);
|
||||
while (segment != null) {
|
||||
RouteDataObject ro = segment.road;
|
||||
RouteDataObject toCmp = excludeDuplications.get(calcRouteId(ro, segment.getSegmentStart()));
|
||||
if (!isExcluded(ro.id, subregions, subregionIndex)
|
||||
&& (toCmp == null || toCmp.getPointsLength() < ro.getPointsLength())) {
|
||||
excludeDuplications.put(calcRouteId(ro, segment.getSegmentStart()), ro);
|
||||
RouteSegment s = new RouteSegment(ro, segment.getSegmentStart());
|
||||
s.next = original;
|
||||
original = s;
|
||||
}
|
||||
segment = segment.next;
|
||||
}
|
||||
return original;
|
||||
}
|
||||
|
||||
private static boolean isExcluded(long id, List<RoutingSubregionTile> subregions, int subregionIndex) {
|
||||
for (int i = 0; i < subregionIndex; i++ ) {
|
||||
if (subregions.get(i).excludedIds != null && subregions.get(i).excludedIds.contains(id)) {
|
||||
|
|
Loading…
Reference in a new issue