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])) { if(args.length == 1 && "test".equals(args[0])) {
in.inspector(new String[]{ in.inspector(new String[]{
//"-vpoi", //"-vpoi",
// "-vmap", "-vmapobjects", //"-vmap", "-vmapobjects",
//"-vstreets", //"-vaddress", "-vcities", "-vstreets", "-vstreetgroups","-vbuildings",
//"-zoom=16",
//"-bbox=4,55,7,50", //"-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 { } else {
in.inspector(args); in.inspector(args);
} }

View file

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

View file

@ -106,7 +106,10 @@ public class RoutingContext {
// old planner // old planner
public FinalRouteSegment finalRouteSegment; public FinalRouteSegment finalRouteSegment;
public RoutingContext(RoutingContext cp) {
RoutingContext(RoutingContext cp) {
this.config = cp.config; this.config = cp.config;
this.map.putAll(cp.map); this.map.putAll(cp.map);
this.calculationMode = cp.calculationMode; this.calculationMode = cp.calculationMode;
@ -131,11 +134,7 @@ public class RoutingContext {
} }
} }
public RoutingContext(RoutingConfiguration config, NativeLibrary nativeLibrary, BinaryMapIndexReader[] map) { RoutingContext(RoutingConfiguration config, NativeLibrary nativeLibrary, BinaryMapIndexReader[] map, RouteCalculationMode calcMode) {
this(config, nativeLibrary, map, null);
}
public RoutingContext(RoutingConfiguration config, NativeLibrary nativeLibrary, BinaryMapIndexReader[] map, RouteCalculationMode calcMode) {
this.calculationMode = calcMode; this.calculationMode = calcMode;
for (BinaryMapIndexReader mr : map) { for (BinaryMapIndexReader mr : map) {
List<RouteRegion> rr = mr.getRoutingIndexes(); List<RouteRegion> rr = mr.getRoutingIndexes();
@ -207,6 +206,13 @@ public class RoutingContext {
config.heuristicCoefficient); 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 ) { public void registerRouteDataObject(RouteDataObject o ) {
if(!getRouter().acceptLine(o)){ if(!getRouter().acceptLine(o)){
return; return;
@ -459,8 +465,9 @@ public class RoutingContext {
} }
} }
TLongIterator it = ts.iterator(); TLongIterator it = ts.iterator();
TLongObjectHashMap<RouteDataObject> excludeDuplications = new TLongObjectHashMap<RouteDataObject>();
while(it.hasNext()){ while(it.hasNext()){
getAllObjects(it.next(), toFillIn); getAllObjects(it.next(), toFillIn, excludeDuplications);
} }
timeToFindInitialSegments += (System.nanoTime() - now); timeToFindInitialSegments += (System.nanoTime() - now);
} }
@ -573,8 +580,7 @@ public class RoutingContext {
} }
} }
private void getAllObjects(long tileId, final List<RouteDataObject> toFillIn) { private void getAllObjects(long tileId, final List<RouteDataObject> toFillIn, TLongObjectHashMap<RouteDataObject> excludeDuplications) {
TLongObjectHashMap<RouteDataObject> excludeDuplications = new TLongObjectHashMap<RouteDataObject>();
if (tileRoutes.containsKey(tileId)) { if (tileRoutes.containsKey(tileId)) {
List<RouteDataObject> routes = tileRoutes.get(tileId); List<RouteDataObject> routes = tileRoutes.get(tileId);
if (routes != null) { if (routes != null) {
@ -844,4 +850,6 @@ public class RoutingContext {
} }
} }

View file

@ -37,7 +37,7 @@ public class CurrentPositionHelper {
return; return;
} }
RoutingConfiguration cfg = RoutingConfiguration.getDefault().build(p.name().toLowerCase(), 10); 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) { private RouteDataObject runUpdateInThread(Location loc) {