1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-07 07:13:21 +02:00
GPXSee/src/map/wmtsmap.h

65 lines
1.3 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 "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:
2018-08-18 21:06:36 +02:00
WMTSMap(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();
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
2018-08-18 21:06:36 +02:00
void setDevicePixelRatio(qreal ratio) {_deviceRatio = ratio;}
2018-02-20 23:37:19 +01:00
void clearCache();
bool isValid() const {return _valid;}
QString errorString() const {return _errorString;}
private:
bool loadWMTS();
double sd2res(double scaleDenominator) const;
QString tilesDir() 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;
2018-02-20 23:37:19 +01:00
2018-02-25 02:31:01 +01:00
QString _name;
WMTS::Setup _setup;
TileLoader *_tileLoader;
RectC _bounds;
2018-02-20 23:37:19 +01:00
QList<WMTS::Zoom> _zooms;
Projection _projection;
2018-03-22 20:00:30 +01:00
Transform _transform;
2018-04-07 18:42:25 +02:00
CoordinateSystem _cs;
2018-02-20 23:37:19 +01:00
int _zoom;
2018-08-18 21:06:36 +02:00
qreal _deviceRatio, _tileRatio;
2018-02-20 23:37:19 +01:00
bool _valid;
QString _errorString;
};
#endif // WMTSMAP_H