2018-10-29 00:11:23 +01:00
|
|
|
#ifndef TILE_H
|
|
|
|
#define TILE_H
|
|
|
|
|
|
|
|
#include <QImage>
|
|
|
|
#include <QPainter>
|
|
|
|
#include "text.h"
|
|
|
|
|
|
|
|
class Tile {
|
|
|
|
public:
|
2018-11-22 21:57:21 +01:00
|
|
|
Tile(QImage *img, int zoom, const QPointF &scale)
|
2018-12-04 00:09:23 +01:00
|
|
|
: _zoom(zoom), _size(img->size()), _scale(scale),
|
|
|
|
_text(QSize(img->size().width() / scale.x(),
|
|
|
|
img->size().height() / scale.y())), _painter(img)
|
2018-11-17 21:54:51 +01:00
|
|
|
{_painter.scale(scale.x(), scale.y());}
|
2018-10-29 00:11:23 +01:00
|
|
|
|
2018-11-22 21:57:21 +01:00
|
|
|
int zoom() const {return _zoom;}
|
2018-12-04 00:09:23 +01:00
|
|
|
const QSize &size() const {return _size;}
|
|
|
|
const QPointF &scale() const {return _scale;}
|
|
|
|
|
2018-10-29 00:11:23 +01:00
|
|
|
Text &text() {return _text;}
|
2018-10-29 22:35:05 +01:00
|
|
|
QPainter &painter() {return _painter;}
|
2018-10-29 00:11:23 +01:00
|
|
|
|
|
|
|
private:
|
2018-11-22 21:57:21 +01:00
|
|
|
int _zoom;
|
2018-11-12 22:05:55 +01:00
|
|
|
QSize _size;
|
2018-12-04 00:09:23 +01:00
|
|
|
QPointF _scale;
|
2018-10-29 18:42:04 +01:00
|
|
|
Text _text;
|
|
|
|
QPainter _painter;
|
2018-10-29 00:11:23 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TILE_H
|