1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 21:51:17 +01:00
GPXSee/src/map/ENC/rastertile.h

62 lines
1.8 KiB
C
Raw Normal View History

2022-11-04 09:03:36 +01:00
#ifndef ENC_RASTERTILE_H
#define ENC_RASTERTILE_H
#include <QPixmap>
#include "map/projection.h"
#include "map/transform.h"
#include "mapdata.h"
class TextItem;
namespace ENC {
class RasterTile
{
public:
RasterTile(const Projection &proj, const Transform &transform, int zoom,
const QRect &rect, qreal ratio, const QList<MapData::Line*> &lines,
const QList<MapData::Poly*> &polygons, const QList<MapData::Point*> &points)
: _proj(proj), _transform(transform), _zoom(zoom), _rect(rect),
_ratio(ratio), _pixmap(rect.width() * ratio, rect.height() * ratio),
_lines(lines), _polygons(polygons), _points(points), _valid(false) {}
2022-11-04 09:03:36 +01:00
int zoom() const {return _zoom;}
QPoint xy() const {return _rect.topLeft();}
const QPixmap &pixmap() const {return _pixmap;}
bool isValid() const {return _valid;}
2022-11-04 09:03:36 +01:00
void render();
private:
QPointF ll2xy(const Coordinates &c) const
{return _transform.proj2img(_proj.ll2xy(c));}
QPainterPath painterPath(const Polygon &polygon) const;
QPolygonF polyline(const QVector<Coordinates> &path) const;
2022-12-08 00:29:39 +01:00
QPolygonF tsslptArrow(const Coordinates &c, qreal angle) const;
void processPoints(QList<TextItem*> &textItems, QList<TextItem *> &lights,
QList<QImage*> &images);
2022-11-04 09:03:36 +01:00
void processLines(QList<TextItem*> &textItems);
2022-12-05 08:52:27 +01:00
void processPolygons(QList<TextItem*> &textItems);
2022-11-04 09:03:36 +01:00
void drawBitmapPath(QPainter *painter, const QImage &img,
const Polygon &polygon);
2022-11-14 22:29:27 +01:00
void drawArrows(QPainter *painter);
2022-11-04 09:03:36 +01:00
void drawPolygons(QPainter *painter);
void drawLines(QPainter *painter);
void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems);
Projection _proj;
Transform _transform;
int _zoom;
QRect _rect;
qreal _ratio;
QPixmap _pixmap;
QList<MapData::Line*> _lines;
QList<MapData::Poly*> _polygons;
QList<MapData::Point*> _points;
bool _valid;
2022-11-04 09:03:36 +01:00
};
}
#endif // ENC_RASTERTILE_H