Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show sensor data for recording track #20906

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ object GpxUtilities {
} else {
regularExtensions[key] = value
}
wptPt.getDeferredExtensionsToWrite()[key] = value
}
if (regularExtensions.isNotEmpty()) {
wptPt.setExtensionsWriter("extensions", createExtensionsWriter(regularExtensions, true))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import net.osmand.shared.util.KAlgorithms

open class GpxExtensions {
var extensions: MutableMap<String, String>? = null
var deferredExtensions: MutableMap<String, String>? = null
var extensionsWriters: MutableMap<String, GpxUtilities.GpxExtensionsWriter>? = null

fun getExtensionsToRead(): Map<String, String> {
Expand All @@ -18,6 +19,17 @@ open class GpxExtensions {
return extensions!!
}

fun getDeferredExtensionsToRead(): Map<String, String> {
return deferredExtensions ?: emptyMap()
}

fun getDeferredExtensionsToWrite(): MutableMap<String, String> {
if (deferredExtensions == null) {
deferredExtensions = LinkedHashMap()
}
return deferredExtensions!!
}

fun getExtensionsWritersToWrite(): MutableMap<String, GpxUtilities.GpxExtensionsWriter> {
if (extensionsWriters == null) {
extensionsWriters = LinkedHashMap()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.github.mikephil.charting.listener.OnChartGestureListener;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;

import net.osmand.plus.plugins.PluginsHelper;
import net.osmand.plus.settings.backend.preferences.CommonPreference;
import net.osmand.plus.settings.backend.preferences.ListStringPreference;
import net.osmand.shared.gpx.GpxFile;
Expand Down Expand Up @@ -174,7 +175,7 @@ private void updateAnalysis() {
if (isShowCurrentTrack()) {
GpxFile gpxFile = displayHelper.getGpx();
if (gpxFile != null && !gpxFile.isEmpty()) {
analysis = gpxFile.getAnalysis(0);
analysis = gpxFile.getAnalysis(0, null, null, PluginsHelper.getTrackPointsAnalyser());
gpxItem = GpxUiHelper.makeGpxDisplayItem(app, gpxFile, GPX, analysis);
}
} else if (getFilteredGpxFile() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ public static boolean hasTemperatureData(@NonNull GpxTrackAnalysis analysis) {
}

public static float getPointAttribute(@NonNull WptPt wptPt, @NonNull String key, float defaultValue) {
return Algorithms.parseFloatSilently(wptPt.getExtensionsToRead().get(key), defaultValue);
String value = wptPt.getDeferredExtensionsToRead().get(key);
if (Algorithms.isEmpty(value)) {
value = wptPt.getExtensionsToRead().get(key);
}
return Algorithms.parseFloatSilently(value, defaultValue);
}

public static void getAvailableGPXDataSetTypes(@NonNull GpxTrackAnalysis analysis, @NonNull List<GPXDataSetType[]> availableTypes) {
Expand Down
Loading