QGIS API Documentation 4.1.0-Master (009143bf4b4)
Loading...
Searching...
No Matches
qgsmaptoolzoom.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmaptoolzoom.h - map tool for zooming
3 ----------------------
4 begin : January 2006
5 copyright : (C) 2006 by Martin Dobias
6 email : wonder.sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSMAPTOOLZOOM_H
17#define QGSMAPTOOLZOOM_H
18
19#include "qgis_gui.h"
20#include "qgsmaptool.h"
21#include "qobjectuniqueptr.h"
22
23#include <QRect>
24
25class QgsRubberBand;
26
32class GUI_EXPORT QgsMapToolZoom : public QgsMapTool
33{
34 Q_OBJECT
35
36 public:
38 QgsMapToolZoom( QgsMapCanvas *canvas, bool zoomOut );
39 ~QgsMapToolZoom() override;
40
41 Flags flags() const override;
42 void canvasMoveEvent( QgsMapMouseEvent *e ) override;
43 void canvasPressEvent( QgsMapMouseEvent *e ) override;
44 void canvasReleaseEvent( QgsMapMouseEvent *e ) override;
45 void keyPressEvent( QKeyEvent *e ) override;
46 void keyReleaseEvent( QKeyEvent *e ) override;
47 void deactivate() override;
48
49 protected:
51 QRect mZoomRect;
52 // minimum pixel size of diagonal of the zoom rectangle
53 int mMinPixelZoom = 20;
54
59
61 bool mDragging = false;
62
64 bool mCanceled = false;
65
67
70
71 private:
72 void setZoomMode( bool zoomOut, bool force = false );
73};
74
75#endif
Keeps a pointer to a QObject and deletes it whenever this object is deleted.
A mouse event which is the result of a user interaction with a QgsMapCanvas.
bool mDragging
Flag to indicate a map canvas drag operation is taking place.
bool mNativeZoomOut
native tool
QRect mZoomRect
stores actual zoom rect
bool mCanceled
Flag to indicate the user has canceled the current zoom operation.
QCursor mZoomOutCursor
QCursor mZoomInCursor
QgsMapToolZoom(QgsMapCanvas *canvas, bool zoomOut)
constructor
bool mZoomOut
indicates whether we're zooming in or out
QObjectUniquePtr< QgsRubberBand > mRubberBand
QgsMapCanvas * canvas() const
returns pointer to the tool's map canvas
QgsMapTool(QgsMapCanvas *canvas)
Constructor takes a map canvas as a parameter.
QFlags< Flag > Flags
Definition qgsmaptool.h:116
friend class QgsMapCanvas
Definition qgsmaptool.h:400
virtual void canvasPressEvent(QgsMapMouseEvent *e)
Mouse press event for overriding. Default implementation does nothing.
virtual void canvasMoveEvent(QgsMapMouseEvent *e)
Mouse move event for overriding. Default implementation does nothing.
virtual void keyPressEvent(QKeyEvent *e)
Key event for overriding. Default implementation does nothing.
virtual void keyReleaseEvent(QKeyEvent *e)
Key event for overriding. Default implementation does nothing.
virtual Flags flags() const
Returns the flags for the map tool.
Definition qgsmaptool.h:121
virtual void canvasReleaseEvent(QgsMapMouseEvent *e)
Mouse release event for overriding. Default implementation does nothing.
virtual void deactivate()
called when map tool is being deactivated
Responsible for drawing transient features (e.g.