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

Methods

geometry

Returns a pointer to the geometry

geometryType

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

moveVertex

Moves vertex to new position (in map coordinates)

setBrushStyle

Sets brush style

setFillColor

Sets fill color for vertex markers

setGeometry

Sets geometry (takes ownership).

setGeometryType

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

setIconType

Sets vertex marker icon type

setLineStyle

Sets pen style

setStrokeColor

Sets stroke color for vertex markers

setStrokeWidth

Sets stroke width

setVertexDrawingEnabled

Sets whether the vertices are drawn

Attributes

ICON_BOX

ICON_CIRCLE

ICON_CROSS

ICON_FULL_BOX

ICON_NONE

ICON_X

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

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)