From 03711ede9770bcd36fa6f19d29a0dd48f8013f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sun, 13 Aug 2023 13:00:05 +0200 Subject: [PATCH] Re-introduce the zoom level offset Most Mapsforge themes expect the zoom levels to be offset by one from the standard OSM zoom levels. Additionally, the rendering is much faster which always helps when dealing with a format that slow like Mapsforge... --- src/map/mapsforge/rastertile.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/map/mapsforge/rastertile.h b/src/map/mapsforge/rastertile.h index 1f912418..6f8ddae1 100644 --- a/src/map/mapsforge/rastertile.h +++ b/src/map/mapsforge/rastertile.h @@ -14,13 +14,17 @@ namespace Mapsforge { class RasterTile { public: + /* Most Mapsforge themes expect the zoom levels to be offset by one from + 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, const Style *style, MapData *data, int zoom, const QRect &rect, 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) {} - int zoom() const {return _zoom;} + int zoom() const {return _zoom + 1;} QPoint xy() const {return _rect.topLeft();} const QPixmap &pixmap() const {return _pixmap;} bool isValid() const {return _valid;}