From 39368980a64bb9d7a798d643a830ed9bfe3d4901 Mon Sep 17 00:00:00 2001 From: Chumva Date: Wed, 3 Apr 2019 19:20:47 +0300 Subject: [PATCH] Fix #6710 --- .../measurementtool/MeasurementEditingContext.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java index 2a48ae570e..4a20ddc7e5 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java @@ -316,14 +316,17 @@ public class MeasurementEditingContext { public void onRouteCalculated(RouteCalculationResult route) { List locations = route.getRouteLocations(); ArrayList 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++;