QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsmaptooldigitizefeature.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmaptooldigitizegeometry.h
3
4 ---------------------
5 begin : 7.12.2017
6 copyright : (C) 2017 by David Signer
7 email : david at opengis dot ch
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16#ifndef QGSMAPTOOLDIGITIZEFEATURE_H
17#define QGSMAPTOOLDIGITIZEFEATURE_H
18
19#include "qgis_gui.h"
21
22class QgsFeature;
23
33{
34 Q_OBJECT
35
36 public:
44
46 bool supportsTechnique( Qgis::CaptureTechnique technique ) const override;
47
48 void cadCanvasReleaseEvent( QgsMapMouseEvent *e ) override;
49
54 void setLayer( QgsMapLayer *vl );
55
56 void activate() override;
57 void deactivate() override;
58 void reactivate() override;
59
60 // Overridden to emit digitizingCanceled when ESC is pressed
61 void keyPressEvent( QKeyEvent *e ) override;
62
63 signals:
64
69 void digitizingCompleted( const QgsFeature &feature );
70
76
82
83 protected:
87 bool checkGeometryType() const;
88
93 // TODO QGIS 4: remove if GRASS plugin is dropped
94
99 void layerGeometryCaptured( const QgsGeometry &geometry ) final;
100
105 virtual void featureDigitized( const QgsFeature &feature ) { Q_UNUSED( feature ) }
106
107 private:
111 QgsMapLayer *mLayer
112 = nullptr;
113
117 QgsMapLayer *mCurrentLayer = nullptr;
118
122 bool mCheckGeometryType = true;
123
125};
126
127#endif // QGSMAPTOOLDIGITIZEFEATURE_H
CaptureTechnique
Capture technique.
Definition qgis.h:397
A dockable widget used to handle the CAD tools on top of a selection of map tools.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
A geometry is the spatial representation of a feature.
Map canvas is a class for displaying all GIS data types on a canvas.
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.
QgsAdvancedDigitizingDockWidget * cadDockWidget() const
virtual void layerGeometryCaptured(const QgsGeometry &geometry)
Called when the geometry is captured.
QgsMapToolCaptureLayerGeometry(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget, CaptureMode mode)
Constructor.
void deactivate() override
Unregisters this maptool from the cad dock widget.
CaptureMode mode() const
The capture mode.
QFlags< Capability > Capabilities
void keyPressEvent(QKeyEvent *e) override
Intercept key events like Esc or Del to delete the last point.
void activate() override
Registers this maptool with the cad dock widget.
CaptureMode
Different capture modes.
@ CaptureNone
Do not capture / determine mode from layer geometry type.
virtual bool supportsTechnique(Qgis::CaptureTechnique technique) const
Returns true if the tool supports the specified capture technique.
virtual QgsMapToolCapture::Capabilities capabilities() const
Returns flags containing the supported capabilities.
void cadCanvasReleaseEvent(QgsMapMouseEvent *e) override
Override this method when subclassing this class.
void setCheckGeometryType(bool checkGeometryType)
Check if CaptureMode matches layer type.
void digitizingCanceled()
Emitted when the digitizing process was interrupted by the user.
void digitizingCompleted(const QgsFeature &feature)
Emitted whenever the digitizing has been successfully completed.
bool checkGeometryType() const
Check if CaptureMode matches layer type.
void digitizingFinished()
Emitted whenever the digitizing has been ended without digitizing any feature.
virtual void featureDigitized(const QgsFeature &feature)
Called when the feature has been digitized.
void setLayer(QgsMapLayer *vl)
Change the layer edited by the map tool.
QgsMapToolDigitizeFeature(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget, CaptureMode mode=QgsMapToolCapture::CaptureNone)
QgsMapToolDigitizeFeature is a map tool to digitize a feature geometry.
QgsMapCanvas * canvas() const
returns pointer to the tool's map canvas
virtual void reactivate()
Called when the map tool is being activated while it is already active.