1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 19:55:53 +01:00
GPXSee/src/map/onlinemap.h

58 lines
1.2 KiB
C
Raw Normal View History

#ifndef ONLINEMAP_H
#define ONLINEMAP_H
2017-11-26 18:54:03 +01:00
#include "common/range.h"
#include "common/rectc.h"
#include "map.h"
2018-02-20 23:37:19 +01:00
#include "tileloader.h"
class OnlineMap : public Map
{
Q_OBJECT
public:
OnlineMap(const QString &name, const QString &url, const Range &zooms,
2018-08-18 21:06:36 +02:00
const RectC &bounds, qreal tileRatio, const Authorization &authorization,
2018-04-27 21:13:10 +02:00
QObject *parent = 0);
2018-07-13 09:51:41 +02:00
QString name() const {return _name;}
2018-07-13 09:51:41 +02:00
QRectF bounds();
qreal resolution(const QRectF &rect);
int zoom() const {return _zoom;}
2018-04-28 22:18:11 +02:00
void setZoom(int zoom) {_zoom = zoom;}
int zoomFit(const QSize &size, const RectC &rect);
int zoomIn();
int zoomOut();
2018-07-13 09:51:41 +02:00
QPointF ll2xy(const Coordinates &c);
Coordinates xy2ll(const QPointF &p);
2018-04-28 16:07:32 +02:00
void draw(QPainter *painter, const QRectF &rect, bool block);
2018-08-18 21:06:36 +02:00
void setDevicePixelRatio(qreal ratio) {_deviceRatio = ratio;}
void clearCache() {_tileLoader->clearCache();}
2017-10-04 23:15:39 +02:00
2018-02-25 02:31:01 +01:00
bool isValid() const {return _valid;}
QString errorString() const {return _errorString;}
private:
int limitZoom(int zoom) const;
2018-08-18 21:06:36 +02:00
qreal tileSize() const;
qreal coordinatesRatio() const;
qreal imageRatio() const;
TileLoader *_tileLoader;
QString _name;
Range _zooms;
RectC _bounds;
int _zoom;
2018-08-18 21:06:36 +02:00
qreal _deviceRatio, _tileRatio;
2018-02-25 02:31:01 +01:00
bool _valid;
QString _errorString;
};
#endif // ONLINEMAP_H