1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00

Fixed map bounds issues

This commit is contained in:
Martin Tůma 2022-07-06 12:50:57 +02:00
parent c79ee01912
commit 90c1e52fb5

View File

@ -71,9 +71,9 @@ OsmdroidMap::OsmdroidMap(const QString &fileName, QObject *parent)
for (quint64 i = 0; i < (quint64)OSM::ZOOMS.max(); i++) { for (quint64 i = 0; i < (quint64)OSM::ZOOMS.max(); i++) {
quint64 key = ((i << i) << i); quint64 key = ((i << i) << i);
if (key < min) if (key <= min)
_zooms.setMin(i); _zooms.setMin(i);
if (key < max) if (key <= max)
_zooms.setMax(i); _zooms.setMax(i);
} }
@ -139,6 +139,10 @@ OsmdroidMap::OsmdroidMap(const QString &fileName, QObject *parent)
tl.rlat() = -tl.lat(); tl.rlat() = -tl.lat();
Coordinates br(OSM::tile2ll(QPoint(r + 1, b + 1), z)); Coordinates br(OSM::tile2ll(QPoint(r + 1, b + 1), z));
br.rlat() = -br.lat(); 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); _bounds = RectC(tl, br);
{ {