From 90c1e52fb5fcf8fceafd6225deac12028eff89f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 6 Jul 2022 12:50:57 +0200 Subject: [PATCH] Fixed map bounds issues --- src/map/osmdroidmap.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/map/osmdroidmap.cpp b/src/map/osmdroidmap.cpp index e7571be7..0a163a5a 100644 --- a/src/map/osmdroidmap.cpp +++ b/src/map/osmdroidmap.cpp @@ -71,9 +71,9 @@ OsmdroidMap::OsmdroidMap(const QString &fileName, QObject *parent) for (quint64 i = 0; i < (quint64)OSM::ZOOMS.max(); i++) { quint64 key = ((i << i) << i); - if (key < min) + if (key <= min) _zooms.setMin(i); - if (key < max) + if (key <= max) _zooms.setMax(i); } @@ -139,6 +139,10 @@ OsmdroidMap::OsmdroidMap(const QString &fileName, QObject *parent) tl.rlat() = -tl.lat(); Coordinates br(OSM::tile2ll(QPoint(r + 1, b + 1), z)); br.rlat() = -br.lat(); + // Workaround of broken zoom levels 0 and 1 due to numerical + // instability + tl.rlat() = qMin(tl.lat(), OSM::BOUNDS.top()); + br.rlat() = qMax(br.lat(), OSM::BOUNDS.bottom()); _bounds = RectC(tl, br); {