2018-01-08 23:47:45 +01:00
|
|
|
#ifndef MAPFILE_H
|
|
|
|
#define MAPFILE_H
|
|
|
|
|
|
|
|
#include "transform.h"
|
|
|
|
#include "projection.h"
|
|
|
|
|
2018-03-10 09:25:52 +01:00
|
|
|
class QIODevice;
|
2018-03-21 19:23:17 +01:00
|
|
|
class GCS;
|
2018-03-10 09:25:52 +01:00
|
|
|
|
2018-01-08 23:47:45 +01:00
|
|
|
class MapFile
|
|
|
|
{
|
|
|
|
public:
|
2018-03-21 19:09:37 +01:00
|
|
|
MapFile(QIODevice &file);
|
|
|
|
|
2018-03-22 20:00:30 +01:00
|
|
|
bool isValid() const
|
|
|
|
{return !_image.isNull() && _projection.isValid() && _transform.isValid();}
|
2018-01-25 00:19:11 +01:00
|
|
|
const QString &errorString() const {return _errorString;}
|
2018-01-08 23:47:45 +01:00
|
|
|
|
2018-01-25 00:19:11 +01:00
|
|
|
const Projection &projection() const {return _projection;}
|
2018-03-22 20:00:30 +01:00
|
|
|
const Transform &transform() const {return _transform;}
|
2018-01-08 23:47:45 +01:00
|
|
|
|
|
|
|
const QString &name() const {return _name;}
|
|
|
|
const QString &image() const {return _image;}
|
|
|
|
const QSize &size() const {return _size;}
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct CalibrationPoint {
|
|
|
|
ReferencePoint rp;
|
|
|
|
Coordinates ll;
|
|
|
|
int zone;
|
|
|
|
};
|
|
|
|
|
|
|
|
int parse(QIODevice &device, QList<CalibrationPoint> &points,
|
|
|
|
QString &projection, Projection::Setup &setup, QString &datum);
|
|
|
|
bool parseMapFile(QIODevice &device, QList<CalibrationPoint> &points,
|
|
|
|
QString &projection, Projection::Setup &setup, QString &datum);
|
2018-01-25 00:19:11 +01:00
|
|
|
const GCS *createGCS(const QString &datum);
|
|
|
|
bool createProjection(const GCS *gcs, const QString &projection,
|
2018-01-08 23:47:45 +01:00
|
|
|
const Projection::Setup &setup, QList<CalibrationPoint> &points);
|
|
|
|
bool computeTransformation(QList<CalibrationPoint> &points);
|
|
|
|
|
|
|
|
QString _name;
|
|
|
|
QString _image;
|
|
|
|
QSize _size;
|
|
|
|
|
2018-01-25 00:19:11 +01:00
|
|
|
Projection _projection;
|
2018-03-22 20:00:30 +01:00
|
|
|
Transform _transform;
|
2018-01-08 23:47:45 +01:00
|
|
|
|
|
|
|
QString _errorString;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAPFILE_H
|