1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-07 15:23:22 +02:00
GPXSee/src/map/imgmap.h

73 lines
1.8 KiB
C
Raw Normal View History

2019-05-10 18:56:19 +02:00
#ifndef IMGMAP_H
#define IMGMAP_H
#include "map.h"
#include "projection.h"
#include "transform.h"
2020-02-09 23:24:48 +01:00
#include "IMG/mapdata.h"
2019-05-10 18:56:19 +02:00
class TextItem;
2019-05-10 18:56:19 +02:00
class IMGMap : public Map
{
Q_OBJECT
public:
IMGMap(const QString &fileName, QObject *parent = 0);
2020-02-09 23:24:48 +01:00
~IMGMap() {delete _data;}
2019-05-10 18:56:19 +02:00
2020-02-09 23:24:48 +01:00
QString name() const {return _data->name();}
2019-05-10 18:56:19 +02:00
2020-03-07 19:24:39 +01:00
QRectF bounds() {return _bounds;}
2019-05-10 18:56:19 +02:00
virtual int zoom() const {return _zoom;}
virtual void setZoom(int zoom);
2019-05-10 18:56:19 +02:00
virtual int zoomFit(const QSize &, const RectC &);
virtual int zoomIn();
virtual int zoomOut();
QPointF ll2xy(const Coordinates &c);
Coordinates xy2ll(const QPointF &p);
void draw(QPainter *painter, const QRectF &rect, Flags flags);
void setProjection(const Projection &projection);
2019-07-04 18:18:03 +02:00
void load();
void unload();
2019-05-10 18:56:19 +02:00
bool isValid() const {return _valid;}
QString errorString() const {return _errorString;}
private:
friend class RasterTile;
2019-05-29 18:27:11 +02:00
Transform transform(int zoom) const;
2019-05-10 18:56:19 +02:00
void updateTransform();
2020-02-09 23:24:48 +01:00
void drawPolygons(QPainter *painter, const QList<MapData::Poly> &polygons);
void drawLines(QPainter *painter, const QList<MapData::Poly> &lines);
void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems);
2020-02-09 23:24:48 +01:00
void processPolygons(QList<MapData::Poly> &polygons,
QList<TextItem *> &textItems);
2020-02-09 23:24:48 +01:00
void processLines(QList<MapData::Poly> &lines, const QRect &tileRect,
QList<TextItem*> &textItems);
2020-02-09 23:24:48 +01:00
void processPoints(QList<MapData::Point> &points, QList<TextItem*> &textItems);
void processShields(QList<MapData::Poly> &lines, const QRect &tileRect,
2019-07-13 08:36:04 +02:00
QList<TextItem*> &textItems);
2020-02-09 23:24:48 +01:00
void processStreetNames(QList<MapData::Poly> &lines, const QRect &tileRect,
2019-07-13 08:36:04 +02:00
QList<TextItem*> &textItems);
2019-05-10 18:56:19 +02:00
2020-02-09 23:24:48 +01:00
MapData *_data;
2019-05-10 18:56:19 +02:00
int _zoom;
Projection _projection;
Transform _transform;
2020-03-07 19:24:39 +01:00
QRectF _bounds;
RectC _dataBounds;
2019-07-04 18:18:03 +02:00
2019-05-10 18:56:19 +02:00
bool _valid;
QString _errorString;
};
#endif // IMGMAP_H