Class: QgsMapToolEdit

class qgis.gui.QgsMapToolEdit

Bases: QgsMapTool

Base class for map tools that edit vector geometry

Methods

addTopologicalPoints

Adds a list of vertices to other features to keep topology up to date, e.g.

childEvent

connectNotify

createGeometryRubberBand

param geometryType

createRubberBand

Creates a rubber band with the color/line width from the QGIS settings.

currentVectorLayer

Returns the current vector layer of the map canvas or 0

customEvent

defaultZValue

Returns default Z value Use for set Z coordinate to new vertex for 2.5d geometries

digitizingFillColor

Returns fill color for rubber bands (from global settings)

digitizingStrokeColor

Returns stroke color for rubber bands (from global settings)

digitizingStrokeWidth

Returns stroke width for rubber bands (from global settings)

disconnectNotify

flags

rtype

QgsMapTool.Flags

isSignalConnected

notifyNotEditableLayer

Display a timed message bar noting the active vector layer is not editable.

notifyNotVectorLayer

Display a timed message bar noting the active layer is not vector.

receivers

sender

senderSignalIndex

timerEvent

toCanvasCoordinates

transformation from map coordinates to screen coordinates

toLayerCoordinates

transformation from screen coordinates to layer’s coordinates

toMapCoordinates

transformation from screen coordinates to map coordinates

toMapCoordinatesV2

transformation from layer’s coordinates to map coordinates (which is different in case reprojection is used)

Attributes

InvalidCanvas

InvalidLayer

Success

InvalidCanvas = 1
InvalidLayer = 2
Success = 0
class TopologicalResult

Bases: int

addTopologicalPoints(self, vertices: Iterable[QgsPointXY]) → QgsMapToolEdit.TopologicalResult

Adds a list of vertices to other features to keep topology up to date, e.g. to neighbouring polygons. The vertices list specifies a set of topological points to add, in the layer’s coordinate reference system.

Deprecated since version QGIS: 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.

addTopologicalPoints(self, vertices: Iterable[QgsPoint]) -> QgsMapToolEdit.TopologicalResult Adds a list of vertices to other features to keep topology up to date, e.g. to neighbouring polygons. The vertices list specifies a set of topological points to add, in the layer’s coordinate reference system.

New in version 3.10.

Parameters

vertices (Iterable[QgsPointXY]) –

Return type

QgsMapToolEdit.TopologicalResult

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
createGeometryRubberBand(self, geometryType: QgsWkbTypes.GeometryType = QgsWkbTypes.LineGeometry, alternativeBand: bool = False)QgsGeometryRubberBand
Parameters
  • geometryType (QgsWkbTypes.GeometryType = QgsWkbTypes.LineGeometry) –

  • alternativeBand (bool = False) –

Return type

QgsGeometryRubberBand

createRubberBand(self, geometryType: QgsWkbTypes.GeometryType = QgsWkbTypes.LineGeometry, alternativeBand: bool = False)QgsRubberBand

Creates a rubber band with the color/line width from the QGIS settings. The caller takes ownership of the returned object

Parameters
  • geometryType (QgsWkbTypes.GeometryType = QgsWkbTypes.LineGeometry) –

  • alternativeBand (bool = False) – if True, rubber band will be set with more transparency and a dash pattern. default is False.

Return type

QgsRubberBand

currentVectorLayer(self)QgsVectorLayer

Returns the current vector layer of the map canvas or 0

Return type

QgsVectorLayer

customEvent(self, QEvent)
defaultZValue(self) → float

Returns default Z value Use for set Z coordinate to new vertex for 2.5d geometries

Return type

float

digitizingFillColor() → QColor

Returns fill color for rubber bands (from global settings)

Return type

QColor

digitizingStrokeColor() → QColor

Returns stroke color for rubber bands (from global settings)

Return type

QColor

digitizingStrokeWidth() → int

Returns stroke width for rubber bands (from global settings)

Return type

int

disconnectNotify(self, QMetaMethod)
flags(self) → QgsMapTool.Flags
Return type

QgsMapTool.Flags

isSignalConnected(self, QMetaMethod) → bool
notifyNotEditableLayer(self)

Display a timed message bar noting the active vector layer is not editable.

notifyNotVectorLayer(self)

Display a timed message bar noting the active layer is not vector.

receivers(self, PYQT_SIGNAL) → int
sender(self) → QObject
senderSignalIndex(self) → int
timerEvent(self, QTimerEvent)
toCanvasCoordinates(self, point: QgsPointXY) → QPoint

transformation from map coordinates to screen coordinates

toLayerCoordinates(self, layer: QgsMapLayer, point: QPoint)QgsPointXY

transformation from screen coordinates to layer’s coordinates

toLayerCoordinates(self, layer: QgsMapLayer, point: QgsPointXY) -> QgsPointXY transformation from map coordinates to layer’s coordinates

toLayerCoordinates(self, layer: QgsMapLayer, rect: QgsRectangle) -> QgsRectangle trnasformation of the rect from map coordinates to layer’s coordinates

toMapCoordinates(self, point: QPoint)QgsPointXY

transformation from screen coordinates to map coordinates

toMapCoordinates(self, layer: QgsMapLayer, point: QgsPointXY) -> QgsPointXY transformation from layer’s coordinates to map coordinates (which is different in case reprojection is used)

toMapCoordinatesV2(self, layer: QgsMapLayer, point: QgsPoint)QgsPoint

transformation from layer’s coordinates to map coordinates (which is different in case reprojection is used)

Note

available in Python bindings as toMapCoordinatesV2