commit
02ef36cff4
3 changed files with 54 additions and 51 deletions
|
@ -213,7 +213,11 @@ public class RoutePlannerFrontEnd {
|
|||
|
||||
private List<RouteSegmentResult> searchRoute(final RoutingContext ctx, List<RouteSegment> points, PrecalculatedRouteDirection routeDirection)
|
||||
throws IOException, InterruptedException {
|
||||
if(points.size() > 2) {
|
||||
if (points.size() <= 2) {
|
||||
ctx.previouslyCalculatedRoute = null;
|
||||
return searchRoute(ctx, points.get(0), points.get(1), routeDirection);
|
||||
}
|
||||
|
||||
ArrayList<RouteSegmentResult> firstPartRecalculatedRoute = null;
|
||||
ArrayList<RouteSegmentResult> restPartRecalculatedRoute = null;
|
||||
if (ctx.previouslyCalculatedRoute != null) {
|
||||
|
@ -225,8 +229,8 @@ public class RoutePlannerFrontEnd {
|
|||
if (id == rsr.getObject().getId() && ss == rsr.getEndPointIndex()) {
|
||||
firstPartRecalculatedRoute = new ArrayList<RouteSegmentResult>(i + 1);
|
||||
restPartRecalculatedRoute = new ArrayList<RouteSegmentResult>(prev.size() - i);
|
||||
for(int k = 0; k < prev.size(); k++) {
|
||||
if(k <= i) {
|
||||
for (int k = 0; k < prev.size(); k++) {
|
||||
if (k <= i) {
|
||||
firstPartRecalculatedRoute.add(prev.get(k));
|
||||
} else {
|
||||
restPartRecalculatedRoute.add(prev.get(k));
|
||||
|
@ -239,8 +243,8 @@ public class RoutePlannerFrontEnd {
|
|||
List<RouteSegmentResult> results = new ArrayList<RouteSegmentResult>();
|
||||
for (int i = 0; i < points.size() - 1; i++) {
|
||||
RoutingContext local = new RoutingContext(ctx);
|
||||
if(i == 0) {
|
||||
local.previouslyCalculatedRoute = firstPartRecalculatedRoute;
|
||||
if (i == 0) {
|
||||
//local.previouslyCalculatedRoute = firstPartRecalculatedRoute;
|
||||
}
|
||||
local.visitor = ctx.visitor;
|
||||
local.calculationProgress = ctx.calculationProgress;
|
||||
|
@ -258,15 +262,14 @@ public class RoutePlannerFrontEnd {
|
|||
ctx.routingTime += local.routingTime;
|
||||
|
||||
local.unloadAllData(ctx);
|
||||
if(restPartRecalculatedRoute != null) {
|
||||
if (restPartRecalculatedRoute != null) {
|
||||
results.addAll(restPartRecalculatedRoute);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ctx.unloadAllData();
|
||||
return results;
|
||||
}
|
||||
return searchRoute(ctx, points.get(0), points.get(1), routeDirection);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
|
|
|
@ -437,7 +437,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
}
|
||||
};
|
||||
if (info.gpx != null) {
|
||||
if(info.gpx != null){
|
||||
if (info.file == null){
|
||||
GpxSelectionHelper.SelectedGpxFile selectedGpxFile = selectedGpxHelper.getSelectedCurrentRecordingTrack();
|
||||
if (selectedGpxFile != null && selectedGpxFile.getGpxFile() == info.gpx){
|
||||
|
|
|
@ -670,7 +670,7 @@ public class RouteProvider {
|
|||
ctx.calculationProgress = params.calculationProgress;
|
||||
if(params.previousToRecalculate != null) {
|
||||
// not used any more
|
||||
// ctx.previouslyCalculatedRoute = params.previousToRecalculate.getOriginalRoute();
|
||||
ctx.previouslyCalculatedRoute = params.previousToRecalculate.getOriginalRoute();
|
||||
}
|
||||
LatLon st = new LatLon(params.start.getLatitude(), params.start.getLongitude());
|
||||
LatLon en = new LatLon(params.end.getLatitude(), params.end.getLongitude());
|
||||
|
|
Loading…
Reference in a new issue