From d20d94ef059a0caf4567712310aff01cd3ef37ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Mon, 15 Aug 2016 08:20:27 +0200 Subject: [PATCH] code cleanup --- src/track.cpp | 10 ---------- src/track.h | 2 +- src/trackitem.cpp | 6 +++--- src/trackview.cpp | 1 + 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/track.cpp b/src/track.cpp index 2f8a5c33..04834246 100644 --- a/src/track.cpp +++ b/src/track.cpp @@ -158,16 +158,6 @@ QVector Track::temperature() const return graph; } -QVector Track::track() const -{ - QVector graph; - - for (int i = 0; i < _data.size(); i++) - graph.append(_data.at(i).coordinates()); - - return graph; -} - qreal Track::distance() const { return (_dd.isEmpty()) ? 0 : _dd.last(); diff --git a/src/track.h b/src/track.h index b8e30828..a2c03683 100644 --- a/src/track.h +++ b/src/track.h @@ -10,7 +10,7 @@ class Track public: Track(const QVector &data); - QVector track() const; + const QVector &track() const {return _data;} QVector elevation() const; QVector speed() const; QVector heartRate() const; diff --git a/src/trackitem.cpp b/src/trackitem.cpp index 23b4bbd0..373fc9ea 100644 --- a/src/trackitem.cpp +++ b/src/trackitem.cpp @@ -34,13 +34,13 @@ void TrackItem::updateShape() TrackItem::TrackItem(const Track &track, QGraphicsItem *parent) : QGraphicsItem(parent) { - QVector t = track.track(); + const QVector &t = track.track(); Q_ASSERT(t.count() >= 2); - const QPointF &p = t.at(0); + const QPointF &p = t.at(0).coordinates(); _path.moveTo(ll2mercator(QPointF(p.x(), -p.y()))); for (int i = 1; i < t.size(); i++) { - const QPointF &p = t.at(i); + const QPointF &p = t.at(i).coordinates(); _path.lineTo(ll2mercator(QPointF(p.x(), -p.y()))); } diff --git a/src/trackview.cpp b/src/trackview.cpp index 3ff62885..a0ae38b2 100644 --- a/src/trackview.cpp +++ b/src/trackview.cpp @@ -126,6 +126,7 @@ void TrackView::loadGPX(const GPX &gpx) return; if ((_tracks.size() > 1 && _zoom < zoom) + || (_routes.size() > 1 && _zoom < zoom) || (_waypoints.size() && _zoom < zoom)) rescale(_scale);