Class: QgsMapToolEdit¶
Base class for map tools that edit vector geometry.
List of all members, including inherited members
Class Hierarchy¶
Base classes¶
Abstract base class for all map tools. |
|
Subclasses¶
A |
Enums
Methods
Adds a list of vertices to other features to keep topology up to date, e.g. to neighbouring polygons. |
|
Creates a geometry rubber band with the color/line width from the QGIS settings. |
|
Creates a rubber band with the color/line width respecting the user's settings. |
|
Creates and prepares a rubber band for a layer and optional set of feature IDs. |
|
Returns the current vector layer for the map canvas or |
|
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. |
|
Configures a rubberBand for a specific layer and optional list of feature IDs. |
Static Methods
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) |
- class qgis.gui.QgsMapToolEdit[source]¶
Bases:
QgsMapTool- InvalidCanvas = 1¶
- InvalidLayer = 2¶
- Success = 0¶
- addTopologicalPoints(self, vertices: Iterable[QgsPointXY]) QgsMapToolEdit.TopologicalResult[source]¶
Adds a list of
verticesto other features to keep topology up to date, e.g. to neighbouring polygons. Theverticeslist specifies a set of topological points to add, in the layer’s coordinate reference system.Deprecated since version 3.12: Will be removed in QGIS 5.0. Use the variant which accepts
QgsPointobjects instead ofQgsPointXY.addTopologicalPoints(self, vertices: Iterable[QgsPoint]) -> QgsMapToolEdit.TopologicalResult Adds a list of
verticesto other features to keep topology up to date, e.g. to neighbouring polygons. Theverticeslist specifies a set of topological points to add, in the layer’s coordinate reference system.Added in version 3.10.
- Parameters:
vertices (Iterable[QgsPointXY])
- Return type:
- createGeometryRubberBand(self, geometryType: Qgis.GeometryType = Qgis.GeometryType.Line, alternativeBand: bool = False) QgsGeometryRubberBand | None[source]¶
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 | None[source]¶
Creates a rubber band with the color/line width respecting the user’s settings.
The caller takes ownership of the returned object.
- Parameters:
geometryType (Qgis.GeometryType = Qgis.GeometryType.Line)
alternativeBand (bool = False) – if
True, the rubber band will be set to have an alternate appearance, with higher transparency and a dashed line style
See also
See also
- Return type:
- createRubberBandForLayer(self, layer: QgsVectorLayer | None = None, fids: Iterable[int] = [], alternativeBand: bool = False) QgsRubberBand | None[source]¶
Creates and prepares a rubber band for a
layerand optional set of feature IDs.Applies the default digitizing styling, attaches appropriate layer/feature preview items, and shows the rubber band.
The caller takes ownership of the returned object.
- Parameters:
layer (Optional[QgsVectorLayer] = None) – vector layer containing configuration (defaults to
currentVectorLayer())fids (Iterable[int] = []) – IDs of feature being manipulated (optional)
alternativeBand (bool = False) – if
True, the rubber band will be set to have an alternate appearance, with higher transparency and a dashed line style
See also
Added in version 4.4.
- Return type:
- currentVectorLayer(self) QgsVectorLayer | None[source]¶
Returns the current vector layer for the map canvas or
Noneif none is set.- Return type:
- static defaultMValue() float[source]¶
Returns default M value. Used for setting M coordinate to new vertex.
Added in version 3.20.
- Return type:
float
- static defaultZValue() float[source]¶
Returns default Z value. Used for setting Z coordinate to new vertex.
- Return type:
float
- static digitizingFillColor() QColor[source]¶
Returns fill color for rubber bands (from global settings)
- Return type:
QColor
- static digitizingStrokeColor() QColor[source]¶
Returns stroke color for rubber bands (from global settings)
- Return type:
QColor
- static digitizingStrokeWidth() int[source]¶
Returns stroke width for rubber bands (from global settings)
- Return type:
int
- notifyNotEditableLayer(self)[source]¶
Display a timed message bar noting the active vector layer is not editable.
- notifyNotVectorLayer(self)[source]¶
Display a timed message bar noting the active layer is not vector.
- prepareRubberBandForLayer(self, rubberBand: QgsRubberBand | None, layer: QgsVectorLayer | None = None, fids: Iterable[int] = [])[source]¶
Configures a
rubberBandfor a specificlayerand optional list of feature IDs.Automatically attaches layer-level preview items (such as feature label previews if labeling is enabled and a valid feature is supplied).
- Parameters:
rubberBand (Optional[QgsRubberBand]) – target rubber band to prepare
layer (Optional[QgsVectorLayer] = None) – vector layer containing configuration (defaults to
currentVectorLayer())fids (Iterable[int] = []) – IDs of feature being manipulated (optional)
See also
Added in version 4.4.