diff --git a/src/map/imgmap.cpp b/src/map/imgmap.cpp index 9293f714..33077095 100644 --- a/src/map/imgmap.cpp +++ b/src/map/imgmap.cpp @@ -260,13 +260,6 @@ void IMGMap::unload() _data->clear(); } -QRectF IMGMap::bounds() -{ - RectD prect(_data->bounds(), _projection); - return QRectF(_transform.proj2img(prect.topLeft()), - _transform.proj2img(prect.bottomRight())); -} - int IMGMap::zoomFit(const QSize &size, const RectC &rect) { if (rect.isValid()) { @@ -320,6 +313,10 @@ Transform IMGMap::transform(int zoom) const void IMGMap::updateTransform() { _transform = transform(_zoom); + + RectD prect(_data->bounds(), _projection); + _bounds = QRectF(_transform.proj2img(prect.topLeft()), + _transform.proj2img(prect.bottomRight())); } QPointF IMGMap::ll2xy(const Coordinates &c) diff --git a/src/map/imgmap.h b/src/map/imgmap.h index 03dec65b..1618fe36 100644 --- a/src/map/imgmap.h +++ b/src/map/imgmap.h @@ -18,7 +18,7 @@ public: QString name() const {return _data->name();} - QRectF bounds(); + QRectF bounds() {return _bounds;} virtual int zoom() const {return _zoom;} virtual void setZoom(int zoom); @@ -62,6 +62,7 @@ private: int _zoom; Projection _projection; Transform _transform; + QRectF _bounds; bool _valid; QString _errorString;