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