Class: 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.

Added in version 3.26.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsMapToolCaptureLayerGeometry

Base classes

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

Subclasses

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.

Methods

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:
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)

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])

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)

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])