Map API refactoring
[GPXSee.git] / src / map / gcs.h
blob6fa383f1054a333fa94d70c6322166e64e92d552
1 #ifndef GCS_H
2 #define GCS_H
4 #include "common/kv.h"
5 #include "datum.h"
6 #include "angularunits.h"
7 #include "primemeridian.h"
9 class GCS
11 public:
12 GCS() {}
13 GCS(const Datum &datum, const PrimeMeridian &primeMeridian,
14 const AngularUnits &angularUnits) : _datum(datum),
15 _primeMeridian(primeMeridian), _angularUnits(angularUnits) {}
17 bool operator==(const GCS &other) const
19 return (_datum == other._datum && _primeMeridian == other._primeMeridian
20 && _angularUnits == other._angularUnits);
23 const PrimeMeridian &primeMeridian() const {return _primeMeridian;}
24 const AngularUnits &angularUnits() const {return _angularUnits;}
25 const Datum &datum() const {return _datum;}
27 bool isNull() const {return _datum.isNull() && _angularUnits.isNull()
28 && _primeMeridian.isNull();}
29 bool isValid() const {return _datum.isValid() && _angularUnits.isValid()
30 && _primeMeridian.isValid();}
32 Coordinates toWGS84(const Coordinates &c) const;
33 Coordinates fromWGS84(const Coordinates &c) const;
35 static GCS gcs(int id);
36 static GCS gcs(int geodeticDatum, int primeMeridian, int angularUnits);
37 static GCS gcs(const QString &name);
38 static const GCS &WGS84();
40 static bool loadList(const QString &path);
41 static QList<KV<int, QString> > list();
42 static QList<KV<int, QString> > WGS84List();
44 private:
45 class Entry;
47 static QList<Entry> defaults();
49 Datum _datum;
50 PrimeMeridian _primeMeridian;
51 AngularUnits _angularUnits;
53 static QList<Entry> _gcss;
56 #ifndef QT_NO_DEBUG
57 QDebug operator<<(QDebug dbg, const GCS &gcs);
58 #endif // QT_NO_DEBUG
60 #endif // GCS_H