#ifndef IMG_H #define IMG_H #include #include #include #include #include #include "common/rtree.h" #include "common/rectc.h" #include "common/range.h" #include "style.h" class VectorTile; class SubFile; class IMG { public: struct Poly { /* QPointF insted of Coordinates for performance reasons (no need to duplicate all the vectors for drawing). Note, that we do not want to ll2xy() the points in the IMG class as this can not be done in parallel. */ QVector points; QString label; quint32 type; bool operator<(const Poly &other) const {return type > other.type;} }; struct Point { Point() : id(0) {} Coordinates coordinates; QString label; quint32 type; bool poi; quint64 id; bool operator<(const Point &other) const {return id < other.id;} }; IMG(const QString &fileName); ~IMG(); const QString &name() const {return _name;} const RectC &bounds() const {return _bounds;} Range zooms() const {return Range(_bits.first(), _bits.last());} bool isValid() const {return _valid;} const QString &errorString() const {return _errorString;} void objects(const RectC &rect, int bits, QList *polygons, QList *lines, QList *points) const; const Style &style() const {return _style;} private: friend class SubFile; typedef RTree TileTree; int blockSize() const {return _blockSize;} QByteArray readBlock(int blockNum); qint64 read(char *data, qint64 maxSize); template bool readValue(T &val); QFile _file; quint8 _key; int _blockSize; QCache _blockCache; TileTree _tileTree; QString _name; RectC _bounds; QList _bits; Style _style; bool _valid; QString _errorString; }; #endif // IMG_H