2017-11-26 18:54:03 +01:00
|
|
|
#ifndef PROJECTION_H
|
|
|
|
#define PROJECTION_H
|
|
|
|
|
2018-01-08 23:47:45 +01:00
|
|
|
#include <QDebug>
|
2017-11-26 18:54:03 +01:00
|
|
|
#include "common/coordinates.h"
|
2018-04-16 20:26:10 +02:00
|
|
|
#include "pointd.h"
|
2018-01-25 00:19:11 +01:00
|
|
|
#include "linearunits.h"
|
2018-04-05 21:13:48 +02:00
|
|
|
#include "coordinatesystem.h"
|
2017-11-26 18:54:03 +01:00
|
|
|
|
2018-01-25 00:19:11 +01:00
|
|
|
class GCS;
|
2018-04-05 20:38:23 +02:00
|
|
|
class PCS;
|
2018-01-25 00:19:11 +01:00
|
|
|
class CT;
|
|
|
|
class AngularUnits;
|
2017-11-26 18:54:03 +01:00
|
|
|
|
|
|
|
class Projection {
|
|
|
|
public:
|
2018-01-08 23:47:45 +01:00
|
|
|
class Setup {
|
|
|
|
public:
|
|
|
|
Setup() : _latitudeOrigin(NAN), _longitudeOrigin(NAN), _scale(NAN),
|
|
|
|
_falseEasting(NAN), _falseNorthing(NAN), _standardParallel1(NAN),
|
|
|
|
_standardParallel2(NAN) {}
|
|
|
|
Setup(double latitudeOrigin, double longitudeOrigin, double scale,
|
|
|
|
double falseEasting, double falseNorthing, double standardParallel1,
|
|
|
|
double standardParallel2) : _latitudeOrigin(latitudeOrigin),
|
|
|
|
_longitudeOrigin(longitudeOrigin), _scale(scale),
|
|
|
|
_falseEasting(falseEasting), _falseNorthing(falseNorthing),
|
|
|
|
_standardParallel1(standardParallel1),
|
|
|
|
_standardParallel2(standardParallel2) {}
|
|
|
|
|
|
|
|
double latitudeOrigin() const {return _latitudeOrigin;}
|
|
|
|
double longitudeOrigin() const {return _longitudeOrigin;}
|
|
|
|
double scale() const {return _scale;}
|
|
|
|
double falseEasting() const {return _falseEasting;}
|
|
|
|
double falseNorthing() const {return _falseNorthing;}
|
|
|
|
double standardParallel1() const {return _standardParallel1;}
|
|
|
|
double standardParallel2() const {return _standardParallel2;}
|
|
|
|
|
2018-01-20 23:51:39 +01:00
|
|
|
void setLatitudeOrigin(double val) {_latitudeOrigin = val;}
|
|
|
|
void setLongitudeOrigin(double val) {_longitudeOrigin = val;}
|
|
|
|
void setScale(double val) {_scale = val;}
|
|
|
|
void setFalseEasting(double val) {_falseEasting = val;}
|
|
|
|
void setFalseNorthing(double val) {_falseNorthing = val;}
|
|
|
|
void setStandardParallel1(double val) {_standardParallel1 = val;}
|
|
|
|
void setStandardParallel2(double val) {_standardParallel2 = val;}
|
|
|
|
|
2018-01-20 20:13:56 +01:00
|
|
|
bool isNull() const {return std::isnan(_latitudeOrigin)
|
|
|
|
&& std::isnan(_longitudeOrigin) && std::isnan(_scale)
|
|
|
|
&& std::isnan(_falseEasting) && std::isnan(_falseNorthing)
|
|
|
|
&& std::isnan(_standardParallel1) && std::isnan(_standardParallel2);}
|
|
|
|
|
2018-01-08 23:47:45 +01:00
|
|
|
private:
|
|
|
|
double _latitudeOrigin;
|
|
|
|
double _longitudeOrigin;
|
|
|
|
double _scale;
|
|
|
|
double _falseEasting;
|
|
|
|
double _falseNorthing;
|
|
|
|
double _standardParallel1;
|
|
|
|
double _standardParallel2;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Method {
|
|
|
|
public:
|
|
|
|
Method() : _id(0) {}
|
|
|
|
Method(int id);
|
|
|
|
|
|
|
|
int id() const {return _id;}
|
|
|
|
bool isNull() const {return (_id == 0);}
|
2018-01-20 23:51:39 +01:00
|
|
|
bool isValid() const {return !isNull();}
|
2018-01-08 23:47:45 +01:00
|
|
|
private:
|
|
|
|
int _id;
|
2017-11-26 18:54:03 +01:00
|
|
|
};
|
|
|
|
|
2018-02-22 21:02:56 +01:00
|
|
|
Projection() : _gcs(0), _ct(0), _geographic(false) {}
|
2018-01-25 00:19:11 +01:00
|
|
|
Projection(const Projection &p);
|
2018-04-05 20:38:23 +02:00
|
|
|
Projection(const PCS *pcs);
|
2018-04-07 18:42:25 +02:00
|
|
|
Projection(const GCS *gcs, const CoordinateSystem &cs
|
|
|
|
= CoordinateSystem(CoordinateSystem::YX));
|
2018-01-25 00:19:11 +01:00
|
|
|
~Projection();
|
2017-11-26 18:54:03 +01:00
|
|
|
|
2018-01-25 00:19:11 +01:00
|
|
|
Projection &operator=(const Projection &p);
|
2017-11-26 18:54:03 +01:00
|
|
|
|
2018-02-20 23:37:19 +01:00
|
|
|
bool isNull() const {return (_gcs == 0 && _ct == 0 && _units.isNull());}
|
2018-03-11 09:24:04 +01:00
|
|
|
bool isValid() const {return !(_gcs == 0 || _ct == 0 || _units.isNull());}
|
2018-02-22 21:02:56 +01:00
|
|
|
bool isGeographic() const {return _geographic;}
|
2018-02-20 23:37:19 +01:00
|
|
|
|
2018-04-15 16:27:47 +02:00
|
|
|
PointD ll2xy(const Coordinates &c) const;
|
|
|
|
Coordinates xy2ll(const PointD &p) const;
|
2018-01-25 00:19:11 +01:00
|
|
|
|
2018-02-20 23:37:19 +01:00
|
|
|
const LinearUnits &units() const {return _units;}
|
2018-04-07 18:42:25 +02:00
|
|
|
const CoordinateSystem &coordinateSystem() const {return _cs;}
|
2018-02-20 23:37:19 +01:00
|
|
|
|
2018-01-25 00:19:11 +01:00
|
|
|
private:
|
2018-03-09 18:57:23 +01:00
|
|
|
const GCS *_gcs;
|
|
|
|
const CT *_ct;
|
2018-01-25 00:19:11 +01:00
|
|
|
LinearUnits _units;
|
2018-04-07 18:42:25 +02:00
|
|
|
CoordinateSystem _cs;
|
2018-02-22 21:02:56 +01:00
|
|
|
bool _geographic;
|
2017-11-26 18:54:03 +01:00
|
|
|
};
|
|
|
|
|
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 Projection::Setup &setup);
|
|
|
|
QDebug operator<<(QDebug dbg, const Projection::Method &method);
|
2018-02-13 23:03:18 +01:00
|
|
|
#endif // QT_NO_DEBUG
|
2018-01-08 23:47:45 +01:00
|
|
|
|
2017-11-26 18:54:03 +01:00
|
|
|
#endif // PROJECTION_H
|