2018-01-20 20:13:56 +01:00
|
|
|
#ifndef ANGULARUNITS_H
|
|
|
|
#define ANGULARUNITS_H
|
|
|
|
|
|
|
|
#include <cmath>
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
class AngularUnits
|
|
|
|
{
|
|
|
|
public:
|
2018-01-22 00:28:58 +01:00
|
|
|
AngularUnits() : _code(0), _f(NAN) {}
|
2018-01-20 20:13:56 +01:00
|
|
|
AngularUnits(int code);
|
|
|
|
|
2020-04-21 23:26:35 +02:00
|
|
|
bool operator==(const AngularUnits &other) const
|
|
|
|
{return (_code == other._code && _f == other._f);}
|
|
|
|
|
2018-01-20 20:13:56 +01:00
|
|
|
bool isNull() const {return std::isnan(_f);}
|
|
|
|
bool isValid() const {return !std::isnan(_f);}
|
|
|
|
|
2018-01-22 00:28:58 +01:00
|
|
|
double toDegrees(double val) const;
|
|
|
|
double fromDegrees(double val) const;
|
2018-01-20 20:13:56 +01:00
|
|
|
|
2018-02-13 23:03:18 +01:00
|
|
|
#ifndef QT_NO_DEBUG
|
2018-01-20 20:13:56 +01:00
|
|
|
friend QDebug operator<<(QDebug dbg, const AngularUnits &au);
|
2018-02-13 23:03:18 +01:00
|
|
|
#endif // QT_NO_DEBUG
|
2018-01-20 20:13:56 +01:00
|
|
|
private:
|
2018-01-22 00:28:58 +01:00
|
|
|
int _code;
|
2018-01-20 20:13:56 +01:00
|
|
|
double _f;
|
|
|
|
};
|
|
|
|
|
2018-02-13 23:03:18 +01:00
|
|
|
#ifndef QT_NO_DEBUG
|
2018-01-20 20:13:56 +01:00
|
|
|
QDebug operator<<(QDebug dbg, const AngularUnits &au);
|
2018-02-13 23:03:18 +01:00
|
|
|
#endif // QT_NO_DEBUG
|
2018-01-20 20:13:56 +01:00
|
|
|
|
|
|
|
#endif // ANGULARUNITS_H
|