1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-07 15:23:22 +02:00
GPXSee/src/map/IMG/trefile.h

62 lines
1.2 KiB
C
Raw Normal View History

2019-05-10 18:56:19 +02:00
#ifndef TREFILE_H
#define TREFILE_H
#include <QVector>
#include <QDebug>
#include <QRect>
#include "common/rectc.h"
#include "common/rtree.h"
#include "subfile.h"
class SubDiv;
class TREFile : public SubFile
{
public:
TREFile(IMG *img, quint32 size) : SubFile(img, size) {}
~TREFile();
bool init();
2019-07-04 18:18:03 +02:00
void clear();
2019-05-10 18:56:19 +02:00
const RectC &bounds() const {return _bounds;}
QList<SubDiv*> subdivs(const RectC &rect, int bits);
2019-05-10 18:56:19 +02:00
private:
struct MapLevel {
quint8 level;
quint8 bits;
quint16 subdivs;
};
struct Extended {
quint32 offset;
quint32 size;
quint16 itemSize;
Extended() : offset(0), size(0), itemSize(0) {}
};
2019-05-10 18:56:19 +02:00
typedef RTree<SubDiv*, double, 2> SubDivTree;
bool load(int idx);
int level(int bits);
2019-05-10 18:56:19 +02:00
bool parsePoly(Handle hdl, quint32 pos, const QMap<int, int> &level2bits,
QMap<quint32, int> &map);
bool parsePoints(Handle hdl, quint32 pos, const QMap<int, int> &level2bits);
friend QDebug operator<<(QDebug dbg, const MapLevel &level);
2019-05-10 18:56:19 +02:00
RectC _bounds;
QVector<MapLevel> _levels;
quint32 _subdivOffset;
Extended _extended;
int _firstLevel;
2019-05-10 18:56:19 +02:00
QMap<int, SubDivTree*> _subdivs;
};
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const TREFile::MapLevel &level);
#endif // QT_NO_DEBUG
2019-05-10 18:56:19 +02:00
#endif // TREFILE_H