16#ifndef QGSMAPCANVASITEM_H
17#define QGSMAPCANVASITEM_H
23#include <QGraphicsItem>
43 virtual void paint( QPainter *painter ) = 0;
45 void paint( QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget =
nullptr )
override;
QRectF boundingRect() const override
virtual void paint(QPainter *painter)=0
function to be implemented by derived classes
QSizeF mItemSize
cached size of the item (to return in boundingRect())
QgsRectangle rect() const
returns canvas item rectangle in map units
QgsRectangle mRect
cached canvas item rectangle in map coordinates encodes position (xmin,ymax) and size (width/height) ...
QPointF toCanvasCoordinates(const QgsPointXY &point) const
transformation from map coordinates to screen coordinates
QgsMapCanvas * mMapCanvas
pointer to map canvas
void setRect(const QgsRectangle &r, bool resetRotation=true)
sets canvas item rectangle in map units
QgsMapCanvasItem(QgsMapCanvas *mapCanvas)
protected constructor: cannot be constructed directly
void updateCanvas()
schedules map canvas for repaint
bool setRenderContextVariables(QPainter *p, QgsRenderContext &context) const
Sets render context parameters.
virtual void updatePosition()
called on changed extent or resize event to update position of the item
QgsPointXY toMapCoordinates(QPoint point) const
transformation from screen coordinates to map coordinates
Map canvas is a class for displaying all GIS data types on a canvas.
A rectangle specified with double values.
Contains information about the context of a rendering operation.