Class: QgsMapToolDigitizeFeature

This tool digitizes geometry of new point/line/polygon features on already existing vector layers.

Once the map tool is enabled, user can digitize the feature geometry. A signal will then be emitted.

Added in version 3.10.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsMapToolDigitizeFeature

Base classes

QgsMapToolCaptureLayerGeometry

Base class for map tools digitizing layer geometries.

QgsMapToolCapture

Base class for map tools capable of capturing point, lines and polygons.

QgsMapToolAdvancedDigitizing

A QgsMapTool which gives events directly in map coordinates and allows filtering of events.

QgsMapToolEdit

Base class for map tools that edit vector geometry.

QgsMapTool

Abstract base class for all map tools.

QObject

Methods

checkGeometryType

Check if CaptureMode matches layer type.

setCheckGeometryType

Check if CaptureMode matches layer type.

setLayer

Change the layer edited by the map tool

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsMapToolDigitizeFeature. See the FAQ for more details.

featureDigitized

Called when the feature has been digitized

layerGeometryCaptured

Called when the feature has been digitized.

Signals

digitizingCanceled

Emitted when the digitizing process was interrupted by the user.

digitizingCompleted

Emitted whenever the digitizing has been successfully completed

digitizingFinished

Emitted whenever the digitizing has been ended without digitizing any feature

class qgis.gui.QgsMapToolDigitizeFeature[source]

Bases: QgsMapToolCaptureLayerGeometry

__init__(canvas: QgsMapCanvas | None, cadDockWidget: QgsAdvancedDigitizingDockWidget | None, mode: QgsMapToolCapture.CaptureMode = QgsMapToolCapture.CaptureNone)

QgsMapToolDigitizeFeature is a map tool to digitize a feature geometry

Parameters:
  • canvas (Optional[QgsMapCanvas]) – the map canvas

  • cadDockWidget (Optional[QgsAdvancedDigitizingDockWidget]) – widget to setup advanced digitizing parameters

  • mode (QgsMapToolCapture.CaptureMode = QgsMapToolCapture.CaptureNone) – type of geometry to capture (point/line/polygon), QgsMapToolCapture.CaptureNone to autodetect geometry

checkGeometryType(self) bool[source]

Check if CaptureMode matches layer type. Default is True.

Return type:

bool

signal digitizingCanceled[source]

Emitted when the digitizing process was interrupted by the user.

Added in version 3.28.

signal digitizingCompleted(feature: QgsFeature)[source]

Emitted whenever the digitizing has been successfully completed

Parameters:

feature (QgsFeature) – the new digitized feature

signal digitizingFinished[source]

Emitted whenever the digitizing has been ended without digitizing any feature

virtual featureDigitized(self, feature: QgsFeature)[source]

Called when the feature has been digitized

Added in version 3.26.

Parameters:

feature (QgsFeature)

virtual layerGeometryCaptured(self, geometry: QgsGeometry)[source]

Called when the feature has been digitized.

Parameters:

geometry (QgsGeometry) – the digitized geometry

setCheckGeometryType(self, checkGeometryType: bool)[source]

Check if CaptureMode matches layer type. Default is True.

Parameters:

checkGeometryType (bool)

setLayer(self, vl: QgsMapLayer | None)[source]

Change the layer edited by the map tool

Parameters:

vl (Optional[QgsMapLayer]) – the layer to be edited by the map tool