2018-02-20 23:37:19 +01:00
|
|
|
#ifndef WMTSMAP_H
|
|
|
|
#define WMTSMAP_H
|
|
|
|
|
2018-03-22 20:00:30 +01:00
|
|
|
#include "transform.h"
|
2018-02-20 23:37:19 +01:00
|
|
|
#include "projection.h"
|
|
|
|
#include "map.h"
|
2019-01-08 21:42:28 +01:00
|
|
|
#include "rectd.h"
|
2018-02-20 23:37:19 +01:00
|
|
|
#include "wmts.h"
|
|
|
|
|
2018-04-28 19:08:21 +02:00
|
|
|
class TileLoader;
|
2018-02-20 23:37:19 +01:00
|
|
|
|
|
|
|
class WMTSMap : public Map
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-12-02 23:58:11 +01:00
|
|
|
WMTSMap(const QString &fileName, const QString &name,
|
|
|
|
const WMTS::Setup &setup, qreal tileRatio, QObject *parent = 0);
|
2018-02-20 23:37:19 +01:00
|
|
|
|
2018-07-13 09:51:41 +02:00
|
|
|
QString name() const {return _name;}
|
2018-02-20 23:37:19 +01:00
|
|
|
|
2018-07-13 09:51:41 +02:00
|
|
|
QRectF bounds();
|
2023-05-04 09:38:35 +02:00
|
|
|
RectC llBounds(const Projection &);
|
2018-02-20 23:37:19 +01:00
|
|
|
|
2018-02-28 22:19:46 +01: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-02-28 22:19:46 +01:00
|
|
|
int zoomIn();
|
|
|
|
int zoomOut();
|
2018-02-20 23:37:19 +01:00
|
|
|
|
2018-07-13 09:51:41 +02:00
|
|
|
QPointF ll2xy(const Coordinates &c);
|
|
|
|
Coordinates xy2ll(const QPointF &p);
|
2018-02-20 23:37:19 +01:00
|
|
|
|
2018-08-23 20:26:10 +02:00
|
|
|
void draw(QPainter *painter, const QRectF &rect, Flags flags);
|
2018-02-20 23:37:19 +01:00
|
|
|
|
2023-05-04 09:38:35 +02:00
|
|
|
void load(const Projection &in, const Projection &out, qreal deviceRatio,
|
|
|
|
bool hidpi);
|
2018-02-20 23:37:19 +01:00
|
|
|
void clearCache();
|
|
|
|
|
2020-03-17 21:06:51 +01:00
|
|
|
bool isReady() const {return _wmts->isReady();}
|
|
|
|
bool isValid() const {return _wmts->isValid();}
|
|
|
|
QString errorString() const {return _wmts->errorString();}
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void wmtsReady();
|
2018-02-20 23:37:19 +01:00
|
|
|
|
|
|
|
private:
|
2018-04-13 21:14:12 +02:00
|
|
|
double sd2res(double scaleDenominator) const;
|
2020-12-14 22:06:59 +01:00
|
|
|
Transform transform(int zoom) const;
|
|
|
|
QRectF tileBounds(int zoom) const;
|
2018-02-20 23:37:19 +01:00
|
|
|
void updateTransform();
|
2018-08-18 21:06:36 +02:00
|
|
|
QSizeF tileSize(const WMTS::Zoom &zoom) const;
|
|
|
|
qreal coordinatesRatio() const;
|
|
|
|
qreal imageRatio() const;
|
2020-03-17 21:06:51 +01:00
|
|
|
void init();
|
2018-02-20 23:37:19 +01:00
|
|
|
|
2018-02-25 02:31:01 +01:00
|
|
|
QString _name;
|
2020-03-17 21:06:51 +01:00
|
|
|
WMTS *_wmts;
|
2018-04-27 19:31:27 +02:00
|
|
|
TileLoader *_tileLoader;
|
2018-03-22 20:00:30 +01:00
|
|
|
Transform _transform;
|
2020-03-17 21:06:51 +01:00
|
|
|
RectD _bounds;
|
2018-02-20 23:37:19 +01:00
|
|
|
int _zoom;
|
2018-11-17 10:10:35 +01:00
|
|
|
qreal _mapRatio, _tileRatio;
|
2018-02-20 23:37:19 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // WMTSMAP_H
|