From a5e87ebd4382b9f4c1fce85f10ea541cce0392d6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 2 Jul 2014 12:22:15 +0300 Subject: [PATCH 1/2] Fixed bug 119 in Jira. --- OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java index e48768a880..6f0b7c821a 100644 --- a/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java @@ -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){ From e1177cf3cebce4bdaa8fcc9622b8d168e26c4785 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Jul 2014 12:35:11 +0300 Subject: [PATCH 2/2] fixed bug 95 --- .../osmand/router/RoutePlannerFrontEnd.java | 101 +++++++++--------- .../osmand/plus/routing/RouteProvider.java | 2 +- 2 files changed, 53 insertions(+), 50 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/router/RoutePlannerFrontEnd.java b/OsmAnd-java/src/net/osmand/router/RoutePlannerFrontEnd.java index 8191ff5fe0..b2176a03b9 100644 --- a/OsmAnd-java/src/net/osmand/router/RoutePlannerFrontEnd.java +++ b/OsmAnd-java/src/net/osmand/router/RoutePlannerFrontEnd.java @@ -213,60 +213,63 @@ public class RoutePlannerFrontEnd { private List searchRoute(final RoutingContext ctx, List points, PrecalculatedRouteDirection routeDirection) throws IOException, InterruptedException { - if(points.size() > 2) { - ArrayList firstPartRecalculatedRoute = null; - ArrayList restPartRecalculatedRoute = null; - if (ctx.previouslyCalculatedRoute != null) { - List prev = ctx.previouslyCalculatedRoute; - long id = points.get(1).getRoad().id; - int ss = points.get(1).getSegmentStart(); - for (int i = 0; i < prev.size(); i++) { - RouteSegmentResult rsr = prev.get(i); - if (id == rsr.getObject().getId() && ss == rsr.getEndPointIndex()) { - firstPartRecalculatedRoute = new ArrayList(i + 1); - restPartRecalculatedRoute = new ArrayList(prev.size() - i); - for(int k = 0; k < prev.size(); k++) { - if(k <= i) { - firstPartRecalculatedRoute.add(prev.get(k)); - } else { - restPartRecalculatedRoute.add(prev.get(k)); - } - } - break; - } - } - } - List results = new ArrayList(); - for (int i = 0; i < points.size() - 1; i++) { - RoutingContext local = new RoutingContext(ctx); - if(i == 0) { - local.previouslyCalculatedRoute = firstPartRecalculatedRoute; - } - local.visitor = ctx.visitor; - local.calculationProgress = ctx.calculationProgress; - List res = searchRouteInternalPrepare(local, points.get(i), points.get(i + 1), routeDirection); + if (points.size() <= 2) { + ctx.previouslyCalculatedRoute = null; + return searchRoute(ctx, points.get(0), points.get(1), routeDirection); + } - results.addAll(res); - ctx.distinctLoadedTiles += local.distinctLoadedTiles; - ctx.loadedTiles += local.loadedTiles; - ctx.visitedSegments += local.visitedSegments; - ctx.loadedPrevUnloadedTiles += local.loadedPrevUnloadedTiles; - ctx.timeToCalculate += local.timeToCalculate; - ctx.timeToLoad += local.timeToLoad; - ctx.timeToLoadHeaders += local.timeToLoadHeaders; - ctx.relaxedSegments += local.relaxedSegments; - ctx.routingTime += local.routingTime; - - local.unloadAllData(ctx); - if(restPartRecalculatedRoute != null) { - results.addAll(restPartRecalculatedRoute); + ArrayList firstPartRecalculatedRoute = null; + ArrayList restPartRecalculatedRoute = null; + if (ctx.previouslyCalculatedRoute != null) { + List prev = ctx.previouslyCalculatedRoute; + long id = points.get(1).getRoad().id; + int ss = points.get(1).getSegmentStart(); + for (int i = 0; i < prev.size(); i++) { + RouteSegmentResult rsr = prev.get(i); + if (id == rsr.getObject().getId() && ss == rsr.getEndPointIndex()) { + firstPartRecalculatedRoute = new ArrayList(i + 1); + restPartRecalculatedRoute = new ArrayList(prev.size() - i); + for (int k = 0; k < prev.size(); k++) { + if (k <= i) { + firstPartRecalculatedRoute.add(prev.get(k)); + } else { + restPartRecalculatedRoute.add(prev.get(k)); + } + } break; } } - ctx.unloadAllData(); - return results; } - return searchRoute(ctx, points.get(0), points.get(1), routeDirection); + List results = new ArrayList(); + for (int i = 0; i < points.size() - 1; i++) { + RoutingContext local = new RoutingContext(ctx); + if (i == 0) { + //local.previouslyCalculatedRoute = firstPartRecalculatedRoute; + } + local.visitor = ctx.visitor; + local.calculationProgress = ctx.calculationProgress; + List res = searchRouteInternalPrepare(local, points.get(i), points.get(i + 1), routeDirection); + + results.addAll(res); + ctx.distinctLoadedTiles += local.distinctLoadedTiles; + ctx.loadedTiles += local.loadedTiles; + ctx.visitedSegments += local.visitedSegments; + ctx.loadedPrevUnloadedTiles += local.loadedPrevUnloadedTiles; + ctx.timeToCalculate += local.timeToCalculate; + ctx.timeToLoad += local.timeToLoad; + ctx.timeToLoadHeaders += local.timeToLoadHeaders; + ctx.relaxedSegments += local.relaxedSegments; + ctx.routingTime += local.routingTime; + + local.unloadAllData(ctx); + if (restPartRecalculatedRoute != null) { + results.addAll(restPartRecalculatedRoute); + break; + } + } + ctx.unloadAllData(); + return results; + } @SuppressWarnings("static-access") diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java index 28f1f7d5dc..77b1c41e29 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java @@ -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());