1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-21 14:24:24 +02:00

Limit the map bounds properly based on projection, not a magic height

This commit is contained in:
2020-04-21 23:26:35 +02:00
parent cbe312d9c8
commit c1584f30d2
27 changed files with 162 additions and 20 deletions

View File

@ -245,11 +245,7 @@ IMGMap::IMGMap(const QString &fileName, QObject *parent)
return;
}
// Limit world maps bounds so that the maps can be projected using
// the default Web Mercator projection
_dataBounds = (_data->bounds().height() > 120)
? _data->bounds() & OSM::BOUNDS : _data->bounds();
_dataBounds = _data->bounds() & OSM::BOUNDS;
_zoom = _data->zooms().min();
updateTransform();
@ -631,7 +627,16 @@ void IMGMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
void IMGMap::setProjection(const Projection &projection)
{
if (projection == _projection)
return;
_projection = projection;
// Limit the bounds for some well known Mercator projections
// (GARMIN world maps have N/S bounds up to 90/-90!)
_dataBounds = (_projection == PCS::pcs(3857)
|| _projection == PCS::pcs(3395))
? _data->bounds() & OSM::BOUNDS : _data->bounds();
updateTransform();
QPixmapCache::clear();
}