1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 13:41:16 +01:00

Fixed single point zoom fit on WMTS maps

This commit is contained in:
Martin Tůma 2018-02-25 19:33:12 +01:00
parent f8c031e931
commit 962310df7d

View File

@ -121,8 +121,6 @@ QRectF WMTSMap::bounds() const
qreal WMTSMap::zoomFit(const QSize &size, const RectC &br) qreal WMTSMap::zoomFit(const QSize &size, const RectC &br)
{ {
_zoom = 0;
if (br.isValid()) { if (br.isValid()) {
QRectF tbr(_projection.ll2xy(br.topLeft()), QRectF tbr(_projection.ll2xy(br.topLeft()),
_projection.ll2xy(br.bottomRight())); _projection.ll2xy(br.bottomRight()));
@ -131,12 +129,14 @@ qreal WMTSMap::zoomFit(const QSize &size, const RectC &br)
if (_projection.isGeographic()) if (_projection.isGeographic())
resolution *= deg2rad(WGS84_RADIUS); resolution *= deg2rad(WGS84_RADIUS);
_zoom = 0;
for (int i = 0; i < _zooms.size(); i++) { for (int i = 0; i < _zooms.size(); i++) {
if (sd2res(_zooms.at(i).scaleDenominator) < resolution) if (sd2res(_zooms.at(i).scaleDenominator) < resolution)
break; break;
_zoom = i; _zoom = i;
} }
} } else
_zoom = _zooms.size() - 1;
updateTransform(); updateTransform();
return _zoom; return _zoom;