1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-25 04:05:53 +01:00
GPXSee/src/map/wmtsmap.h

67 lines
1.4 KiB
C
Raw Normal View History

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"
#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();
RectC llBounds(const Projection &);
2018-02-20 23:37:19 +01:00
int zoom() const {return _zoom;}
2018-04-28 22:18:11 +02:00
void setZoom(int zoom);
int zoomFit(const QSize &size, const RectC &rect);
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
void load(const Projection &in, const Projection &out, qreal deviceRatio,
bool hidpi);
2018-02-20 23:37:19 +01:00
void clearCache();
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:
double sd2res(double scaleDenominator) const;
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;
void init();
2018-02-20 23:37:19 +01:00
2018-02-25 02:31:01 +01:00
QString _name;
WMTS *_wmts;
TileLoader *_tileLoader;
2018-03-22 20:00:30 +01:00
Transform _transform;
RectD _bounds;
2018-02-20 23:37:19 +01:00
int _zoom;
qreal _mapRatio, _tileRatio;
2018-02-20 23:37:19 +01:00
};
#endif // WMTSMAP_H