QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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 <memory>
21
22#include "qgis_gui.h"
23#include "qgsmaptooledit.h"
24
29
41{
42 Q_OBJECT
43 public:
51
53 void canvasPressEvent( QgsMapMouseEvent *e ) override;
55 void canvasReleaseEvent( QgsMapMouseEvent *e ) override;
57 void canvasMoveEvent( QgsMapMouseEvent *e ) override;
58
62 void activate() override;
63
67 void deactivate() override;
68
70
78 virtual QgsMapLayer *layer() const;
79
95 bool isAdvancedDigitizingAllowed() const { return mAdvancedDigitizingAllowed; }
96
107 bool isAutoSnapEnabled() const { return mAutoSnapEnabled; }
108
117 bool useSnappingIndicator() const;
118
119 protected:
128 void setAdvancedDigitizingAllowed( bool allowed ) { mAdvancedDigitizingAllowed = allowed; }
129
138 void setAutoSnapEnabled( bool enabled ) { mAutoSnapEnabled = enabled; }
139
148 void setUseSnappingIndicator( bool enabled );
149
150
152
153 public:
162 virtual void cadCanvasPressEvent( QgsMapMouseEvent *e ) { Q_UNUSED( e ) }
163
164
173 virtual void cadCanvasReleaseEvent( QgsMapMouseEvent *e ) { Q_UNUSED( e ) }
174
175
184 virtual void cadCanvasMoveEvent( QgsMapMouseEvent *e ) { Q_UNUSED( e ) }
185
192 bool snapToLayerGridEnabled() const;
193
200 void setSnapToLayerGridEnabled( bool snapToLayerGridEnabled );
201
202 private slots:
203
212 void cadPointChanged( const QgsPointXY &point );
213
214 void onCurrentLayerChanged();
215
216 private:
218 bool mAdvancedDigitizingAllowed = true;
220 bool mAutoSnapEnabled = true;
222 bool mSnapToLayerGridEnabled = true;
223 QgsSnapToGridCanvasItem *mSnapToGridCanvasItem = nullptr;
224
225 std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
226};
227
228#endif // QGSMAPTOOLADVANCEDDIGITIZE_H
A dockable widget used to handle the CAD tools on top of a selection of map tools.
Base class for all map layer types.
Definition qgsmaplayer.h:80
A mouse event which is the result of a user interaction with a QgsMapCanvas.
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...
QgsAdvancedDigitizingDockWidget * mCadDockWidget
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...
QgsMapToolAdvancedDigitizing(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Creates an advanced digitizing maptool.
bool isAdvancedDigitizingAllowed() const
Returns whether functionality of advanced digitizing dock widget is currently allowed.
QgsMapToolEdit(QgsMapCanvas *canvas)
QgsMapLayer * layer(const QString &id)
Returns the map layer with the matching ID, or nullptr if no layers could be found.
QgsMapCanvas * canvas() const
returns pointer to the tool's map canvas
friend class QgsMapCanvas
Definition qgsmaptool.h:380
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
Represents a 2D point.
Definition qgspointxy.h:60
Shows a snapping marker on map canvas for the current snapping match.
Shows a grid on the map canvas given a spatial resolution.