Class: QgsMapToolEdit¶
- class qgis.gui.QgsMapToolEdit¶
Bases:
QgsMapTool
Base class for map tools that edit vector geometry
Methods
Adds a list of
vertices
to other features to keep topology up to date, e.g.Creates a geometry rubber band with the color/line width from the QGIS settings.
Creates a rubber band with the color/line width from the QGIS settings.
Returns the current vector layer of the map canvas or 0
Returns default M value.
Returns default Z value.
Returns fill color for rubber bands (from global settings)
Returns stroke color for rubber bands (from global settings)
Returns stroke width for rubber bands (from global settings)
- rtype:
QgsMapTool.Flags
Returns the map layer with the matching ID, or
None
if no layers could be found.Display a timed message bar noting the active vector layer is not editable.
Display a timed message bar noting the active layer is not vector.
Sets the tool's
name
.Transforms a
point
from map coordinates to screen coordinates.Transforms a
point
from screen coordinates tolayer
coordinates.Transforms a
point
from map coordinates tolayer
coordinates.Transforms a
point
from screen coordinates to map coordinates.Transforms a
point
fromlayer
coordinates to map coordinates (which is different in case reprojection is used).Attributes
- 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. Thevertices
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 ofQgsPointXY
.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. Thevertices
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:
- childEvent(self, QChildEvent)¶
- connectNotify(self, QMetaMethod)¶
- createGeometryRubberBand(self, geometryType: Qgis.GeometryType = Qgis.GeometryType.Line, alternativeBand: bool = False) QgsGeometryRubberBand ¶
Creates a geometry rubber band with the color/line width from the QGIS settings. The caller takes ownership of the returned object
- Parameters:
geometryType (Qgis.GeometryType = Qgis.GeometryType.Line) –
alternativeBand (bool = False) – if
True
, rubber band will be set with more transparency and a dash pattern. default isFalse
.
- Return type:
- createRubberBand(self, geometryType: Qgis.GeometryType = Qgis.GeometryType.Line, 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 (Qgis.GeometryType = Qgis.GeometryType.Line) –
alternativeBand (bool = False) – if
True
, rubber band will be set with more transparency and a dash pattern. default isFalse
.
- Return type:
- currentVectorLayer(self) QgsVectorLayer ¶
Returns the current vector layer of the map canvas or 0
- Return type:
- customEvent(self, QEvent)¶
- defaultMValue() float ¶
Returns default M value. Used for setting M coordinate to new vertex.
New in version 3.20.
- Return type:
float
- defaultZValue() float ¶
Returns default Z value. Used for setting Z coordinate to new vertex.
- 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:
- isSignalConnected(self, QMetaMethod) bool ¶
- layer(self, id: str) QgsMapLayer ¶
Returns the map layer with the matching ID, or
None
if no layers could be found.This method searches both layers associated with the map canvas (see
QgsMapCanvas.layers()
) and layers from theQgsProject
associated with the canvas. It can be used to resolve layer IDs to layers which may be visible in the canvas, but not associated with aQgsProject
.New in version 3.22.
- 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 ¶
- setToolName(self, name: str)¶
Sets the tool’s
name
.See also
toolName()
New in version 3.20.
- timerEvent(self, QTimerEvent)¶
- toCanvasCoordinates(self, point: QgsPointXY) QPoint ¶
Transforms a
point
from map coordinates to screen coordinates.
- toLayerCoordinates(self, layer: QgsMapLayer, point: QPoint) QgsPointXY ¶
Transforms a
point
from screen coordinates tolayer
coordinates.toLayerCoordinates(self, layer:
QgsMapLayer
, point:QgsPointXY
) -> QgsPointXY Transforms apoint
from map coordinates tolayer
coordinates.toLayerCoordinates(self, layer:
QgsMapLayer
, rect:QgsRectangle
) -> QgsRectangle Transforms arect
from map coordinates tolayer
coordinates.
- toLayerCoordinatesV2(self, layer: QgsMapLayer, point: QgsPoint) QgsPoint ¶
Transforms a
point
from map coordinates tolayer
coordinates.Note
This method is available in the Python bindings as toLayerCoordinatesV2.
- toMapCoordinates(self, point: QPoint) QgsPointXY ¶
Transforms a
point
from screen coordinates to map coordinates.toMapCoordinates(self, layer:
QgsMapLayer
, point:QgsPointXY
) -> QgsPointXY Transforms apoint
fromlayer
coordinates to map coordinates (which is different in case reprojection is used).
- toMapCoordinatesV2(self, layer: QgsMapLayer, point: QgsPoint) QgsPoint ¶
Transforms a
point
fromlayer
coordinates to map coordinates (which is different in case reprojection is used).Note
This method is available in the Python bindings as toMapCoordinatesV2.