diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 2ad1935d38..846a39be8c 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -2911,7 +2911,7 @@ Could not calculate route Could not calculate route Calculated route is empty - New route calculated, distance + Route calculated (internal): distance %s, router time %s (%d tiles, %d segments) You have arrived at your destination Invalid coordinates Go back to OsmAnd map diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java index f8a701f034..eb84e2f0d7 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java @@ -15,6 +15,7 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.routing.AlarmInfo.AlarmInfoType; import net.osmand.router.RouteSegmentResult; +import net.osmand.router.RoutingContext; import net.osmand.router.TurnType; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; @@ -36,8 +37,12 @@ public class RouteCalculationResult { private final String errorMessage; private final int[] listDistance; private final int[] intermediatePoints; + + // Route information private final float routingTime; - + private final int visitedSegments; + private final int loadedTiles; + protected int cacheCurrentTextDirectionInfo = -1; protected List cacheAgreggatedDirections; protected List locationPoints = new ArrayList(); @@ -54,6 +59,8 @@ public class RouteCalculationResult { public RouteCalculationResult(String errorMessage) { this.errorMessage = errorMessage; this.routingTime = 0; + this.loadedTiles = 0; + this.visitedSegments = 0; this.intermediatePoints = new int[0]; this.locations = new ArrayList(); this.segments = new ArrayList(); @@ -64,6 +71,8 @@ public class RouteCalculationResult { public RouteCalculationResult(List list, List directions, RouteCalculationParams params, List waypoints, boolean addMissingTurns) { this.routingTime = 0; + this.loadedTiles = 0; + this.visitedSegments = 0; this.errorMessage = null; this.intermediatePoints = new int[params.intermediates == null ? 0 : params.intermediates.size()]; List locations = list == null ? new ArrayList() : new ArrayList(list); @@ -92,9 +101,11 @@ public class RouteCalculationResult { updateDirectionsTime(this.directions, this.listDistance); } - public RouteCalculationResult(List list, Location start, LatLon end, List intermediates, - OsmandApplication ctx, boolean leftSide, float routingTime, List waypoints, ApplicationMode mode) { - this.routingTime = routingTime; + public RouteCalculationResult(List list, Location start, LatLon end, List intermediates, + OsmandApplication ctx, boolean leftSide, RoutingContext rctx, List waypoints, ApplicationMode mode) { + this.routingTime = rctx.routingTime; + this.visitedSegments = rctx.visitedSegments; + this.loadedTiles = rctx.loadedTiles; if(waypoints != null) { this.locationPoints.addAll(waypoints); } @@ -806,8 +817,15 @@ public class RouteCalculationResult { public float getRoutingTime() { return routingTime; } - - + + public int getVisitedSegments() { + return visitedSegments; + } + + public int getLoadedTiles() { + return loadedTiles; + } + public int getWholeDistance() { if(listDistance.length > 0) { return listDistance[0]; diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java index aed0905ed9..75cacd9945 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java @@ -769,7 +769,7 @@ public class RouteProvider { return emptyResult(); } else { RouteCalculationResult res = new RouteCalculationResult(result, params.start, params.end, - params.intermediates, params.ctx, params.leftSide, ctx.routingTime, params.gpxRoute == null? null: params.gpxRoute.wpt, + params.intermediates, params.ctx, params.leftSide, ctx, params.gpxRoute == null? null: params.gpxRoute.wpt, params.mode); return res; } diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index 3979b8b45a..8fb8fa15a2 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -732,11 +732,9 @@ public class RoutingHelper { } } if (showToast.value && OsmandPlugin.isDevelopment()) { - String msg = app.getString(R.string.new_route_calculated_dist) + ": " - + OsmAndFormatter.getFormattedDistance(res.getWholeDistance(), app); - if (res.getRoutingTime() != 0f) { - msg += " (" + Algorithms.formatDuration((int) res.getRoutingTime(), app.accessibilityEnabled()) + ")"; - } + String msg = app.getString(R.string.new_route_calculated_dist_dbg, + OsmAndFormatter.getFormattedDistance(res.getWholeDistance(), app), + ((int)res.getRoutingTime()) + " sec", res.getVisitedSegments(), res.getLoadedTiles()); app.showToastMessage(msg); } }