From 9713d04c7f5a11ba27dd6acf66c8be6c366cbbbb Mon Sep 17 00:00:00 2001 From: cepprice Date: Mon, 12 Apr 2021 16:52:32 +0500 Subject: [PATCH] Fix not renderable slope track --- .../src/net/osmand/plus/track/TrackColoringCard.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java b/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java index 9e48ca0bbe..63b69b7e1c 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java @@ -11,6 +11,7 @@ import android.widget.TextView; import com.google.android.material.snackbar.Snackbar; import net.osmand.AndroidUtils; +import net.osmand.GPXUtilities.Elevation; import net.osmand.GPXUtilities.GPXTrackAnalysis; import net.osmand.PlatformUtil; import net.osmand.plus.R; @@ -92,7 +93,15 @@ public class TrackColoringCard extends BaseCard { if (scaleType == GradientScaleType.SPEED) { return gpxTrackAnalysis.isSpeedSpecified(); } else { - return gpxTrackAnalysis.isElevationSpecified(); + if (!gpxTrackAnalysis.isElevationSpecified()) { + return false; + } + for (Elevation elevation : gpxTrackAnalysis.elevationData) { + if (Float.isNaN(elevation.elevation)) { + return false; + } + } + return true; } }