22 #include <QMouseEvent>
30 :
QgsMapTool( canvas ), mZoomOut( zoomOut ), mDragging( false ), mRubberBand( 0 )
33 QPixmap myZoomQPixmap = QPixmap((
const char ** )( zoomOut ?
zoom_out :
zoom_in ) );
34 mCursor = QCursor( myZoomQPixmap, 7, 7 );
45 if ( !( e->buttons() & Qt::LeftButton ) )
66 if ( e->button() != Qt::LeftButton )
75 if ( e->button() != Qt::LeftButton )
134 QgsDebugMsg( QString(
"Extent scaled by %1 to %2" ).arg( sf ).arg( r.
toString().toLocal8Bit().constData() ) );
135 QgsDebugMsg( QString(
"Center of currentExtent after scaling is %1" ).arg( r.
center().
toString().toLocal8Bit().constData() ) );
A rectangle specified with double values.
void zoomWithCenter(int x, int y, bool zoomIn)
Zooms in/out with a given center.
const char * zoom_in[]
Bitmap cursors for map operations.
void setXMaximum(double x)
Set the maximum x value.
void setExtent(const QgsRectangle &r)
Set the extent of the map canvas.
void refresh()
Repaints the canvas map.
Map canvas is a class for displaying all GIS data types on a canvas.
Perform transforms between map coordinates and device coordinates.
A class for drawing transient features (e.g.
void setYMinimum(double y)
Set the minimum y value.
QString toString() const
String representation of the point (x,y)
A class to represent a point geometry.
QgsPoint toMapCoordinates(int x, int y) const
void setToCanvasRectangle(const QRect &rect)
Sets this rubber band to a map canvas rectangle.
void setYMaximum(double y)
Set the maximum y value.
const QgsMapToPixel * getCoordinateTransform()
Get the current coordinate transform.
QgsRectangle extent() const
Returns the current zoom exent of the map canvas.
void normalize()
Normalize the rectangle so it has non-negative width/height.
double width() const
Width of the rectangle.
QString toString(bool automaticPrecision=false) const
returns string representation of form xmin,ymin xmax,ymax
QgsPoint center() const
Center point of the rectangle.
void setXMinimum(double x)
Set the minimum x value.
double height() const
Height of the rectangle.
void scale(double scaleFactor, const QgsPoint *c=0)
Scale the rectangle around its center point.