1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-27 21:24:47 +01:00

code cleanup

This commit is contained in:
Martin Tůma 2016-08-15 08:20:27 +02:00
parent 9f0582cbea
commit d20d94ef05
4 changed files with 5 additions and 14 deletions

View File

@ -158,16 +158,6 @@ QVector<QPointF> Track::temperature() const
return graph; return graph;
} }
QVector<QPointF> Track::track() const
{
QVector<QPointF> graph;
for (int i = 0; i < _data.size(); i++)
graph.append(_data.at(i).coordinates());
return graph;
}
qreal Track::distance() const qreal Track::distance() const
{ {
return (_dd.isEmpty()) ? 0 : _dd.last(); return (_dd.isEmpty()) ? 0 : _dd.last();

View File

@ -10,7 +10,7 @@ class Track
public: public:
Track(const QVector<Trackpoint> &data); Track(const QVector<Trackpoint> &data);
QVector<QPointF> track() const; const QVector<Trackpoint> &track() const {return _data;}
QVector<QPointF> elevation() const; QVector<QPointF> elevation() const;
QVector<QPointF> speed() const; QVector<QPointF> speed() const;
QVector<QPointF> heartRate() const; QVector<QPointF> heartRate() const;

View File

@ -34,13 +34,13 @@ void TrackItem::updateShape()
TrackItem::TrackItem(const Track &track, QGraphicsItem *parent) TrackItem::TrackItem(const Track &track, QGraphicsItem *parent)
: QGraphicsItem(parent) : QGraphicsItem(parent)
{ {
QVector<QPointF> t = track.track(); const QVector<Trackpoint> &t = track.track();
Q_ASSERT(t.count() >= 2); 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()))); _path.moveTo(ll2mercator(QPointF(p.x(), -p.y())));
for (int i = 1; i < t.size(); i++) { 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()))); _path.lineTo(ll2mercator(QPointF(p.x(), -p.y())));
} }

View File

@ -126,6 +126,7 @@ void TrackView::loadGPX(const GPX &gpx)
return; return;
if ((_tracks.size() > 1 && _zoom < zoom) if ((_tracks.size() > 1 && _zoom < zoom)
|| (_routes.size() > 1 && _zoom < zoom)
|| (_waypoints.size() && _zoom < zoom)) || (_waypoints.size() && _zoom < zoom))
rescale(_scale); rescale(_scale);