1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-12-04 08:19:10 +01:00
GPXSee/src/map/map.h

65 lines
1.3 KiB
C
Raw Normal View History

2015-11-23 02:33:01 +01:00
#ifndef MAP_H
#define MAP_H
#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
class QPainter;
class RectC;
class Projection;
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;
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;
2018-08-23 20:26:10 +02:00
virtual void draw(QPainter *painter, const QRectF &rect, Flags flags) = 0;
virtual void clearCache() {}
virtual void load() {}
virtual void unload() {}
virtual void setDevicePixelRatio(qreal, qreal) {}
virtual void setProjection(const Projection &) {}
2018-02-20 23:37:19 +01:00
virtual bool isValid() const {return true;}
virtual bool isReady() const {return true;}
2018-02-20 23:37:19 +01:00
virtual QString errorString() const {return QString();}
signals:
void tilesLoaded();
void mapLoaded();
2015-11-23 02:33:01 +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