From bf43008364e8a06ba3f18fae4775de31daea0596 Mon Sep 17 00:00:00 2001 From: Norbert Truchsess Date: Fri, 31 Aug 2018 23:05:35 +0200 Subject: [PATCH] measurement-tool: set track and route-name to filename on gpx save --- .../osmand/plus/measurementtool/MeasurementToolFragment.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index 6d2bf5793f..fb13d613c8 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -1212,6 +1212,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment { TrkSegment after = editingCtx.getAfterTrkSegmentLine(); if (gpx == null) { toSave = new File(dir, fileName); + String trackName = fileName.substring(0,fileName.length()-GPX_SUFFIX.length()); GPXFile gpx = new GPXFile(); if (measurementLayer != null) { if (saveType == SaveType.LINE) { @@ -1223,6 +1224,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment { segment.points.addAll(points); } Track track = new Track(); + track.name = trackName; track.segments.add(segment); gpx.tracks.add(track); } else if (saveType == SaveType.ROUTE_POINT) { @@ -1231,10 +1233,12 @@ public class MeasurementToolFragment extends BaseOsmAndFragment { segment.points.addAll(before.points); segment.points.addAll(after.points); Track track = new Track(); + track.name = trackName; track.segments.add(segment); gpx.tracks.add(track); } Route rt = new Route(); + rt.name = trackName; gpx.routes.add(rt); rt.points.addAll(points); }