### Eclipse Workspace Patch 1.0 #P qgis Index: src/gui/qgsmapcanvas.h =================================================================== --- src/gui/qgsmapcanvas.h (revision 13475) +++ src/gui/qgsmapcanvas.h (working copy) @@ -231,6 +231,9 @@ //! Zoom with the factor supplied. Factor > 1 zooms out, interval (0,1) zooms in void zoomByFactor( double scaleFactor ); + //! Zoom to a specific scale + void zoomScale(double scale); + //! Zooms in/out with a given center void zoomWithCenter( int x, int y, bool zoomIn ); Index: src/gui/qgsmapcanvas.cpp =================================================================== --- src/gui/qgsmapcanvas.cpp (revision 13475) +++ src/gui/qgsmapcanvas.cpp (working copy) @@ -1432,6 +1432,14 @@ refresh(); } + +void QgsMapCanvas::zoomScale(double scale) +{ + // Since it is an adjustment of scale, we do: + double factor = scale / mMapRenderer->scale(); + this->zoomByFactor(factor); +} + void QgsMapCanvas::selectionChangedSlot() { // Find out which layer it was that sent the signal.