Example #1
0
 public RouteRecalculationThread(String name, RouteCalculationParams params) {
   super(name);
   this.params = params;
   if (params.calculationProgress == null) {
     params.calculationProgress = new RouteCalculationProgress();
   }
 }
Example #2
0
 private void recalculateRouteInBackground(
     boolean force,
     final Location start,
     final LatLon end,
     final List<LatLon> intermediates,
     final GPXRouteParamsBuilder gpxRoute,
     final RouteCalculationResult previousRoute) {
   if (start == null || end == null) {
     return;
   }
   if (currentRunningJob == null) {
     // do not evaluate very often
     if (force || System.currentTimeMillis() - lastTimeEvaluatedRoute > evalWaitInterval) {
       RouteCalculationParams params = new RouteCalculationParams();
       params.start = start;
       params.end = end;
       params.intermediates = intermediates;
       params.gpxRoute = gpxRoute == null ? null : gpxRoute.build(start, settings);
       params.previousToRecalculate = previousRoute;
       params.leftSide = settings.DRIVING_REGION.get().leftHandDriving;
       params.fast = settings.FAST_ROUTE_MODE.getModeValue(mode);
       params.type = settings.ROUTER_SERVICE.getModeValue(mode);
       params.mode = mode;
       params.ctx = app;
       if (previousRoute == null && params.type == RouteService.OSMAND) {
         params.calculationProgress = new RouteCalculationProgress();
         updateProgress(params.calculationProgress);
       }
       synchronized (this) {
         currentRunningJob =
             new RouteRecalculationThread("Calculating route", params); // $NON-NLS-1$
         currentRunningJob.start();
       }
     }
   }
 }