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

QgsMapToolCaptureLayerGeometry is a base class for map tools digitizing layer geometries This map tool subclass automatically handles intersection avoidance with other layers in the active project whenever a geometry is digitized by the user.

QgsMapToolCapture

QgsMapToolCapture is a base class capable of capturing point, lines and polygons. The tool supports different techniques: straight segments, curves, streaming and shapes Once the the geometry is captured the virtual private handler geometryCaptured is called as well as a more specific handler (pointCaptured, lineCaptured or polygonCaptured)

QgsMapToolAdvancedDigitizing

The QgsMapToolAdvancedDigitizing class is a QgsMapTool which gives event directly in map coordinates and allows filtering its events. Events from QgsMapTool are caught and their QMouseEvent are transformed into QgsMapMouseEvent (with map coordinates). Events are then forwarded to corresponding virtual methods which can be reimplemented in subclasses. An event filter can be set on the map tool to filter and modify the events in map coordinates (:py:

QgsMapToolEdit

Base class for map tools that edit vector geometry

QgsMapTool

Abstract base class for all map tools. Map tools are user interactive tools for manipulating the map canvas. For example map pan and zoom features are implemented as map tools.

QObject

Methods

checkGeometryType

Check if CaptureMode matches layer type.

featureDigitized

Called when the feature has been digitized

layerGeometryCaptured

Called when the feature has been digitized.

setCheckGeometryType

Check if CaptureMode matches layer type.

setLayer

Change the layer edited by the map tool

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

featureDigitized(self, feature: QgsFeature)[source]

Called when the feature has been digitized

Added in version 3.26.

Parameters:

feature (QgsFeature)

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