2017-11-26 18:54:03 +01:00
|
|
|
#ifndef PROJECTION_H
|
|
|
|
#define PROJECTION_H
|
|
|
|
|
|
|
|
#include <QPointF>
|
2018-01-08 23:47:45 +01:00
|
|
|
#include <QDebug>
|
2017-11-26 18:54:03 +01:00
|
|
|
#include "common/coordinates.h"
|
|
|
|
|
2018-01-08 23:47:45 +01:00
|
|
|
class Datum;
|
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;}
|
|
|
|
|
|
|
|
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);}
|
|
|
|
private:
|
|
|
|
int _id;
|
2017-11-26 18:54:03 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
virtual ~Projection() {}
|
|
|
|
|
|
|
|
virtual QPointF ll2xy(const Coordinates &c) const = 0;
|
|
|
|
virtual Coordinates xy2ll(const QPointF &p) const = 0;
|
|
|
|
|
2018-01-08 23:47:45 +01:00
|
|
|
static Projection *projection(const Datum &datum, const Method &method,
|
|
|
|
const Setup &setup);
|
2017-11-26 18:54:03 +01:00
|
|
|
};
|
|
|
|
|
2018-01-08 23:47:45 +01:00
|
|
|
QDebug operator<<(QDebug dbg, const Projection::Setup &setup);
|
|
|
|
QDebug operator<<(QDebug dbg, const Projection::Method &method);
|
|
|
|
|
2017-11-26 18:54:03 +01:00
|
|
|
#endif // PROJECTION_H
|