mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Code cleanup
This commit is contained in:
parent
f41b13a5a2
commit
d3908f1561
@ -1,4 +1,3 @@
|
|||||||
#include <cmath>
|
|
||||||
#include "ll.h"
|
#include "ll.h"
|
||||||
#include "track.h"
|
#include "track.h"
|
||||||
|
|
||||||
@ -100,12 +99,12 @@ void Track::elevationGraph(QVector<QPointF> &graph) const
|
|||||||
if (!_data.size())
|
if (!_data.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (std::isnan(_data.at(0).elevation))
|
if (!_data.at(0).hasElevation())
|
||||||
return;
|
return;
|
||||||
raw.append(QPointF(0, _data.at(0).elevation - _data.at(0).geoidheight));
|
raw.append(QPointF(0, _data.at(0).elevation - _data.at(0).geoidheight));
|
||||||
for (int i = 1; i < _data.size(); i++) {
|
for (int i = 1; i < _data.size(); i++) {
|
||||||
dist += _dd.at(i-1);
|
dist += _dd.at(i-1);
|
||||||
if (std::isnan(_data.at(i).elevation))
|
if (!_data.at(i).hasElevation())
|
||||||
return;
|
return;
|
||||||
raw.append(QPointF(dist, _data.at(i).elevation
|
raw.append(QPointF(dist, _data.at(i).elevation
|
||||||
- _data.at(i).geoidheight));
|
- _data.at(i).geoidheight));
|
||||||
@ -128,7 +127,7 @@ void Track::speedGraph(QVector<QPointF> &graph) const
|
|||||||
dt = _data.at(i-1).timestamp.msecsTo(_data.at(i).timestamp) / 1000.0;
|
dt = _data.at(i-1).timestamp.msecsTo(_data.at(i).timestamp) / 1000.0;
|
||||||
dist += ds;
|
dist += ds;
|
||||||
|
|
||||||
if (std::isnan(_data.at(i).speed)) {
|
if (!_data.at(i).hasSpeed()) {
|
||||||
if (dt == 0)
|
if (dt == 0)
|
||||||
continue;
|
continue;
|
||||||
v = ds / dt;
|
v = ds / dt;
|
||||||
@ -149,11 +148,11 @@ void Track::heartRateGraph(QVector<QPointF> &graph) const
|
|||||||
if (!_data.size())
|
if (!_data.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (std::isnan(_data.at(0).heartRate))
|
if (!_data.at(0).hasHeartRate())
|
||||||
return;
|
return;
|
||||||
raw.append(QPointF(0, _data.at(0).heartRate));
|
raw.append(QPointF(0, _data.at(0).heartRate));
|
||||||
for (int i = 1; i < _data.count(); i++) {
|
for (int i = 1; i < _data.count(); i++) {
|
||||||
if (std::isnan(_data.at(i).heartRate))
|
if (!_data.at(i).hasHeartRate())
|
||||||
return;
|
return;
|
||||||
dist += _dd.at(i-1);
|
dist += _dd.at(i-1);
|
||||||
raw.append(QPointF(dist, _data.at(i).heartRate));
|
raw.append(QPointF(dist, _data.at(i).heartRate));
|
||||||
|
@ -5,21 +5,26 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
struct Trackpoint
|
class Trackpoint
|
||||||
{
|
{
|
||||||
QPointF coordinates;
|
public:
|
||||||
QDateTime timestamp;
|
|
||||||
qreal elevation;
|
|
||||||
qreal geoidheight;
|
|
||||||
qreal speed;
|
|
||||||
qreal heartRate;
|
|
||||||
|
|
||||||
Trackpoint() {
|
Trackpoint() {
|
||||||
elevation = NAN;
|
elevation = NAN;
|
||||||
geoidheight = 0;
|
geoidheight = 0;
|
||||||
speed = NAN;
|
speed = NAN;
|
||||||
heartRate = NAN;
|
heartRate = NAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasElevation() const {return !std::isnan(elevation);}
|
||||||
|
bool hasSpeed() const {return !std::isnan(speed);}
|
||||||
|
bool hasHeartRate() const {return !std::isnan(heartRate);}
|
||||||
|
|
||||||
|
QPointF coordinates;
|
||||||
|
QDateTime timestamp;
|
||||||
|
qreal elevation;
|
||||||
|
qreal geoidheight;
|
||||||
|
qreal speed;
|
||||||
|
qreal heartRate;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TRACKPOINT_H
|
#endif // TRACKPOINT_H
|
||||||
|
Loading…
Reference in New Issue
Block a user