2016-10-24 00:21:40 +02:00
|
|
|
#ifndef TILE_H
|
|
|
|
#define TILE_H
|
|
|
|
|
2018-06-04 23:40:42 +02:00
|
|
|
#include <QVariant>
|
2016-10-24 00:21:40 +02:00
|
|
|
#include <QPixmap>
|
|
|
|
#include <QPoint>
|
2017-11-14 22:15:46 +01:00
|
|
|
#include <QDebug>
|
2018-05-02 21:25:14 +02:00
|
|
|
#include "rectd.h"
|
2016-10-24 00:21:40 +02:00
|
|
|
|
2022-07-06 14:58:41 +02:00
|
|
|
class FetchTile
|
2016-10-24 00:21:40 +02:00
|
|
|
{
|
|
|
|
public:
|
2022-07-06 14:58:41 +02:00
|
|
|
FetchTile() {}
|
|
|
|
FetchTile(const QPoint &xy, const QVariant &zoom, const RectD &bbox = RectD())
|
2019-05-20 23:23:24 +02:00
|
|
|
: _xy(xy), _zoom(zoom), _bbox(bbox) {}
|
2016-10-24 00:21:40 +02:00
|
|
|
|
2018-03-30 10:25:05 +02:00
|
|
|
const QVariant &zoom() const {return _zoom;}
|
|
|
|
const QPoint &xy() const {return _xy;}
|
2018-05-02 21:25:14 +02:00
|
|
|
const RectD &bbox() const {return _bbox;}
|
2023-05-06 16:14:49 +02:00
|
|
|
QPixmap &pixmap() {return _pixmap;}
|
2016-10-24 00:21:40 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
QPoint _xy;
|
2018-11-15 00:38:03 +01:00
|
|
|
QVariant _zoom;
|
2018-05-02 21:25:14 +02:00
|
|
|
RectD _bbox;
|
2016-10-24 00:21:40 +02:00
|
|
|
QPixmap _pixmap;
|
|
|
|
};
|
|
|
|
|
2022-07-06 14:58:41 +02:00
|
|
|
class RenderTile
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RenderTile(const QPoint &xy, const QByteArray &data, const QString &key)
|
|
|
|
: _xy(xy), _data(data), _key(key) {}
|
|
|
|
|
|
|
|
const QPoint &xy() const {return _xy;}
|
|
|
|
const QString &key() const {return _key;}
|
|
|
|
const QPixmap &pixmap() const {return _pixmap;}
|
|
|
|
|
|
|
|
void load() {_pixmap.loadFromData(_data);}
|
|
|
|
|
|
|
|
private:
|
|
|
|
QPoint _xy;
|
|
|
|
QByteArray _data;
|
|
|
|
QString _key;
|
|
|
|
QPixmap _pixmap;
|
|
|
|
};
|
|
|
|
|
2018-02-13 23:03:18 +01:00
|
|
|
#ifndef QT_NO_DEBUG
|
2022-07-06 14:58:41 +02:00
|
|
|
inline QDebug operator<<(QDebug dbg, const FetchTile &tile)
|
2017-11-14 22:15:46 +01:00
|
|
|
{
|
2018-03-30 10:25:05 +02:00
|
|
|
dbg.nospace() << "Tile(" << tile.zoom() << ", " << tile.xy() << ", "
|
|
|
|
<< tile.bbox() << ")";
|
2018-01-21 11:19:46 +01:00
|
|
|
return dbg.space();
|
2017-11-14 22:15:46 +01:00
|
|
|
}
|
2018-02-13 23:03:18 +01:00
|
|
|
#endif // QT_NO_DEBUG
|
2017-11-14 22:15:46 +01:00
|
|
|
|
2016-10-24 00:21:40 +02:00
|
|
|
#endif // TILE_H
|