2017-04-03 20:29:35 +02:00
|
|
|
#ifndef ELLIPSOID_H
|
|
|
|
#define ELLIPSOID_H
|
|
|
|
|
2018-01-08 23:47:45 +01:00
|
|
|
#include <cmath>
|
2017-04-17 18:03:04 +02:00
|
|
|
#include <QString>
|
|
|
|
#include <QMap>
|
2018-01-08 23:47:45 +01:00
|
|
|
#include <QDebug>
|
2017-04-17 18:03:04 +02:00
|
|
|
|
2017-04-03 20:29:35 +02:00
|
|
|
class Ellipsoid
|
|
|
|
{
|
|
|
|
public:
|
2018-05-17 22:41:56 +02:00
|
|
|
Ellipsoid() : _radius(NAN), _flattening(NAN), _es(NAN), _b(NAN) {}
|
|
|
|
Ellipsoid(double radius, double flattening);
|
2017-04-03 20:29:35 +02:00
|
|
|
|
|
|
|
double radius() const {return _radius;}
|
|
|
|
double flattening() const {return _flattening;}
|
2018-05-17 22:41:56 +02:00
|
|
|
double es() const {return _es;}
|
2018-05-18 22:10:43 +02:00
|
|
|
double e2s() const {return _e2s;}
|
2018-05-17 22:41:56 +02:00
|
|
|
double b() const {return _b;}
|
2017-04-03 20:29:35 +02:00
|
|
|
|
2018-01-08 23:47:45 +01:00
|
|
|
bool isNull() const
|
|
|
|
{return (std::isnan(_radius) && std::isnan(_flattening));}
|
2018-01-20 20:13:56 +01:00
|
|
|
bool isValid() const
|
|
|
|
{return !(std::isnan(_radius) || std::isnan(_flattening));}
|
2017-04-17 18:03:04 +02:00
|
|
|
|
2018-06-28 22:12:16 +02:00
|
|
|
static const Ellipsoid &WGS84();
|
2021-06-17 21:58:25 +02:00
|
|
|
static const Ellipsoid &ellipsoid(int id);
|
2018-01-20 20:13:56 +01:00
|
|
|
static void loadList(const QString &path);
|
2017-04-17 18:03:04 +02:00
|
|
|
|
2017-04-03 20:29:35 +02:00
|
|
|
private:
|
|
|
|
double _radius;
|
|
|
|
double _flattening;
|
2018-05-18 22:10:43 +02:00
|
|
|
double _es, _e2s, _b;
|
2017-04-17 18:03:04 +02:00
|
|
|
|
2018-06-28 22:12:16 +02:00
|
|
|
static QMap<int, Ellipsoid> defaults();
|
2017-04-17 18:03:04 +02:00
|
|
|
static QMap<int, Ellipsoid> _ellipsoids;
|
2017-04-03 20:29:35 +02:00
|
|
|
};
|
|
|
|
|
2018-01-20 20:13:56 +01:00
|
|
|
inline bool operator==(const Ellipsoid &e1, const Ellipsoid &e2)
|
|
|
|
{return (e1.radius() == e2.radius() && e1.flattening() == e2.flattening());}
|
|
|
|
|
2018-02-13 23:03:18 +01:00
|
|
|
#ifndef QT_NO_DEBUG
|
2018-01-08 23:47:45 +01:00
|
|
|
QDebug operator<<(QDebug dbg, const Ellipsoid &ellipsoid);
|
2018-02-13 23:03:18 +01:00
|
|
|
#endif // QT_NO_DEBUG
|
2018-01-08 23:47:45 +01:00
|
|
|
|
2017-04-03 20:29:35 +02:00
|
|
|
#endif // ELLIPSOID_H
|