QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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
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#include <memory>
23
28
39{
40 Q_OBJECT
41 public:
49
51 void canvasPressEvent( QgsMapMouseEvent *e ) override;
53 void canvasReleaseEvent( QgsMapMouseEvent *e ) override;
55 void canvasMoveEvent( QgsMapMouseEvent *e ) override;
56
60 void activate() override;
61
65 void deactivate() override;
66
67 QgsAdvancedDigitizingDockWidget *cadDockWidget() const { return mCadDockWidget; }
68
76 virtual QgsMapLayer *layer() const;
77
93 bool isAdvancedDigitizingAllowed() const { return mAdvancedDigitizingAllowed; }
94
105 bool isAutoSnapEnabled() const { return mAutoSnapEnabled; }
106
115 bool useSnappingIndicator() const;
116
117 protected:
126 void setAdvancedDigitizingAllowed( bool allowed ) { mAdvancedDigitizingAllowed = allowed; }
127
136 void setAutoSnapEnabled( bool enabled ) { mAutoSnapEnabled = enabled; }
137
146 void setUseSnappingIndicator( bool enabled );
147
148
149 QgsAdvancedDigitizingDockWidget *mCadDockWidget = nullptr;
150
151 public:
160 virtual void cadCanvasPressEvent( QgsMapMouseEvent *e ) { Q_UNUSED( e ) }
161
162
171 virtual void cadCanvasReleaseEvent( QgsMapMouseEvent *e ) { Q_UNUSED( e ) }
172
173
182 virtual void cadCanvasMoveEvent( QgsMapMouseEvent *e ) { Q_UNUSED( e ) }
183
190 bool snapToLayerGridEnabled() const;
191
198 void setSnapToLayerGridEnabled( bool snapToLayerGridEnabled );
199
200 private slots:
201
210 void cadPointChanged( const QgsPointXY &point );
211
212 void onCurrentLayerChanged();
213
214 private:
216 bool mAdvancedDigitizingAllowed = true;
218 bool mAutoSnapEnabled = true;
220 bool mSnapToLayerGridEnabled = true;
221 QgsSnapToGridCanvasItem *mSnapToGridCanvasItem = nullptr;
222
223 std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
224};
225
226#endif // QGSMAPTOOLADVANCEDDIGITIZE_H
The QgsAdvancedDigitizingDockWidget class is a dockable widget used to handle the CAD tools on top of...
Map canvas is a class for displaying all GIS data types on a canvas.
Base class for all map layer types.
Definition qgsmaplayer.h:76
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
The QgsMapToolAdvancedDigitizing class is a QgsMapTool which gives event directly in map coordinates ...
virtual void cadCanvasMoveEvent(QgsMapMouseEvent *e)
Override this method when subclassing this class.
bool isAutoSnapEnabled() const
Returns whether mouse events (press/move/release) should automatically try to snap mouse position (ac...
virtual void cadCanvasPressEvent(QgsMapMouseEvent *e)
Override this method when subclassing this class.
QgsAdvancedDigitizingDockWidget * cadDockWidget() const
~QgsMapToolAdvancedDigitizing() override
void setAdvancedDigitizingAllowed(bool allowed)
Sets whether functionality of advanced digitizing dock widget is currently allowed.
virtual void cadCanvasReleaseEvent(QgsMapMouseEvent *e)
Override this method when subclassing this class.
void setAutoSnapEnabled(bool enabled)
Sets whether mouse events (press/move/release) should automatically try to snap mouse position This m...
bool isAdvancedDigitizingAllowed() const
Returns whether functionality of advanced digitizing dock widget is currently allowed.
Base class for map tools that edit vector geometry.
QgsMapLayer * layer(const QString &id)
Returns the map layer with the matching ID, or nullptr if no layers could be found.
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 canvasReleaseEvent(QgsMapMouseEvent *e)
Mouse release event for overriding. Default implementation does nothing.
virtual void activate()
called when set as currently active map tool
virtual void deactivate()
called when map tool is being deactivated
A class to represent a 2D point.
Definition qgspointxy.h:60
Class that shows snapping marker on map canvas for the current snapping match.
Shows a grid on the map canvas given a spatial resolution.