Merge pull request #743 from Bars107/master

Fixed intermediate points dissapear bug.
This commit is contained in:
vshcherb 2014-07-11 17:40:56 +02:00
commit 0ffc20d62c

View file

@ -24,6 +24,7 @@ import net.osmand.util.MapUtils;
import android.content.Context;
public class RouteCalculationResult {
private static double distanceClosestToIntermediate = 400;
// could not be null and immodifiable!
private final List<Location> locations;
private final List<RouteDirectionInfo> directions;
@ -151,8 +152,8 @@ public class RouteCalculationResult {
double prevDistance = distanceThreshold * 4;
while((currentIntermediate < intermediates.size() || prevDistance > distanceThreshold)
&& currentLocation < locations.size()){
if(currentIntermediate < intermediates.size() &&
getDistanceToLocation(locations, intermediates.get(currentIntermediate), currentLocation) < 50) {
if(currentIntermediate < intermediates.size() &&
getDistanceToLocation(locations, intermediates.get(currentIntermediate), currentLocation) < distanceClosestToIntermediate) {
prevDistance = getDistanceToLocation(locations, intermediates.get(currentIntermediate), currentLocation);
interLocations[currentIntermediate] = currentLocation;
currentIntermediate++;