2022-07-05 11:32:14 +02:00
|
|
|
#ifndef OSMDROIDMAP_H
|
|
|
|
#define OSMDROIDMAP_H
|
|
|
|
|
|
|
|
#include <QSqlDatabase>
|
|
|
|
#include "common/range.h"
|
|
|
|
#include "map.h"
|
|
|
|
|
|
|
|
class OsmdroidMap : public Map
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
OsmdroidMap(const QString &fileName, QObject *parent = 0);
|
|
|
|
|
|
|
|
QRectF bounds();
|
2023-09-14 18:36:03 +02:00
|
|
|
RectC llBounds() {return _bounds;}
|
2022-07-05 11:32:14 +02:00
|
|
|
qreal resolution(const QRectF &rect);
|
|
|
|
|
|
|
|
int zoom() const {return _zoom;}
|
|
|
|
void setZoom(int zoom) {_zoom = 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);
|
|
|
|
|
2023-05-04 09:38:35 +02:00
|
|
|
void load(const Projection &in, const Projection &out, qreal deviceRatio,
|
|
|
|
bool hidpi);
|
2022-07-05 11:32:14 +02:00
|
|
|
void unload();
|
|
|
|
|
|
|
|
bool isValid() const {return _valid;}
|
|
|
|
QString errorString() const {return _errorString;}
|
|
|
|
|
2023-09-14 18:36:03 +02:00
|
|
|
static Map *create(const QString &path, const Projection &proj, bool *isDir);
|
2022-07-05 11:32:14 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
int limitZoom(int zoom) const;
|
|
|
|
qreal tileSize() const;
|
|
|
|
QByteArray tileData(int zoom, const QPoint &tile) const;
|
|
|
|
void drawTile(QPainter *painter, QPixmap &pixmap, QPointF &tp);
|
|
|
|
|
|
|
|
QSqlDatabase _db;
|
|
|
|
|
|
|
|
RectC _bounds;
|
|
|
|
Range _zooms;
|
|
|
|
int _zoom;
|
|
|
|
int _tileSize;
|
|
|
|
qreal _mapRatio;
|
|
|
|
|
|
|
|
bool _valid;
|
|
|
|
QString _errorString;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // OSMDROIDMAP_H
|