Map API refactoring
[GPXSee.git] / src / map / qctmap.h
blobf2e1b4984d68db10b4805587297b46025e36d45b
1 #ifndef QCTMAP_H
2 #define QCTMAP_H
4 #include <QFile>
5 #include <QRgb>
6 #include "map.h"
8 class QDataStream;
10 class QCTMap : public Map
12 public:
13 QCTMap(const QString &fileName, QObject *parent = 0);
15 QString name() const {return _name;}
17 QRectF bounds();
19 QPointF ll2xy(const Coordinates &c);
20 Coordinates xy2ll(const QPointF &p);
22 void draw(QPainter *painter, const QRectF &rect, Flags flags);
24 void load(const Projection &in, const Projection &out, qreal deviceRatio,
25 bool hidpi);
26 void unload();
28 bool isValid() const {return _valid;}
29 QString errorString() const {return _errorString;}
31 static Map *create(const QString &path, bool *isDir);
33 private:
34 bool readName(QDataStream &stream);
35 bool readSize(QDataStream &stream);
36 bool readDatumShift(QDataStream &stream);
37 bool readHeader(QDataStream &stream);
38 bool readGeoRef(QDataStream &stream);
39 bool readIndex(QDataStream &stream);
40 bool readPalette(QDataStream &stream);
41 QPixmap tile(int x, int y);
43 QFile _file;
44 QString _name;
45 int _rows, _cols;
46 double _lon, _lonX, _lonXX, _lonXXX, _lonY, _lonYY, _lonYYY, _lonXY,
47 _lonXXY, _lonXYY;
48 double _lat, _latX, _latXX, _latXXX, _latY, _latYY, _latYYY, _latXY,
49 _latXXY, _latXYY;
50 double _eas, _easY, _easX, _easYY, _easXY, _easXX, _easYYY, _easYYX,
51 _easXXY, _easXXX;
52 double _nor, _norY, _norX, _norYY, _norXY, _norXX, _norYYY, _norYYX,
53 _norXXY, _norXXX;
54 double _shiftE, _shiftN;
55 QVector<quint32> _index;
56 QVector<QRgb> _palette;
58 qreal _mapRatio;
59 bool _valid;
60 QString _errorString;
63 #endif // QCTMAP_H