QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
21 #include <QGraphicsScene>
29 : mMapCanvas( mapCanvas )
30 , mRectRotation( 0.0 )
33 Q_ASSERT( mapCanvas && mapCanvas->scene() );
34 mapCanvas->scene()->addItem(
this );
43 const QStyleOptionGraphicsItem *option,
50 painter->setRenderHint( QPainter::Antialiasing );
63 qreal x = point.
x(), y = point.
y();
65 return QPointF( x, y );
91 prepareGeometryChange();
92 setPos( r.topLeft() );
93 mItemSize = QSizeF( r.width() + 2, r.height() + 2 );
108 return QRectF( QPointF( -1, -1 ),
mItemSize );
double mapUnitsPerPixel() const
Returns current map units per pixel.
QgsMapCanvas * mMapCanvas
pointer to map canvas
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
bool antiAliasingEnabled() const
true if antialiasing is enabled
bool setRenderContextVariables(QPainter *p, QgsRenderContext &context) const
Sets render context parameters.
void setPainter(QPainter *p)
Sets the destination QPainter for the render operation.
double scale() const
Returns the last reported scale of the canvas.
QgsRectangle mRect
cached canvas item rectangle in map coordinates encodes position (xmin,ymax) and size (width/height) ...
QgsPointXY toMapCoordinates(int x, int y) const
Transform device coordinates to map (world) coordinates.
void setRect(const QgsRectangle &r, bool resetRotation=true)
sets canvas item rectangle in map units
virtual void updatePosition()
called on changed extent or resize event to update position of the item
double rotation() const
Gets the current map canvas rotation in clockwise degrees.
virtual void paint(QPainter *painter)=0
function to be implemented by derived classes
QPointF toCanvasCoordinates(const QgsPointXY &point) const
transformation from map coordinates to screen coordinates
QgsMapCanvasItem(QgsMapCanvas *mapCanvas)
protected constructor: cannot be constructed directly
const QgsMapToPixel * getCoordinateTransform()
Gets the current coordinate transform.
double yMaximum() const
Returns the y maximum value (top side of rectangle).
void setRendererScale(double scale)
Sets the renderer map scale.
void setForceVectorOutput(bool force)
Sets whether rendering operations should use vector operations instead of any faster raster shortcuts...
void transformInPlace(double &x, double &y) const
Transform device coordinates to map coordinates.
~QgsMapCanvasItem() override
QgsRectangle rect() const
returns canvas item rectangle in map units
QSizeF mItemSize
cached size of the item (to return in boundingRect())
double height() const
Returns the height of the rectangle.
QRectF boundingRect() const override
double outputDpi() const
Returns DPI used for conversion between real world units (e.g.
QgsPointXY toMapCoordinates(QPoint point) const
transformation from screen coordinates to map coordinates
void updateCanvas()
schedules map canvas for repaint
bool isEmpty() const
Returns true if the rectangle is empty.
void setScaleFactor(double factor)
Sets the scaling factor for the render to convert painter units to physical sizes.
double width() const
Returns the width of the rectangle.
double xMinimum() const
Returns the x minimum value (left side of rectangle).