Class: QgsMapCanvasItem¶
An abstract class for items that can be placed on the map canvas.
Class Hierarchy¶
Base classes¶
Subclasses¶
Draws the graphical elements of the CAD tools ( |
|
A rubberband class for |
|
Highlights features on the map. |
|
An interactive map canvas item which displays a |
|
Responsible for drawing transient features (e.g. digitizing lines) on the map. |
|
Shows a grid on the map canvas given a spatial resolution. |
|
A map canvas item for marking vertices of features using e.g. circles or ‘x’. |
- class qgis.gui.QgsMapCanvasItem[source]¶
Bases:
QGraphicsItem- __init__(mapCanvas: QgsMapCanvas | None)
protected constructor: cannot be constructed directly
- Parameters:
mapCanvas (Optional[QgsMapCanvas])
- abstract paint(self, painter: QPainter | None)[source]¶
function to be implemented by derived classes
paint(self, painter: Optional[QPainter], option: Optional[QStyleOptionGraphicsItem], widget: Optional[QWidget] = None)
- Parameters:
painter (Optional[QPainter])
- rect(self) QgsRectangle[source]¶
returns canvas item rectangle in map units
- Return type:
- setRect(self, r: QgsRectangle, resetRotation: bool = True)[source]¶
sets canvas item rectangle in map units
- Parameters:
r (QgsRectangle)
resetRotation (bool = True)
- setRenderContextVariables(self, p: QPainter | None, context: QgsRenderContext) bool[source]¶
Sets render context parameters
- Parameters:
p (Optional[QPainter]) – painter for rendering
context (QgsRenderContext) – out: configured context
- Return type:
bool
- Returns:
Truein case of success
- toCanvasCoordinates(self, point: QgsPointXY) QPointF[source]¶
transformation from map coordinates to screen coordinates
- Parameters:
point (QgsPointXY)
- Return type:
QPointF
- toMapCoordinates(self, point: QPoint) QgsPointXY[source]¶
transformation from screen coordinates to map coordinates
- Parameters:
point (QPoint)
- Return type: