Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-02-21 01:07:24 +01:00
commit e596b1f108
4 changed files with 27 additions and 18 deletions

View file

@ -57,10 +57,13 @@ public class BinaryInspector {
if(args.length == 1 && "test".equals(args[0])) {
in.inspector(new String[]{
//"-vpoi",
// "-vmap", "-vmapobjects",
//"-vstreets",
//"-vmap", "-vmapobjects",
//"-vaddress", "-vcities", "-vstreets", "-vstreetgroups","-vbuildings",
//"-zoom=16",
//"-bbox=4,55,7,50",
"/home/victor/projects/osmand/osm-gen/Map.obf"});
//"/home/victor/osmand/Test.obf"
//"/home/victor/projects/osmand/osm-gen/Map.obf"
});
} else {
in.inspector(args);
}

View file

@ -156,10 +156,7 @@ public class RoutePlannerFrontEnd {
private List<RouteSegmentResult> searchRouteInternalPrepare(final RoutingContext ctx, RouteSegment start, RouteSegment end,
PrecalculatedRouteDirection routeDirection) throws IOException, InterruptedException {
ctx.targetX = end.road.getPoint31XTile(end.getSegmentStart());
ctx.targetY = end.road.getPoint31YTile(end.getSegmentStart());
ctx.startX = start.road.getPoint31XTile(start.getSegmentStart());
ctx.startY = start.road.getPoint31YTile(start.getSegmentStart());
ctx.initStartAndTargetPoints(start, end);
if(routeDirection != null) {
ctx.precalculatedRouteDirection = routeDirection.adopt(ctx);
}
@ -178,6 +175,7 @@ public class RoutePlannerFrontEnd {
}
}
private void refreshProgressDistance(RoutingContext ctx) {
if(ctx.calculationProgress != null) {
ctx.calculationProgress.distanceFromBegin = 0;

View file

@ -78,7 +78,7 @@ public class RoutingContext {
// 3. Warm object caches
ArrayList<RouteSegment> segmentsToVisitPrescripted = new ArrayList<BinaryRoutePlanner.RouteSegment>(5);
ArrayList<RouteSegment> segmentsToVisitNotForbidden = new ArrayList<BinaryRoutePlanner.RouteSegment>(5);
// 5. debug information (package accessor)
public TileStatistics global = new TileStatistics();
@ -106,7 +106,10 @@ public class RoutingContext {
// old planner
public FinalRouteSegment finalRouteSegment;
public RoutingContext(RoutingContext cp) {
RoutingContext(RoutingContext cp) {
this.config = cp.config;
this.map.putAll(cp.map);
this.calculationMode = cp.calculationMode;
@ -131,11 +134,7 @@ public class RoutingContext {
}
}
public RoutingContext(RoutingConfiguration config, NativeLibrary nativeLibrary, BinaryMapIndexReader[] map) {
this(config, nativeLibrary, map, null);
}
public RoutingContext(RoutingConfiguration config, NativeLibrary nativeLibrary, BinaryMapIndexReader[] map, RouteCalculationMode calcMode) {
RoutingContext(RoutingConfiguration config, NativeLibrary nativeLibrary, BinaryMapIndexReader[] map, RouteCalculationMode calcMode) {
this.calculationMode = calcMode;
for (BinaryMapIndexReader mr : map) {
List<RouteRegion> rr = mr.getRoutingIndexes();
@ -207,6 +206,13 @@ public class RoutingContext {
config.heuristicCoefficient);
}
public void initStartAndTargetPoints(RouteSegment start, RouteSegment end) {
targetX = end.road.getPoint31XTile(end.getSegmentStart());
targetY = end.road.getPoint31YTile(end.getSegmentStart());
startX = start.road.getPoint31XTile(start.getSegmentStart());
startY = start.road.getPoint31YTile(start.getSegmentStart());
}
public void registerRouteDataObject(RouteDataObject o ) {
if(!getRouter().acceptLine(o)){
return;
@ -459,8 +465,9 @@ public class RoutingContext {
}
}
TLongIterator it = ts.iterator();
TLongObjectHashMap<RouteDataObject> excludeDuplications = new TLongObjectHashMap<RouteDataObject>();
while(it.hasNext()){
getAllObjects(it.next(), toFillIn);
getAllObjects(it.next(), toFillIn, excludeDuplications);
}
timeToFindInitialSegments += (System.nanoTime() - now);
}
@ -573,8 +580,7 @@ public class RoutingContext {
}
}
private void getAllObjects(long tileId, final List<RouteDataObject> toFillIn) {
TLongObjectHashMap<RouteDataObject> excludeDuplications = new TLongObjectHashMap<RouteDataObject>();
private void getAllObjects(long tileId, final List<RouteDataObject> toFillIn, TLongObjectHashMap<RouteDataObject> excludeDuplications) {
if (tileRoutes.containsKey(tileId)) {
List<RouteDataObject> routes = tileRoutes.get(tileId);
if (routes != null) {
@ -843,5 +849,7 @@ public class RoutingContext {
return map.keySet().toArray(new BinaryMapIndexReader[map.size()]);
}
}

View file

@ -37,7 +37,7 @@ public class CurrentPositionHelper {
return;
}
RoutingConfiguration cfg = RoutingConfiguration.getDefault().build(p.name().toLowerCase(), 10);
ctx = new RoutingContext(cfg, null, app.getTodoAPI().getRoutingMapFiles());
ctx = new RoutePlannerFrontEnd(false).buildRoutingContext(cfg, null, app.getTodoAPI().getRoutingMapFiles());
}
private RouteDataObject runUpdateInThread(Location loc) {