Class: QgsMapCanvasItem¶
An abstract class for items that can be placed on the map canvas.
List of all members, including inherited members
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’. |
Abstract Methods
function to be implemented by derived classes |
Methods
returns canvas item rectangle in map units |
|
sets canvas item rectangle in map units |
|
Sets render context parameters |
|
transformation from map coordinates to screen coordinates |
|
transformation from screen coordinates to map coordinates |
|
schedules map canvas for repaint |
Virtual Methods
In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsMapCanvasItem. See the FAQ for more details.
called on changed extent or resize event to update position of the item |
- 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: