QGIS API Documentation  3.0.2-Girona (307d082)
qgsmaptooladvanceddigitizing.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaptooladvanceddigitizing.h - map tool with event in map coordinates
3  ----------------------
4  begin : October 2014
5  copyright : (C) Denis Rouzaud
6  email : [email protected]
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 
17 #ifndef QGSMAPTOOLADVANCEDDIGITIZE_H
18 #define QGSMAPTOOLADVANCEDDIGITIZE_H
19 
20 #include "qgsmaptooledit.h"
21 #include "qgis_gui.h"
22 
23 class QgsMapMouseEvent;
25 
36 {
37  Q_OBJECT
38  public:
39 
46 
48  void canvasPressEvent( QgsMapMouseEvent *e ) override;
50  void canvasReleaseEvent( QgsMapMouseEvent *e ) override;
52  void canvasMoveEvent( QgsMapMouseEvent *e ) override;
53 
57  void activate() override;
58 
62  void deactivate() override;
63 
64  QgsAdvancedDigitizingDockWidget *cadDockWidget() const { return mCadDockWidget; }
65 
79  bool isAdvancedDigitizingAllowed() const { return mAdvancedDigitizingAllowed; }
80 
89  bool isAutoSnapEnabled() const { return mAutoSnapEnabled; }
90 
91  protected:
92 
99  void setAdvancedDigitizingAllowed( bool allowed ) { mAdvancedDigitizingAllowed = allowed; }
100 
107  void setAutoSnapEnabled( bool enabled ) { mAutoSnapEnabled = enabled; }
108 
109  public:
110 
119  virtual void cadCanvasPressEvent( QgsMapMouseEvent *e ) { Q_UNUSED( e ) }
120 
121 
130  virtual void cadCanvasReleaseEvent( QgsMapMouseEvent *e ) { Q_UNUSED( e ) }
131 
132 
141  virtual void cadCanvasMoveEvent( QgsMapMouseEvent *e ) { Q_UNUSED( e ) }
142 
143  private slots:
144 
153  void cadPointChanged( const QgsPointXY &point );
154 
155  private:
156  QgsAdvancedDigitizingDockWidget *mCadDockWidget = nullptr;
157 
159  bool mAdvancedDigitizingAllowed = true;
161  bool mAutoSnapEnabled = true;
162 };
163 
164 #endif // QGSMAPTOOLADVANCEDDIGITIZE_H
virtual void canvasMoveEvent(QgsMapMouseEvent *e)
Mouse move event for overriding. Default implementation does nothing.
Definition: qgsmaptool.cpp:148
A class to represent a 2D point.
Definition: qgspointxy.h:43
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
bool isAutoSnapEnabled() const
Returns whether mouse events (press/move/release) should automatically try to snap mouse position (ac...
The QgsMapToolAdvancedDigitizing class is a QgsMapTool which gives event directly in map coordinates ...
bool isAdvancedDigitizingAllowed() const
Returns whether functionality of advanced digitizing dock widget is currently allowed.
Base class for map tools that edit vector geometry.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:74
virtual void canvasPressEvent(QgsMapMouseEvent *e)
Mouse press event for overriding. Default implementation does nothing.
Definition: qgsmaptool.cpp:158
virtual void activate()
called when set as currently active map tool
Definition: qgsmaptool.cpp:81
void setAdvancedDigitizingAllowed(bool allowed)
Sets whether functionality of advanced digitizing dock widget is currently allowed.
virtual void deactivate()
called when map tool is being deactivated
Definition: qgsmaptool.cpp:97
QgsAdvancedDigitizingDockWidget * cadDockWidget() const
virtual void cadCanvasPressEvent(QgsMapMouseEvent *e)
Override this method when subclassing this class.
virtual void cadCanvasMoveEvent(QgsMapMouseEvent *e)
Override this method when subclassing this class.
virtual void cadCanvasReleaseEvent(QgsMapMouseEvent *e)
Override this method when subclassing this class.
The QgsAdvancedDigitizingDockWidget class is a dockable widget used to handle the CAD tools on top of...
void setAutoSnapEnabled(bool enabled)
Sets whether mouse events (press/move/release) should automatically try to snap mouse position This m...
virtual void canvasReleaseEvent(QgsMapMouseEvent *e)
Mouse release event for overriding. Default implementation does nothing.
Definition: qgsmaptool.cpp:163