Class: QgsGeometryRubberBand

A rubberband class for QgsAbstractGeometry (considering curved geometries).

Class Hierarchy

Inheritance diagram of qgis.gui.QgsGeometryRubberBand

Base classes

QgsMapCanvasItem

An abstract class for items that can be placed on the map canvas.

QGraphicsItem

class qgis.gui.QgsGeometryRubberBand[source]

Bases: QgsMapCanvasItem

__init__(mapCanvas: QgsMapCanvas | None, geomType: Qgis.GeometryType = Qgis.GeometryType.Line)

Constructor for QgsGeometryRubberBand of the given geomType, shown in the specified mapCanvas.

Parameters:
  • mapCanvas (Optional[QgsMapCanvas])

  • geomType (Qgis.GeometryType = Qgis.GeometryType.Line)

ICON_BOX = 3
ICON_CIRCLE = 4
ICON_CROSS = 1
ICON_FULL_BOX = 5
ICON_NONE = 0
ICON_X = 2
class IconType

Bases: int

geometry(self) QgsAbstractGeometry | None[source]

Returns a pointer to the geometry

Return type:

Optional[QgsAbstractGeometry]

geometryType(self) Qgis.GeometryType[source]

Returns which geometry is handled by the rubber band, polygon or line

Return type:

Qgis.GeometryType

moveVertex(self, id: QgsVertexId, newPos: QgsPoint)[source]

Moves vertex to new position (in map coordinates)

Parameters:
setBrushStyle(self, brushStyle: Qt.BrushStyle)[source]

Sets brush style

Parameters:

brushStyle (Qt.BrushStyle)

setFillColor(self, c: QColor | Qt.GlobalColor)[source]

Sets fill color for vertex markers

Parameters:

c (Union[QColor, Qt.GlobalColor])

virtual setGeometry(self, geom: QgsAbstractGeometry | None)[source]

Sets geometry (takes ownership). Geometry is expected to be in map coordinates

Parameters:

geom (Optional[QgsAbstractGeometry])

setGeometryType(self, geometryType: Qgis.GeometryType)[source]

Sets which geometry is handled by the rubber band, polygon or line

Parameters:

geometryType (Qgis.GeometryType)

setIconType(self, iconType: QgsGeometryRubberBand.IconType)[source]

Sets vertex marker icon type

Parameters:

iconType (QgsGeometryRubberBand.IconType)

setLineStyle(self, penStyle: Qt.PenStyle)[source]

Sets pen style

Parameters:

penStyle (Qt.PenStyle)

setStrokeColor(self, c: QColor | Qt.GlobalColor)[source]

Sets stroke color for vertex markers

Parameters:

c (Union[QColor, Qt.GlobalColor])

setStrokeWidth(self, width: int)[source]

Sets stroke width

Parameters:

width (int)

setVertexDrawingEnabled(self, isVerticesDrawn: bool)[source]

Sets whether the vertices are drawn

Parameters:

isVerticesDrawn (bool)