1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 13:41:16 +01:00
GPXSee/src/trackpoint.h

63 lines
2.1 KiB
C
Raw Normal View History

#ifndef TRACKPOINT_H
#define TRACKPOINT_H
#include <QDateTime>
2016-06-16 20:47:32 +02:00
#include <QDebug>
#include <cmath>
#include "coordinates.h"
2016-04-01 09:41:52 +02:00
class Trackpoint
{
2016-04-01 09:41:52 +02:00
public:
Trackpoint()
2016-11-06 03:28:08 +01:00
{_elevation = NAN; _speed = NAN; _heartRate = NAN; _temperature = NAN;
_cadence = NAN; _power = NAN;}
Trackpoint(const Coordinates &coordinates) : _coordinates(coordinates)
2016-11-06 03:28:08 +01:00
{_elevation = NAN; _speed = NAN; _heartRate = NAN; _temperature = NAN;
_cadence = NAN; _power = NAN;}
2016-04-01 09:41:52 +02:00
const Coordinates &coordinates() const {return _coordinates;}
Coordinates &rcoordinates() {return _coordinates;}
const QDateTime &timestamp() 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;}
void setCoordinates(const Coordinates &coordinates)
{_coordinates = coordinates;}
void setTimestamp(const QDateTime &timestamp) {_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;}
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);}
private:
Coordinates _coordinates;
QDateTime _timestamp;
qreal _elevation;
qreal _speed;
qreal _heartRate;
qreal _temperature;
2016-11-06 03:28:08 +01:00
qreal _cadence;
qreal _power;
};
2016-06-16 20:47:32 +02:00
QDebug operator<<(QDebug dbg, const Trackpoint &trackpoint);
2016-10-28 00:48:49 +02:00
Q_DECLARE_TYPEINFO(Trackpoint, Q_MOVABLE_TYPE);
#endif // TRACKPOINT_H