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