1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-25 04:05:53 +01:00
GPXSee/src/map/wmtsmap.h
Martin Tůma 97e12d809f Map API refactoring
Including several map providers refactoring/rewrite
especial KML, JNX and TrekBuddy atlases.
2023-05-04 09:38:35 +02:00

67 lines
1.4 KiB
C++

#ifndef WMTSMAP_H
#define WMTSMAP_H
#include "transform.h"
#include "projection.h"
#include "map.h"
#include "rectd.h"
#include "wmts.h"
class TileLoader;
class WMTSMap : public Map
{
Q_OBJECT
public:
WMTSMap(const QString &fileName, const QString &name,
const WMTS::Setup &setup, qreal tileRatio, QObject *parent = 0);
QString name() const {return _name;}
QRectF bounds();
RectC llBounds(const Projection &);
int zoom() const {return _zoom;}
void setZoom(int zoom);
int zoomFit(const QSize &size, const RectC &rect);
int zoomIn();
int zoomOut();
QPointF ll2xy(const Coordinates &c);
Coordinates xy2ll(const QPointF &p);
void draw(QPainter *painter, const QRectF &rect, Flags flags);
void load(const Projection &in, const Projection &out, qreal deviceRatio,
bool hidpi);
void clearCache();
bool isReady() const {return _wmts->isReady();}
bool isValid() const {return _wmts->isValid();}
QString errorString() const {return _wmts->errorString();}
private slots:
void wmtsReady();
private:
double sd2res(double scaleDenominator) const;
Transform transform(int zoom) const;
QRectF tileBounds(int zoom) const;
void updateTransform();
QSizeF tileSize(const WMTS::Zoom &zoom) const;
qreal coordinatesRatio() const;
qreal imageRatio() const;
void init();
QString _name;
WMTS *_wmts;
TileLoader *_tileLoader;
Transform _transform;
RectD _bounds;
int _zoom;
qreal _mapRatio, _tileRatio;
};
#endif // WMTSMAP_H