Add iterations info to progress

This commit is contained in:
Victor Shcherb 2018-05-29 23:04:00 +02:00
parent 6ad69050a6
commit 8bd56274b1
2 changed files with 6 additions and 0 deletions

View file

@ -15,6 +15,9 @@ public class RouteCalculationProgress {
public int loadedTiles = 0; public int loadedTiles = 0;
public int visitedSegments = 0; public int visitedSegments = 0;
public int totalIterations = 1;
public int iteration = 1;
public boolean isCancelled; public boolean isCancelled;
public boolean requestPrivateAccessRouting; public boolean requestPrivateAccessRouting;
} }

View file

@ -158,6 +158,8 @@ public class RoutePlannerFrontEnd {
} }
if (ctx.calculationMode == RouteCalculationMode.COMPLEX && routeDirection == null if (ctx.calculationMode == RouteCalculationMode.COMPLEX && routeDirection == null
&& maxDistance > ctx.config.DEVIATION_RADIUS * 6) { && maxDistance > ctx.config.DEVIATION_RADIUS * 6) {
ctx.calculationProgress.totalIterations++;
ctx.calculationProgress.iteration++;
RoutingContext nctx = buildRoutingContext(ctx.config, ctx.nativeLib, ctx.getMaps(), RouteCalculationMode.BASE); RoutingContext nctx = buildRoutingContext(ctx.config, ctx.nativeLib, ctx.getMaps(), RouteCalculationMode.BASE);
nctx.calculationProgress = ctx.calculationProgress; nctx.calculationProgress = ctx.calculationProgress;
List<RouteSegmentResult> ls = searchRoute(nctx, start, end, intermediates); List<RouteSegmentResult> ls = searchRoute(nctx, start, end, intermediates);
@ -197,6 +199,7 @@ public class RoutePlannerFrontEnd {
if (!addSegment(end, ctx, indexNotFound++, points)) { if (!addSegment(end, ctx, indexNotFound++, points)) {
return null; return null;
} }
ctx.calculationProgress.iteration++;
List<RouteSegmentResult> res = searchRoute(ctx, points, routeDirection); List<RouteSegmentResult> res = searchRoute(ctx, points, routeDirection);
// make start and end more precise // make start and end more precise
makeStartEndPointsPrecise(res, start, end, intermediates); makeStartEndPointsPrecise(res, start, end, intermediates);