1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Apply the Mapsforge maps zoom levels offset

Offset the Mapsforge zoom level when fetching data/rendering the tiles to get
the expected data/sizes/widths for the tiles at the given zoom level.
This commit is contained in:
Martin Tůma 2023-08-05 18:56:55 +02:00
parent 8ab728f81d
commit d064cedbbe

View File

@ -14,13 +14,16 @@ namespace Mapsforge {
class RasterTile class RasterTile
{ {
public: public:
/* Mapsforge maps zoom levels are offset by one against the standard OSM
zoom levels! We decrease the zoom level internaly here when initializing
_zoom and return the propper/increased value back in zoom() */
RasterTile(const Projection &proj, const Transform &transform, RasterTile(const Projection &proj, const Transform &transform,
const Style *style, MapData *data, int zoom, const QRect &rect, const Style *style, MapData *data, int zoom, const QRect &rect,
qreal ratio) : _proj(proj), _transform(transform), _style(style), qreal ratio) : _proj(proj), _transform(transform), _style(style),
_data(data), _zoom(zoom), _rect(rect), _ratio(ratio), _data(data), _zoom(zoom - 1), _rect(rect), _ratio(ratio),
_pixmap(rect.width() * ratio, rect.height() * ratio), _valid(false) {} _pixmap(rect.width() * ratio, rect.height() * ratio), _valid(false) {}
int zoom() const {return _zoom;} int zoom() const {return _zoom + 1;}
QPoint xy() const {return _rect.topLeft();} QPoint xy() const {return _rect.topLeft();}
const QPixmap &pixmap() const {return _pixmap;} const QPixmap &pixmap() const {return _pixmap;}
bool isValid() const {return _valid;} bool isValid() const {return _valid;}