2015-11-23 02:33:01 +01:00
|
|
|
#ifndef MAP_H
|
|
|
|
#define MAP_H
|
|
|
|
|
2017-03-18 01:30:31 +01:00
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
|
|
|
#include <QRectF>
|
2018-08-23 20:26:10 +02:00
|
|
|
#include <QFlags>
|
2018-03-06 19:28:07 +01:00
|
|
|
#include "common/coordinates.h"
|
2015-11-26 00:21:11 +01:00
|
|
|
|
2019-05-14 23:01:24 +02:00
|
|
|
|
2017-03-18 01:30:31 +01:00
|
|
|
class QPainter;
|
2017-06-29 22:29:27 +02:00
|
|
|
class RectC;
|
2019-05-14 23:01:24 +02:00
|
|
|
class Projection;
|
2017-02-07 23:36:06 +01:00
|
|
|
|
2015-11-23 02:33:01 +01:00
|
|
|
class Map : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-08-23 20:26:10 +02:00
|
|
|
enum Flag {
|
|
|
|
NoFlags = 0,
|
|
|
|
Block = 1,
|
|
|
|
OpenGL = 2
|
|
|
|
};
|
|
|
|
Q_DECLARE_FLAGS(Flags, Flag)
|
|
|
|
|
2018-05-22 22:40:15 +02:00
|
|
|
Map(QObject *parent = 0) : QObject(parent) {}
|
2018-03-08 00:57:09 +01:00
|
|
|
virtual ~Map() {}
|
2015-11-23 02:33:01 +01:00
|
|
|
|
2018-07-13 09:51:41 +02:00
|
|
|
virtual QString name() const = 0;
|
2016-04-01 19:25:34 +02:00
|
|
|
|
2018-07-13 09:51:41 +02:00
|
|
|
virtual QRectF bounds() = 0;
|
2018-06-30 12:14:58 +02:00
|
|
|
virtual qreal resolution(const QRectF &rect);
|
2015-11-23 02:33:01 +01:00
|
|
|
|
2018-09-10 21:22:57 +02:00
|
|
|
virtual int zoom() const {return 0;}
|
|
|
|
virtual void setZoom(int) {}
|
|
|
|
virtual int zoomFit(const QSize &, const RectC &) {return 0;}
|
|
|
|
virtual int zoomIn() {return 0;}
|
|
|
|
virtual int zoomOut() {return 0;}
|
2015-11-23 02:33:01 +01:00
|
|
|
|
2017-04-30 00:19:53 +02:00
|
|
|
virtual QPointF ll2xy(const Coordinates &c) = 0;
|
|
|
|
virtual Coordinates xy2ll(const QPointF &p) = 0;
|
2016-05-19 01:10:40 +02:00
|
|
|
|
2018-08-23 20:26:10 +02:00
|
|
|
virtual void draw(QPainter *painter, const QRectF &rect, Flags flags) = 0;
|
2016-05-19 01:10:40 +02:00
|
|
|
|
2017-03-18 01:30:31 +01:00
|
|
|
virtual void clearCache() {}
|
|
|
|
virtual void load() {}
|
|
|
|
virtual void unload() {}
|
2018-11-17 10:10:35 +01:00
|
|
|
virtual void setDevicePixelRatio(qreal, qreal) {}
|
2019-05-14 23:01:24 +02:00
|
|
|
virtual void setProjection(const Projection &) {}
|
2017-02-07 23:36:06 +01:00
|
|
|
|
2018-02-20 23:37:19 +01:00
|
|
|
virtual bool isValid() const {return true;}
|
2020-03-17 21:06:51 +01:00
|
|
|
virtual bool isReady() const {return true;}
|
2018-02-20 23:37:19 +01:00
|
|
|
virtual QString errorString() const {return QString();}
|
|
|
|
|
2017-03-18 01:30:31 +01:00
|
|
|
signals:
|
2020-03-17 21:06:51 +01:00
|
|
|
void tilesLoaded();
|
|
|
|
void mapLoaded();
|
2015-11-23 02:33:01 +01:00
|
|
|
};
|
|
|
|
|
2020-03-17 21:06:51 +01:00
|
|
|
Q_DECLARE_METATYPE(Map*)
|
2018-08-23 20:26:10 +02:00
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(Map::Flags)
|
|
|
|
|
2015-11-23 02:33:01 +01:00
|
|
|
#endif // MAP_H
|