Class: QgsMapToolCaptureLayerGeometry

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.

Added in version 3.26.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsMapToolCaptureLayerGeometry

Base classes

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

Subclasses

QgsMapToolDigitizeFeature

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

Virtual Methods

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

layerGeometryCaptured

Called when the geometry is captured.

layerLineCaptured

Called when a line is captured.

layerPointCaptured

Called when a point is captured.

layerPolygonCaptured

Called when a polygon is captured.

class qgis.gui.QgsMapToolCaptureLayerGeometry[source]

Bases: QgsMapToolCapture

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

Constructor

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

Called when the geometry is captured.

A more specific handler is also called afterwards (layerPointCaptured(), layerLineCaptured() or layerPolygonCaptured()).

Parameters:

geometry (QgsGeometry)

virtual layerLineCaptured(self, line: QgsCurve | None)[source]

Called when a line is captured.

The generic layerGeometryCaptured() method will be called immediately before this line-specific method.

Parameters:

line (Optional[QgsCurve])

virtual layerPointCaptured(self, point: QgsPoint)[source]

Called when a point is captured.

The generic layerGeometryCaptured() method will be called immediately before this point-specific method.

Parameters:

point (QgsPoint)

virtual layerPolygonCaptured(self, polygon: QgsCurvePolygon | None)[source]

Called when a polygon is captured.

The generic layerGeometryCaptured() method will be called immediately before this polygon-specific method.

Parameters:

polygon (Optional[QgsCurvePolygon])