1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-07 07:13:21 +02:00
GPXSee/src/map/geotiff.h

63 lines
1.5 KiB
C
Raw Normal View History

2018-01-08 23:47:45 +01:00
#ifndef GEOTIFF_H
#define GEOTIFF_H
#include <QMap>
2018-03-06 19:28:07 +01:00
#include <QList>
2018-01-08 23:47:45 +01:00
#include "transform.h"
2018-03-06 19:28:07 +01:00
#include "projection.h"
class TIFFFile;
class GCS;
2018-01-08 23:47:45 +01:00
class GeoTIFF
{
public:
2018-03-22 20:00:30 +01:00
GeoTIFF(const QString &path);
bool isValid() const {return _projection.isValid() && _transform.isValid();}
const QString &errorString() const {return _errorString;}
2018-01-08 23:47:45 +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
private:
union Value {
quint16 SHORT;
double DOUBLE;
};
struct Ctx {
quint32 scale;
quint32 tiepoints;
quint32 tiepointCount;
quint32 matrix;
quint32 keys;
quint32 values;
Ctx() : scale(0), tiepoints(0), tiepointCount(0), matrix(0), keys(0),
values(0) {}
};
bool readEntry(TIFFFile &file, Ctx &ctx) const;
bool readIFD(TIFFFile &file, quint32 &offset, Ctx &ctx) const;
bool readScale(TIFFFile &file, quint32 offset, PointD &scale) const;
2018-01-08 23:47:45 +01:00
bool readTiepoints(TIFFFile &file, quint32 offset, quint32 count,
QList<ReferencePoint> &points) const;
bool readMatrix(TIFFFile &file, quint32 offset, double matrix[16]) const;
bool readKeys(TIFFFile &file, Ctx &ctx, QMap<quint16, Value> &kv) const;
2018-01-08 23:47:45 +01:00
bool readGeoValue(TIFFFile &file, quint32 offset, quint16 index,
double &val) const;
2018-01-08 23:47:45 +01:00
const GCS *gcs(QMap<quint16, Value> &kv);
2018-01-08 23:47:45 +01:00
Projection::Method method(QMap<quint16, Value> &kv);
bool geographicModel(QMap<quint16, Value> &kv);
bool projectedModel(QMap<quint16, Value> &kv);
2018-03-22 20:00:30 +01:00
Transform _transform;
Projection _projection;
2018-01-08 23:47:45 +01:00
QString _errorString;
};
#endif // GEOTIFF_H