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);
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
friend bool operator==(const AngularUnits &au1, const AngularUnits &au2);
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline bool operator==(const AngularUnits &au1, const AngularUnits &au2)
|
|
|
|
{return (au1._f == au2._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
|