Fix #5585
This commit is contained in:
parent
18a94ce119
commit
09155e72bd
1 changed files with 6 additions and 2 deletions
|
@ -884,8 +884,12 @@ public class RouteProvider {
|
|||
if(directions.size() > 0) {
|
||||
RouteDirectionInfo last = directions.get(directions.size() - 1);
|
||||
// update speed using time and idstance
|
||||
last.setAverageSpeed((distanceToEnd[last.routePointOffset] - distanceToEnd[offset])/last.getAverageSpeed());
|
||||
last.distance = (int) Math.round(distanceToEnd[last.routePointOffset] - distanceToEnd[offset]);
|
||||
if (distanceToEnd.length > last.routePointOffset && distanceToEnd.length > offset) {
|
||||
float lastDistanceToEnd = distanceToEnd[last.routePointOffset];
|
||||
float currentDistanceToEnd = distanceToEnd[offset];
|
||||
last.setAverageSpeed((lastDistanceToEnd - currentDistanceToEnd) / last.getAverageSpeed());
|
||||
last.distance = (int) Math.round(lastDistanceToEnd - currentDistanceToEnd);
|
||||
}
|
||||
}
|
||||
// save time as a speed because we don't know distance of the route segment
|
||||
float avgSpeed = time;
|
||||
|
|
Loading…
Reference in a new issue