Merge pull request #6777 from osmandapp/Fix_6710

Fix_6710
This commit is contained in:
vshcherb 2019-04-03 19:28:54 +03:00 committed by GitHub
commit 1997408377
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -316,14 +316,17 @@ public class MeasurementEditingContext {
public void onRouteCalculated(RouteCalculationResult route) {
List<Location> locations = route.getRouteLocations();
ArrayList<WptPt> pts = new ArrayList<>(locations.size());
double prevAltitude = Double.NaN;
for (Location loc : locations) {
if(!loc.hasAltitude()){
continue;
}
WptPt pt = new WptPt();
pt.lat = loc.getLatitude();
pt.lon = loc.getLongitude();
pt.ele = loc.getAltitude();
if (loc.hasAltitude()) {
prevAltitude = loc.getAltitude();
pt.ele = prevAltitude;
} else if (!Double.isNaN(prevAltitude)) {
pt.ele = prevAltitude;
}
pts.add(pt);
}
calculatedPairs++;