Fix #6710
This commit is contained in:
parent
1555b34ec4
commit
39368980a6
1 changed files with 7 additions and 4 deletions
|
@ -316,14 +316,17 @@ public class MeasurementEditingContext {
|
||||||
public void onRouteCalculated(RouteCalculationResult route) {
|
public void onRouteCalculated(RouteCalculationResult route) {
|
||||||
List<Location> locations = route.getRouteLocations();
|
List<Location> locations = route.getRouteLocations();
|
||||||
ArrayList<WptPt> pts = new ArrayList<>(locations.size());
|
ArrayList<WptPt> pts = new ArrayList<>(locations.size());
|
||||||
|
double prevAltitude = Double.NaN;
|
||||||
for (Location loc : locations) {
|
for (Location loc : locations) {
|
||||||
if(!loc.hasAltitude()){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
WptPt pt = new WptPt();
|
WptPt pt = new WptPt();
|
||||||
pt.lat = loc.getLatitude();
|
pt.lat = loc.getLatitude();
|
||||||
pt.lon = loc.getLongitude();
|
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);
|
pts.add(pt);
|
||||||
}
|
}
|
||||||
calculatedPairs++;
|
calculatedPairs++;
|
||||||
|
|
Loading…
Reference in a new issue