1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-06 23:03:22 +02:00
GPXSee/src/map/pcs.h

62 lines
1.5 KiB
C
Raw Normal View History

2018-01-08 23:47:45 +01:00
#ifndef PCS_H
#define PCS_H
#include <QDebug>
#include <QList>
#include "common/kv.h"
#include "gcs.h"
#include "linearunits.h"
#include "coordinatesystem.h"
2018-01-08 23:47:45 +01:00
#include "projection.h"
class PCS
{
public:
2021-06-17 21:58:25 +02:00
PCS() {}
PCS(const GCS &gcs, const Projection::Method &method,
const Projection::Setup &setup, const LinearUnits &units,
const CoordinateSystem &cs = CoordinateSystem())
: _gcs(gcs), _method(method), _setup(setup), _units(units), _cs(cs) {}
2021-06-17 21:58:25 +02:00
PCS(const GCS &gcs, int proj);
2021-06-17 21:58:25 +02:00
const GCS &gcs() const {return _gcs;}
2018-01-08 23:47:45 +01:00
const Projection::Method &method() const {return _method;}
const Projection::Setup &setup() const {return _setup;}
const LinearUnits &units() const {return _units;}
const CoordinateSystem &coordinateSystem() const {return _cs;}
2018-01-08 23:47:45 +01:00
2021-06-17 21:58:25 +02:00
bool isNull() const {
return (_gcs.isNull() && _units.isNull() && _method.isNull()
&& _setup.isNull() && _cs.isNull());
}
bool isValid() const {
2021-06-27 16:00:27 +02:00
// We do not check the CoordinateSystem here as it is not always defined
// and except of WMTS/WMS it is not needed.
return (_gcs.isValid() && _units.isValid() && _method.isValid());
2021-06-17 21:58:25 +02:00
}
2018-01-08 23:47:45 +01:00
static void loadList(const QString &path);
static PCS pcs(int id);
static PCS pcs(const GCS &gcs, int proj);
static QList<KV<int, QString> > list();
2018-01-08 23:47:45 +01:00
private:
class Entry;
static QList<Entry> defaults();
2021-06-17 21:58:25 +02:00
GCS _gcs;
2018-01-08 23:47:45 +01:00
Projection::Method _method;
Projection::Setup _setup;
LinearUnits _units;
CoordinateSystem _cs;
2018-01-08 23:47:45 +01:00
static QList<Entry> _pcss;
};
#ifndef QT_NO_DEBUG
2018-01-08 23:47:45 +01:00
QDebug operator<<(QDebug dbg, const PCS &pcs);
#endif // QT_NO_DEBUG
2018-01-08 23:47:45 +01:00
#endif // PCS_H