2016-02-11 20:58:52 +01:00
|
|
|
#ifndef TRACKPOINT_H
|
|
|
|
#define TRACKPOINT_H
|
|
|
|
|
|
|
|
#include <QDateTime>
|
2016-06-16 20:47:32 +02:00
|
|
|
#include <QDebug>
|
2016-03-17 00:50:20 +01:00
|
|
|
#include <cmath>
|
2017-11-26 18:54:03 +01:00
|
|
|
#include "common/coordinates.h"
|
2016-02-11 20:58:52 +01:00
|
|
|
|
2016-04-01 09:41:52 +02:00
|
|
|
class Trackpoint
|
2016-02-11 20:58:52 +01:00
|
|
|
{
|
2016-04-01 09:41:52 +02:00
|
|
|
public:
|
2016-10-27 00:20:00 +02:00
|
|
|
Trackpoint()
|
2016-11-06 03:28:08 +01:00
|
|
|
{_elevation = NAN; _speed = NAN; _heartRate = NAN; _temperature = NAN;
|
2018-07-03 01:29:14 +02:00
|
|
|
_cadence = NAN; _power = NAN; _ratio = NAN;}
|
2016-10-27 00:20:00 +02:00
|
|
|
Trackpoint(const Coordinates &coordinates) : _coordinates(coordinates)
|
2016-11-06 03:28:08 +01:00
|
|
|
{_elevation = NAN; _speed = NAN; _heartRate = NAN; _temperature = NAN;
|
2018-07-03 01:29:14 +02:00
|
|
|
_cadence = NAN; _power = NAN; _ratio = NAN;}
|
2016-04-01 09:41:52 +02:00
|
|
|
|
2016-10-24 00:21:40 +02:00
|
|
|
const Coordinates &coordinates() const {return _coordinates;}
|
2016-10-31 22:59:08 +01:00
|
|
|
Coordinates &rcoordinates() {return _coordinates;}
|
2016-07-28 00:23:22 +02:00
|
|
|
const QDateTime ×tamp() const {return _timestamp;}
|
|
|
|
qreal elevation() const {return _elevation;}
|
|
|
|
qreal speed() const {return _speed;}
|
|
|
|
qreal heartRate() const {return _heartRate;}
|
|
|
|
qreal temperature() const {return _temperature;}
|
2016-11-06 03:28:08 +01:00
|
|
|
qreal cadence() const {return _cadence;}
|
|
|
|
qreal power() const {return _power;}
|
2018-07-03 01:29:14 +02:00
|
|
|
qreal ratio() const {return _ratio;}
|
2016-07-28 00:23:22 +02:00
|
|
|
|
2016-10-24 00:21:40 +02:00
|
|
|
void setCoordinates(const Coordinates &coordinates)
|
2016-07-28 00:23:22 +02:00
|
|
|
{_coordinates = coordinates;}
|
|
|
|
void setTimestamp(const QDateTime ×tamp) {_timestamp = timestamp;}
|
|
|
|
void setElevation(qreal elevation) {_elevation = elevation;}
|
|
|
|
void setSpeed(qreal speed) {_speed = speed;}
|
|
|
|
void setHeartRate(qreal heartRate) {_heartRate = heartRate;}
|
|
|
|
void setTemperature(qreal temperature) {_temperature = temperature;}
|
2016-11-06 03:28:08 +01:00
|
|
|
void setCadence(qreal cadence) {_cadence = cadence;}
|
|
|
|
void setPower(qreal power) {_power = power;}
|
2018-07-03 01:29:14 +02:00
|
|
|
void setRatio(qreal ratio) {_ratio = ratio;}
|
2016-07-28 00:23:22 +02:00
|
|
|
|
|
|
|
bool hasTimestamp() const {return !_timestamp.isNull();}
|
|
|
|
bool hasElevation() const {return !std::isnan(_elevation);}
|
|
|
|
bool hasSpeed() const {return !std::isnan(_speed);}
|
|
|
|
bool hasHeartRate() const {return !std::isnan(_heartRate);}
|
|
|
|
bool hasTemperature() const {return !std::isnan(_temperature);}
|
2016-11-06 03:28:08 +01:00
|
|
|
bool hasCadence() const {return !std::isnan(_cadence);}
|
|
|
|
bool hasPower() const {return !std::isnan(_power);}
|
2018-07-03 01:29:14 +02:00
|
|
|
bool hasRatio() const {return !std::isnan(_ratio);}
|
2016-07-28 00:23:22 +02:00
|
|
|
|
|
|
|
private:
|
2016-10-24 00:21:40 +02:00
|
|
|
Coordinates _coordinates;
|
2016-07-28 00:23:22 +02:00
|
|
|
QDateTime _timestamp;
|
|
|
|
qreal _elevation;
|
|
|
|
qreal _speed;
|
|
|
|
qreal _heartRate;
|
|
|
|
qreal _temperature;
|
2016-11-06 03:28:08 +01:00
|
|
|
qreal _cadence;
|
|
|
|
qreal _power;
|
2018-07-03 01:29:14 +02:00
|
|
|
qreal _ratio;
|
2016-02-11 20:58:52 +01:00
|
|
|
};
|
|
|
|
|
2016-10-28 00:48:49 +02:00
|
|
|
Q_DECLARE_TYPEINFO(Trackpoint, Q_MOVABLE_TYPE);
|
|
|
|
|
2018-02-13 23:03:18 +01:00
|
|
|
#ifndef QT_NO_DEBUG
|
2017-11-26 18:54:03 +01:00
|
|
|
inline QDebug operator<<(QDebug dbg, const Trackpoint &trackpoint)
|
|
|
|
{
|
|
|
|
dbg.nospace() << "Trackpoint(" << trackpoint.coordinates() << ", "
|
|
|
|
<< trackpoint.timestamp() << ", " << trackpoint.elevation() << ", "
|
|
|
|
<< trackpoint.speed() << ", " << trackpoint.heartRate() << ", "
|
2018-07-03 19:08:46 +02:00
|
|
|
<< trackpoint.temperature() << ", " << trackpoint.cadence() << ", "
|
|
|
|
<< trackpoint.power() << ", " << trackpoint.ratio() << ")";
|
2017-11-26 18:54:03 +01:00
|
|
|
return dbg.space();
|
|
|
|
}
|
2018-02-13 23:03:18 +01:00
|
|
|
#endif // QT_NO_DEBUG
|
2017-11-26 18:54:03 +01:00
|
|
|
|
2016-02-11 20:58:52 +01:00
|
|
|
#endif // TRACKPOINT_H
|