1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 19:55:53 +01:00
GPXSee/src/map/ellipsoid.h

47 lines
1.1 KiB
C
Raw Normal View History

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