From fa08c0dbea8f12099a75c70b3d7d886719a9293c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sat, 28 Sep 2019 23:56:59 +0200 Subject: [PATCH] Properly handle files without elevation data --- src/data/graph.h | 1 + src/data/route.cpp | 1 - src/data/track.cpp | 3 +-- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/data/graph.h b/src/data/graph.h index a2be43e6..28479487 100644 --- a/src/data/graph.h +++ b/src/data/graph.h @@ -54,6 +54,7 @@ public: return false; return true; } + bool hasTime() const { for (int i = 0; i < size(); i++) { diff --git a/src/data/route.cpp b/src/data/route.cpp index b0bb5cb1..c2affe46 100644 --- a/src/data/route.cpp +++ b/src/data/route.cpp @@ -1,4 +1,3 @@ -#include "dem.h" #include "route.h" diff --git a/src/data/track.cpp b/src/data/track.cpp index 080fd789..e28e21d9 100644 --- a/src/data/track.cpp +++ b/src/data/track.cpp @@ -1,4 +1,3 @@ -#include "dem.h" #include "track.h" @@ -177,7 +176,7 @@ Graph Track::elevation() const GraphSegment gs; for (int j = 0; j < sd.size(); j++) { - if (seg.outliers.contains(j)) + if (!sd.at(j).hasElevation() || seg.outliers.contains(j)) continue; gs.append(GraphPoint(seg.distance.at(j), seg.time.at(j), sd.at(j).elevation()));