From 53f21ba8ff168a7864b5511ba0582e7cb2957fb6 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Fri, 4 Sep 2020 17:11:49 +0300 Subject: [PATCH] Fix elevation of exported gpx files --- .../main/java/net/osmand/router/RouteExporter.java | 6 ------ .../measurementtool/MeasurementEditingContext.java | 11 +++++++++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteExporter.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteExporter.java index 1ae0568bcb..7ae47d4098 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteExporter.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteExporter.java @@ -1,7 +1,5 @@ package net.osmand.router; -import net.osmand.GPXUtilities; -import net.osmand.GPXUtilities.GPXExtensionsWriter; import net.osmand.GPXUtilities.GPXFile; import net.osmand.GPXUtilities.RouteSegment; import net.osmand.GPXUtilities.RouteType; @@ -12,12 +10,8 @@ import net.osmand.Location; import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule; import net.osmand.binary.RouteDataBundle; import net.osmand.binary.StringBundle; -import net.osmand.binary.StringBundleWriter; -import net.osmand.binary.StringBundleXmlWriter; import net.osmand.util.Algorithms; -import org.xmlpull.v1.XmlSerializer; - import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java index 39a5bca3ce..88ec9f7975 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java @@ -731,8 +731,15 @@ public class MeasurementEditingContext { Pair pair = new Pair<>(before.points.get(i), before.points.get(i + 1)); RoadSegmentData data = this.roadSegmentData.get(pair); if (data != null) { - LocationsHolder locationsHolder = new LocationsHolder(data.points); - locations.addAll(locationsHolder.getLocationsList()); + for (WptPt pt : data.points) { + Location l = new Location(""); + l.setLatitude(pt.getLatitude()); + l.setLongitude(pt.getLongitude()); + if (!Double.isNaN(pt.ele)) { + l.setAltitude(pt.ele); + } + locations.add(l); + } pair.second.setTrkPtIndex(locations.size() - 1); if (i < size - 2) { locations.remove(locations.size() - 1);