2017-03-18 01:30:31 +01:00
|
|
|
#ifndef ONLINEMAP_H
|
|
|
|
#define ONLINEMAP_H
|
|
|
|
|
2017-11-26 18:54:03 +01:00
|
|
|
#include "common/range.h"
|
2018-01-28 22:56:08 +01:00
|
|
|
#include "common/rectc.h"
|
2017-03-18 01:30:31 +01:00
|
|
|
#include "map.h"
|
2018-02-20 23:37:19 +01:00
|
|
|
#include "tileloader.h"
|
2017-03-18 01:30:31 +01:00
|
|
|
|
|
|
|
class OnlineMap : public Map
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-12-02 23:58:11 +01:00
|
|
|
OnlineMap(const QString &fileName, const QString &name, const QString &url,
|
|
|
|
const Range &zooms, const RectC &bounds, qreal tileRatio,
|
|
|
|
const Authorization &authorization, int tileSize, bool scalable,
|
|
|
|
bool invertY, bool quadTiles, QObject *parent = 0);
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2018-07-13 09:51:41 +02:00
|
|
|
QString name() const {return _name;}
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2018-07-13 09:51:41 +02:00
|
|
|
QRectF bounds();
|
2023-05-04 09:38:35 +02:00
|
|
|
RectC llBounds(const Projection &) {return _bounds;}
|
2018-06-30 12:14:58 +02:00
|
|
|
qreal resolution(const QRectF &rect);
|
2017-03-18 01:30:31 +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) {_zoom = 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();
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2018-07-13 09:51:41 +02:00
|
|
|
QPointF ll2xy(const Coordinates &c);
|
|
|
|
Coordinates xy2ll(const QPointF &p);
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2018-08-23 20:26:10 +02:00
|
|
|
void draw(QPainter *painter, const QRectF &rect, Flags flags);
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2023-05-04 09:38:35 +02:00
|
|
|
void load(const Projection &in, const Projection &out, qreal deviceRatio,
|
|
|
|
bool hidpi);
|
2018-04-27 19:31:27 +02:00
|
|
|
void clearCache() {_tileLoader->clearCache();}
|
2017-10-04 23:15:39 +02:00
|
|
|
|
2017-03-18 01:30:31 +01:00
|
|
|
private:
|
2017-09-09 12:33:43 +02:00
|
|
|
int limitZoom(int zoom) const;
|
2018-08-18 21:06:36 +02:00
|
|
|
qreal tileSize() const;
|
|
|
|
qreal coordinatesRatio() const;
|
|
|
|
qreal imageRatio() const;
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2018-04-27 19:31:27 +02:00
|
|
|
TileLoader *_tileLoader;
|
2017-03-18 01:30:31 +01:00
|
|
|
QString _name;
|
2018-01-28 22:56:08 +01:00
|
|
|
Range _zooms;
|
|
|
|
RectC _bounds;
|
|
|
|
int _zoom;
|
2018-11-17 10:10:35 +01:00
|
|
|
int _tileSize;
|
2023-05-04 09:38:35 +02:00
|
|
|
qreal _mapRatio, _tileRatio;
|
2018-11-15 00:38:03 +01:00
|
|
|
bool _scalable;
|
2018-09-22 13:32:54 +02:00
|
|
|
bool _invertY;
|
2017-03-18 01:30:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ONLINEMAP_H
|