Code cleanup
[GPXSee.git] / src / map / geotiff.h
blobcbf940b8c881a8e55c5ae946021e1a42acf9eb69
1 #ifndef GEOTIFF_H
2 #define GEOTIFF_H
4 #include <QMap>
5 #include <QList>
6 #include "transform.h"
7 #include "projection.h"
9 class TIFFFile;
10 class GCS;
12 class GeoTIFF
14 public:
15 GeoTIFF(const QString &path);
17 bool isValid() const {return _projection.isValid() && _transform.isValid();}
18 const QString &errorString() const {return _errorString;}
20 const Projection &projection() const {return _projection;}
21 const Transform &transform() const {return _transform;}
23 private:
24 union Value {
25 quint16 SHORT;
26 double DOUBLE;
29 struct Ctx {
30 quint32 scale;
31 quint32 tiepoints;
32 quint32 tiepointCount;
33 quint32 matrix;
34 quint32 keys;
35 quint32 values;
37 Ctx() : scale(0), tiepoints(0), tiepointCount(0), matrix(0), keys(0),
38 values(0) {}
41 bool readEntry(TIFFFile &file, Ctx &ctx) const;
42 bool readIFD(TIFFFile &file, quint32 &offset, Ctx &ctx) const;
43 bool readScale(TIFFFile &file, quint32 offset, PointD &scale) const;
44 bool readTiepoints(TIFFFile &file, quint32 offset, quint32 count,
45 QList<ReferencePoint> &points) const;
46 bool readMatrix(TIFFFile &file, quint32 offset, double matrix[16]) const;
47 bool readKeys(TIFFFile &file, Ctx &ctx, QMap<quint16, Value> &kv) const;
48 bool readGeoValue(TIFFFile &file, quint32 offset, quint16 index,
49 double &val) const;
51 const GCS *gcs(QMap<quint16, Value> &kv);
52 Projection::Method method(QMap<quint16, Value> &kv);
53 bool geographicModel(QMap<quint16, Value> &kv);
54 bool projectedModel(QMap<quint16, Value> &kv);
56 Transform _transform;
57 Projection _projection;
59 QString _errorString;
62 #endif // GEOTIFF_H