Fix restrictions for new maps

This commit is contained in:
Victor Shcherb 2011-06-30 10:33:15 +02:00
parent b0c9a426b7
commit 04cacb8f69
2 changed files with 7 additions and 7 deletions

View file

@ -118,7 +118,7 @@ public class BinaryMapDataObject {
public long getRestriction(int k){ public long getRestriction(int k){
long l = restrictions[k]; long l = restrictions[k];
return (l & ~7l) | (id & 7l); return ((l >> 3) << 1) | (id & 1l);
} }

View file

@ -379,7 +379,7 @@ public class BinaryRouteDataReader {
long ls = (((long) startX) << 31) + (long) startY; long ls = (((long) startX) << 31) + (long) startY;
loadRoutes(ctx, (startX >> (31 - ZOOM_LOAD_TILES)), (startY >> (31 - ZOOM_LOAD_TILES))); loadRoutes(ctx, (startX >> (31 - ZOOM_LOAD_TILES)), (startY >> (31 - ZOOM_LOAD_TILES)));
RouteSegment startNbs = ctx.routes.get(ls); RouteSegment startNbs = ctx.routes.get(ls);
while(startNbs != null) { // startNbs.road.id >> 3, start.road.id >> 3 while(startNbs != null) { // startNbs.road.id >> 1, start.road.id >> 1
if(startNbs.road.id != start.road.id){ if(startNbs.road.id != start.road.id){
startNbs.parentRoute = start; startNbs.parentRoute = start;
startNbs.parentSegmentEnd = start.segmentStart; startNbs.parentSegmentEnd = start.segmentStart;
@ -473,7 +473,7 @@ public class BinaryRouteDataReader {
// 3.2 calculate possible ways to put into priority queue // 3.2 calculate possible ways to put into priority queue
while(next != null){ while(next != null){
long nts = (next.road.id << 8l) + next.segmentStart; long nts = (next.road.id << 8l) + next.segmentStart;
/* next.road.id >> 3 != road.id >> 3 - used that line for debug with osm map */ /* next.road.id >> 1 != road.id >> 1 - used that line for debug with osm map */
// road.id could be equal on roundabout, but we should accept them // road.id could be equal on roundabout, but we should accept them
if(!visitedSegments.contains(nts)){ if(!visitedSegments.contains(nts)){
int type = -1; int type = -1;
@ -579,7 +579,7 @@ public class BinaryRouteDataReader {
} }
// do not add segments consists from 1 poitn // do not add segments consists from 1 poitn
if(res.startPointIndex != res.endPointIndex) { if(res.startPointIndex != res.endPointIndex) {
System.out.println("id="+(res.object.id >> 3) + " start=" + res.startPointIndex + " end=" + res.endPointIndex); System.out.println("id="+(res.object.id >> 1) + " start=" + res.startPointIndex + " end=" + res.endPointIndex);
result.add(0, res); result.add(0, res);
} }
res.startPoint = convertPoint(res.object, res.startPointIndex); res.startPoint = convertPoint(res.object, res.startPointIndex);
@ -621,7 +621,7 @@ public class BinaryRouteDataReader {
BinaryMapDataObject road = start.road; BinaryMapDataObject road = start.road;
TagValuePair pair = road.mapIndex.decodeType(road.getTypes()[0]); TagValuePair pair = road.mapIndex.decodeType(road.getTypes()[0]);
System.out.println("ROAD TO START " + pair.tag + " " + pair.value + " " + road.name + " " + start.segmentStart + " " System.out.println("ROAD TO START " + pair.tag + " " + pair.value + " " + road.name + " " + start.segmentStart + " "
+ (road.id >> 3)); + (road.id >> 1));
} }
RouteSegment end = router.findRouteSegment(elat, elon, ctx); RouteSegment end = router.findRouteSegment(elat, elon, ctx);
@ -629,7 +629,7 @@ public class BinaryRouteDataReader {
BinaryMapDataObject road = end.road; BinaryMapDataObject road = end.road;
TagValuePair pair = road.mapIndex.decodeType(road.getTypes()[0]); TagValuePair pair = road.mapIndex.decodeType(road.getTypes()[0]);
System.out.println("ROAD TO END " + pair.tag + " " + pair.value + " " + road.name + " " + end.segmentStart + " " System.out.println("ROAD TO END " + pair.tag + " " + pair.value + " " + road.name + " " + end.segmentStart + " "
+ (road.id >> 3)); + (road.id >> 1));
} }
@ -662,7 +662,7 @@ public class BinaryRouteDataReader {
// if(r.name != null){ // if(r.name != null){
// System.out.println(pair.tag + " " + pair.value + " " + r.name ); // System.out.println(pair.tag + " " + pair.value + " " + r.name );
// } else { // } else {
// System.out.println(pair.tag + " " + pair.value + " " + (r.id >> 3)); // System.out.println(pair.tag + " " + pair.value + " " + (r.id >>13));
// } // }
// } // }
} }