1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-25 04:05:53 +01:00
GPXSee/src/map/ozf.h

55 lines
1.0 KiB
C
Raw Normal View History

2017-04-14 22:39:33 +02:00
#ifndef OZF_H
#define OZF_H
#include <QString>
#include <QSize>
#include <QColor>
2017-08-11 00:22:21 +02:00
#include <QList>
2017-04-14 22:39:33 +02:00
#include <QVector>
#include <QFile>
#include <QPixmap>
class OZF
{
public:
2018-03-08 02:24:10 +01:00
OZF(const QString &name) : _tileSize(0), _decrypt(false), _key(0),
_file(name) {}
2017-05-03 21:34:13 +02:00
2018-03-08 02:24:10 +01:00
bool open();
void close() {_file.close();}
2017-04-14 22:39:33 +02:00
QString fileName() const {return _file.fileName();}
bool isOpen() const {return _file.isOpen();}
2017-08-11 00:22:21 +02:00
int zooms() const {return _zooms.size();}
QSize size(int zoom) const;
2018-03-08 02:24:10 +01:00
QPointF scale(int zoom) const;
2017-08-11 00:22:21 +02:00
QSize tileSize() const {return QSize(_tileSize, _tileSize);}
QPixmap tile(int zoom, int x, int y);
2017-04-14 22:39:33 +02:00
static bool isOZF(const QString &path);
2017-04-14 22:39:33 +02:00
private:
2017-08-11 00:22:21 +02:00
struct Zoom {
QSize size;
QSize dim;
QVector<QRgb> palette;
QVector<quint32> tiles;
};
2017-04-14 22:39:33 +02:00
template<class T> bool readValue(T &val);
2017-08-11 00:22:21 +02:00
bool read(void *data, size_t size, size_t decryptSize = 0);
bool initOZF3();
bool initOZF2();
2017-04-14 22:39:33 +02:00
bool readHeaders();
bool readTileTable();
2017-08-11 00:22:21 +02:00
quint16 _tileSize;
2017-05-03 21:34:13 +02:00
bool _decrypt;
quint8 _key;
2017-08-11 00:22:21 +02:00
QList<Zoom> _zooms;
2017-04-14 22:39:33 +02:00
QFile _file;
};
#endif // OZF_H