2018-03-30 10:25:05 +02:00
|
|
|
#ifndef WMSMAP_H
|
|
|
|
#define WMSMAP_H
|
|
|
|
|
|
|
|
#include "transform.h"
|
|
|
|
#include "projection.h"
|
|
|
|
#include "map.h"
|
|
|
|
#include "wms.h"
|
2018-05-02 21:25:14 +02:00
|
|
|
#include "rectd.h"
|
2018-03-30 10:25:05 +02:00
|
|
|
|
2018-04-28 19:08:21 +02:00
|
|
|
class TileLoader;
|
2018-03-30 10:25:05 +02:00
|
|
|
|
|
|
|
class WMSMap : public Map
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-03-01 13:59:15 +01:00
|
|
|
WMSMap(const QString &name, const WMS::Setup &setup, int tileSize,
|
|
|
|
QObject *parent = 0);
|
2018-03-30 10:25:05 +02:00
|
|
|
|
2018-07-13 09:51:41 +02:00
|
|
|
QString name() const {return _name;}
|
2018-03-30 10:25:05 +02:00
|
|
|
|
2018-07-13 09:51:41 +02:00
|
|
|
QRectF bounds();
|
2018-03-30 10:25:05 +02:00
|
|
|
|
|
|
|
int zoom() const {return _zoom;}
|
2018-04-28 22:18:11 +02:00
|
|
|
void setZoom(int zoom);
|
2018-04-16 20:26:10 +02:00
|
|
|
int zoomFit(const QSize &size, const RectC &rect);
|
2018-03-30 10:25:05 +02:00
|
|
|
int zoomIn();
|
|
|
|
int zoomOut();
|
|
|
|
|
2018-06-30 12:14:58 +02:00
|
|
|
QPointF ll2xy(const Coordinates &c);
|
|
|
|
Coordinates xy2ll(const QPointF &p);
|
2018-03-30 10:25:05 +02:00
|
|
|
|
2018-08-23 20:26:10 +02:00
|
|
|
void draw(QPainter *painter, const QRectF &rect, Flags flags);
|
2018-03-30 10:25:05 +02:00
|
|
|
|
2018-11-17 10:10:35 +01:00
|
|
|
void setDevicePixelRatio(qreal /*deviceRatio*/, qreal mapRatio)
|
|
|
|
{_mapRatio = mapRatio;}
|
2018-03-30 10:25:05 +02:00
|
|
|
void clearCache();
|
|
|
|
|
2020-03-17 21:06:51 +01:00
|
|
|
bool isReady() const {return _wms->isReady();}
|
|
|
|
bool isValid() const {return _wms->isValid();}
|
|
|
|
QString errorString() const {return _wms->errorString();}
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void wmsReady();
|
2018-03-30 10:25:05 +02:00
|
|
|
|
|
|
|
private:
|
2020-03-17 21:06:51 +01:00
|
|
|
QString tileUrl() const;
|
2018-04-13 21:14:12 +02:00
|
|
|
double sd2res(double scaleDenominator) const;
|
2020-03-17 21:06:51 +01:00
|
|
|
void computeZooms();
|
2018-03-30 10:25:05 +02:00
|
|
|
void updateTransform();
|
2018-08-18 21:06:36 +02:00
|
|
|
qreal tileSize() const;
|
2020-03-17 21:06:51 +01:00
|
|
|
void init();
|
2018-03-30 10:25:05 +02:00
|
|
|
|
|
|
|
QString _name;
|
2020-03-17 21:06:51 +01:00
|
|
|
WMS *_wms;
|
2018-04-27 19:31:27 +02:00
|
|
|
TileLoader *_tileLoader;
|
2020-03-17 21:06:51 +01:00
|
|
|
RectD _bounds;
|
2018-03-30 10:25:05 +02:00
|
|
|
Transform _transform;
|
2018-04-13 21:14:12 +02:00
|
|
|
QVector<double> _zooms;
|
2018-04-07 18:42:25 +02:00
|
|
|
int _zoom;
|
2020-03-01 13:59:15 +01:00
|
|
|
int _tileSize;
|
2018-11-17 10:10:35 +01:00
|
|
|
qreal _mapRatio;
|
2018-03-30 10:25:05 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // WMSMAP_H
|