|
QGIS API Documentation 3.99.0-Master (21b3aa880ba)
|
An abstract class for items that can be placed on the map canvas. More...
#include <qgsmapcanvasitem.h>

Public Member Functions | |
| QRectF | boundingRect () const override |
| QgsRectangle | rect () const |
| returns canvas item rectangle in map units | |
| void | setRect (const QgsRectangle &r, bool resetRotation=true) |
| sets canvas item rectangle in map units | |
| QPointF | toCanvasCoordinates (const QgsPointXY &point) const |
| transformation from map coordinates to screen coordinates | |
| QgsPointXY | toMapCoordinates (QPoint point) const |
| transformation from screen coordinates to map coordinates | |
| virtual void | updatePosition () |
| called on changed extent or resize event to update position of the item | |
Protected Member Functions | |
| QgsMapCanvasItem (QgsMapCanvas *mapCanvas) | |
| protected constructor: cannot be constructed directly | |
| ~QgsMapCanvasItem () override | |
| virtual void | paint (QPainter *painter)=0 |
| function to be implemented by derived classes | |
| void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override |
| bool | setRenderContextVariables (QPainter *p, QgsRenderContext &context) const |
| Sets render context parameters. | |
| void | updateCanvas () |
| schedules map canvas for repaint | |
Protected Attributes | |
| QSizeF | mItemSize |
| cached size of the item (to return in boundingRect()) | |
| QgsMapCanvas * | mMapCanvas = nullptr |
| pointer to map canvas | |
| QgsRectangle | mRect |
| cached canvas item rectangle in map coordinates encodes position (xmin,ymax) and size (width/height) used to re-position and re-size the item on zoom/pan while waiting for the renderer to complete. | |
| double | mRectRotation = 0.0 |
An abstract class for items that can be placed on the map canvas.
Definition at line 34 of file qgsmapcanvasitem.h.
|
protected |
protected constructor: cannot be constructed directly
Definition at line 30 of file qgsmapcanvasitem.cpp.
|
overrideprotected |
Definition at line 38 of file qgsmapcanvasitem.cpp.
|
override |
Definition at line 105 of file qgsmapcanvasitem.cpp.
|
protectedpure virtual |
function to be implemented by derived classes
Implemented in QgsAdvancedDigitizingCanvasItem, QgsGeometryRubberBand, QgsHighlight, QgsMapCanvasAnnotationItem, QgsRubberBand, QgsSnapToGridCanvasItem, and QgsVertexMarker.
|
overrideprotected |
Definition at line 43 of file qgsmapcanvasitem.cpp.
| QgsRectangle QgsMapCanvasItem::rect | ( | ) | const |
returns canvas item rectangle in map units
Definition at line 67 of file qgsmapcanvasitem.cpp.
| void QgsMapCanvasItem::setRect | ( | const QgsRectangle & | r, |
| bool | resetRotation = true ) |
sets canvas item rectangle in map units
Definition at line 73 of file qgsmapcanvasitem.cpp.
|
protected |
Sets render context parameters.
| p | painter for rendering |
| context | out: configured context |
true in case of success Definition at line 118 of file qgsmapcanvasitem.cpp.
| QPointF QgsMapCanvasItem::toCanvasCoordinates | ( | const QgsPointXY & | point | ) | const |
transformation from map coordinates to screen coordinates
Definition at line 60 of file qgsmapcanvasitem.cpp.
| QgsPointXY QgsMapCanvasItem::toMapCoordinates | ( | QPoint | point | ) | const |
transformation from screen coordinates to map coordinates
Definition at line 54 of file qgsmapcanvasitem.cpp.
|
protected |
schedules map canvas for repaint
Definition at line 111 of file qgsmapcanvasitem.cpp.
|
virtual |
called on changed extent or resize event to update position of the item
Reimplemented in QgsAdvancedDigitizingCanvasItem, QgsGeometryRubberBand, QgsHighlight, QgsMapCanvasAnnotationItem, QgsRubberBand, and QgsVertexMarker.
Definition at line 134 of file qgsmapcanvasitem.cpp.
|
protected |
cached size of the item (to return in boundingRect())
Definition at line 95 of file qgsmapcanvasitem.h.
|
protected |
pointer to map canvas
Definition at line 78 of file qgsmapcanvasitem.h.
|
protected |
cached canvas item rectangle in map coordinates encodes position (xmin,ymax) and size (width/height) used to re-position and re-size the item on zoom/pan while waiting for the renderer to complete.
NOTE: does not include rotation information, so cannot be used to correctly present pre-rendered map on rotation change
Definition at line 90 of file qgsmapcanvasitem.h.
|
protected |
Definition at line 92 of file qgsmapcanvasitem.h.