1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-03-14 19:17:44 +01:00
GPXSee/src/map/ENC/rastertile.h

75 lines
2.2 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 "common/range.h"
2022-11-04 09:03:36 +01:00
#include "map/projection.h"
#include "map/transform.h"
#include "map/textpointitem.h"
2022-11-04 09:03:36 +01:00
#include "mapdata.h"
#include "style.h"
#include "atlasdata.h"
2022-11-04 09:03:36 +01:00
class TextItem;
namespace ENC {
class RasterTile
{
public:
2023-03-24 22:54:53 +01:00
RasterTile(const Projection &proj, const Transform &transform,
const MapData *data, int zoom, const Range &zoomRange, const QRect &rect,
qreal ratio);
RasterTile(const Projection &proj, const Transform &transform,
AtlasData *data, int zoom, const Range &zoomRange, const QRect &rect,
qreal ratio);
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:
void fetchData(QList<MapData::Poly> &polygons, QList<MapData::Line> &lines,
QList<MapData::Point> &points);
2022-11-04 09:03:36 +01:00
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;
QVector<QPolygonF> polylineM(const QVector<Coordinates> &path) const;
2022-12-08 00:29:39 +01:00
QPolygonF tsslptArrow(const Coordinates &c, qreal angle) const;
void processPoints(QList<MapData::Point> &points,
QList<TextItem*> &textItems, QList<TextItem *> &lights);
void processLines(const QList<MapData::Line> &lines,
QList<TextItem*> &textItems);
void processPolygons(const QList<MapData::Poly> &polygons,
QList<TextItem*> &textItems);
2022-11-04 09:03:36 +01:00
void drawBitmapPath(QPainter *painter, const QImage &img,
const Polygon &polygon);
void drawArrows(QPainter *painter, const QList<MapData::Poly> &polygons);
void drawPolygons(QPainter *painter, const QList<MapData::Poly> &polygons);
void drawLines(QPainter *painter, const QList<MapData::Line> &lines);
2022-11-04 09:03:36 +01:00
void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems);
static bool polyCb(MapData *data, void *context);
static bool pointCb(MapData *data, void *context);
2022-11-04 09:03:36 +01:00
Projection _proj;
Transform _transform;
const Style *_style;
const MapData *_map;
AtlasData *_atlas;
2022-11-04 09:03:36 +01:00
int _zoom;
Range _zoomRange;
2022-11-04 09:03:36 +01:00
QRect _rect;
qreal _ratio;
QPixmap _pixmap;
bool _valid;
2022-11-04 09:03:36 +01:00
};
}
#endif // ENC_RASTERTILE_H