Skip to content
Permalink
Browse files

Renamed ambiguous functions QgsMapCanvas::zoom to zoomIn, zoomOut and…

… zoomByFactor.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9691 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Nov 24, 2008
1 parent 5bbe9b1 commit ab9a1b1139509f63f476951aa27cc52cd232ec16
Showing with 31 additions and 19 deletions.
  1. +8 −2 python/gui/qgsmapcanvas.sip
  2. +1 −1 src/app/legend/qgslegend.cpp
  3. +1 −1 src/app/qgisapp.cpp
  4. +13 −10 src/gui/qgsmapcanvas.cpp
  5. +8 −5 src/gui/qgsmapcanvas.h
@@ -155,8 +155,14 @@ class QgsMapCanvas : QGraphicsView
//! set wheel action and zoom factor (should be greater than 1)
void setWheelAction(WheelAction action, double factor = 2);

//! Zooms in/out preserving
void zoom(bool zoomIn);
//! Zoom in with fixed factor
void zoomIn( );

//! Zoom out with fixed factor
void zoomOut( );

//! Zoom with the factor supplied. Factor > 1 zooms in
void zoomByFactor( double scaleFactor );

//! Zooms in/out with a given center
void zoomWithCenter(int x, int y, bool zoomIn);
@@ -1821,7 +1821,7 @@ void QgsLegend::legendLayerZoomNative()
QgsDebugMsg( "Raster units per pixel : " + QString::number( layer->rasterUnitsPerPixel() ) );
QgsDebugMsg( "MapUnitsPerPixel before : " + QString::number( mMapCanvas->mapUnitsPerPixel() ) );

mMapCanvas->zoom( fabs( layer->rasterUnitsPerPixel() / mMapCanvas->mapUnitsPerPixel() ) );
mMapCanvas->zoomByFactor( fabs( layer->rasterUnitsPerPixel() / mMapCanvas->mapUnitsPerPixel() ) );
mMapCanvas->refresh();

QgsDebugMsg( "MapUnitsPerPixel after : " + QString::number( mMapCanvas->mapUnitsPerPixel() ) );
@@ -3980,7 +3980,7 @@ void QgisApp::userScale()
if ( leftSide > 0.0 && leftOk && rightOk )
{
double wantedScale = rightSide / leftSide;
mMapCanvas->zoom( wantedScale / currentScale );
mMapCanvas->zoomByFactor( wantedScale / currentScale );
}
}
}
@@ -658,12 +658,12 @@ void QgsMapCanvas::keyPressEvent( QKeyEvent * e )

case Qt::Key_PageUp:
QgsDebugMsg( "Zoom in" );
zoom( true );
zoomIn();
break;

case Qt::Key_PageDown:
QgsDebugMsg( "Zoom out" );
zoom( false );
zoomOut();
break;

default:
@@ -860,7 +860,10 @@ void QgsMapCanvas::wheelEvent( QWheelEvent *e )
{
case WheelZoom:
// zoom without changing extent
zoom( e->delta() > 0 );
if (e->delta() > 0)
zoomIn();
else
zoomOut();
break;

case WheelZoomAndRecenter:
@@ -898,14 +901,14 @@ void QgsMapCanvas::setWheelAction( WheelAction action, double factor )
mWheelZoomFactor = factor;
}

void QgsMapCanvas::zoom( bool zoomIn )
void QgsMapCanvas::zoomIn()
{
double scaleFactor = ( zoomIn ? 1 / mWheelZoomFactor : mWheelZoomFactor );
zoomByFactor( 1 / mWheelZoomFactor );
}

QgsRectangle r = mMapRenderer->extent();
r.scale( scaleFactor );
setExtent( r );
refresh();
void QgsMapCanvas::zoomOut()
{
zoomByFactor( mWheelZoomFactor );
}

void QgsMapCanvas::zoomWithCenter( int x, int y, bool zoomIn )
@@ -1265,7 +1268,7 @@ void QgsMapCanvas::writeProject( QDomDocument & doc )

}

void QgsMapCanvas::zoom( double scaleFactor )
void QgsMapCanvas::zoomByFactor( double scaleFactor )
{
if ( mDrawing )
{
@@ -210,8 +210,14 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! set wheel action and zoom factor (should be greater than 1)
void setWheelAction( WheelAction action, double factor = 2 );

//! Zooms in/out preserving
void zoom( bool zoomIn );
//! Zoom in with fixed factor
void zoomIn( );

//! Zoom out with fixed factor
void zoomOut( );

//! Zoom with the factor supplied. Factor > 1 zooms in
void zoomByFactor( double scaleFactor );

//! Zooms in/out with a given center
void zoomWithCenter( int x, int y, bool zoomIn );
@@ -233,9 +239,6 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! returns last position of mouse cursor
QPoint mouseLastXY();

//! zooms with the factor supplied. Factor > 1 zooms in
void zoom( double scaleFactor );

public slots:

/**Repaints the canvas map*/

0 comments on commit ab9a1b1

Please sign in to comment.
You can’t perform that action at this time.