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

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]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

signal digitizingCompleted[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

signal digitizingFinished[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

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