QGIS API Documentation  2.9.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QgsMapCanvasItem Class Referenceabstract

An abstract class for items that can be placed on the map canvas. More...

#include <qgsmapcanvasitem.h>

Inheritance diagram for QgsMapCanvasItem:
Inheritance graph
[legend]

Public Member Functions

virtual QRectF boundingRect () const override
 default implementation for canvas items More...
 
QgsRectangle rect () const
 returns canvas item rectangle in map units More...
 
Q_DECL_DEPRECATED void setPanningOffset (const QPoint &point)
 sets current offset, to be called from QgsMapCanvas More...
 
void setRect (const QgsRectangle &r, bool resetRotation=true)
 sets canvas item rectangle in map units More...
 
QPointF toCanvasCoordinates (const QgsPoint &point) const
 transformation from map coordinates to screen coordinates More...
 
QgsPoint toMapCoordinates (const QPoint &point) const
 transformation from screen coordinates to map coordinates More...
 
virtual void updatePosition ()
 called on changed extent or resize event to update position of the item More...
 

Protected Member Functions

 QgsMapCanvasItem (QgsMapCanvas *mapCanvas)
 protected constructor: cannot be constructed directly More...
 
virtual ~QgsMapCanvasItem ()
 
virtual void paint (QPainter *painter)=0
 function to be implemented by derived classes More...
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) override
 paint function called by map canvas More...
 
bool setRenderContextVariables (QPainter *p, QgsRenderContext &context) const
 Sets render context parameters. More...
 
void updateCanvas ()
 schedules map canvas for repaint More...
 

Protected Attributes

QSizeF mItemSize
 cached size of the item (to return in boundingRect()) More...
 
QgsMapCanvasmMapCanvas
 pointer to map canvas More...
 
QPoint mPanningOffset
 offset from normal position due current panning operation, used when converting map coordinates to move map canvas items More...
 
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. More...
 
double mRectRotation
 

Detailed Description

An abstract class for items that can be placed on the map canvas.

Definition at line 30 of file qgsmapcanvasitem.h.

Constructor & Destructor Documentation

QgsMapCanvasItem::QgsMapCanvasItem ( QgsMapCanvas mapCanvas)
protected

protected constructor: cannot be constructed directly

Definition at line 29 of file qgsmapcanvasitem.cpp.

QgsMapCanvasItem::~QgsMapCanvasItem ( )
protectedvirtual

Definition at line 40 of file qgsmapcanvasitem.cpp.

Member Function Documentation

QRectF QgsMapCanvasItem::boundingRect ( ) const
overridevirtual

default implementation for canvas items

Reimplemented in QgsAnnotationItem, and QgsVertexMarker.

Definition at line 109 of file qgsmapcanvasitem.cpp.

virtual void QgsMapCanvasItem::paint ( QPainter *  painter)
protectedpure virtual
void QgsMapCanvasItem::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget = 0 
)
overrideprotectedvirtual

paint function called by map canvas

Reimplemented in QgsHtmlAnnotationItem, and QgsFormAnnotationItem.

Definition at line 45 of file qgsmapcanvasitem.cpp.

QgsRectangle QgsMapCanvasItem::rect ( ) const

returns canvas item rectangle in map units

Definition at line 71 of file qgsmapcanvasitem.cpp.

void QgsMapCanvasItem::setPanningOffset ( const QPoint &  point)

sets current offset, to be called from QgsMapCanvas

Deprecated:
since v2.4 - not called by QgsMapCanvas anymore

Definition at line 147 of file qgsmapcanvasitem.cpp.

void QgsMapCanvasItem::setRect ( const QgsRectangle r,
bool  resetRotation = true 
)

sets canvas item rectangle in map units

Definition at line 77 of file qgsmapcanvasitem.cpp.

bool QgsMapCanvasItem::setRenderContextVariables ( QPainter *  p,
QgsRenderContext context 
) const
protected

Sets render context parameters.

Parameters
ppainter for rendering
contextout: configured context
Returns
true in case of success

Definition at line 122 of file qgsmapcanvasitem.cpp.

QPointF QgsMapCanvasItem::toCanvasCoordinates ( const QgsPoint point) const

transformation from map coordinates to screen coordinates

Definition at line 64 of file qgsmapcanvasitem.cpp.

QgsPoint QgsMapCanvasItem::toMapCoordinates ( const QPoint &  point) const

transformation from screen coordinates to map coordinates

Definition at line 58 of file qgsmapcanvasitem.cpp.

void QgsMapCanvasItem::updateCanvas ( )
protected

schedules map canvas for repaint

Definition at line 115 of file qgsmapcanvasitem.cpp.

void QgsMapCanvasItem::updatePosition ( )
virtual

called on changed extent or resize event to update position of the item

Reimplemented in QgsRubberBand, QgsHighlight, QgsVertexMarker, and QgsAnnotationItem.

Definition at line 139 of file qgsmapcanvasitem.cpp.

Member Data Documentation

QSizeF QgsMapCanvasItem::mItemSize
protected

cached size of the item (to return in boundingRect())

Definition at line 103 of file qgsmapcanvasitem.h.

QgsMapCanvas* QgsMapCanvasItem::mMapCanvas
protected

pointer to map canvas

Definition at line 83 of file qgsmapcanvasitem.h.

QPoint QgsMapCanvasItem::mPanningOffset
protected

offset from normal position due current panning operation, used when converting map coordinates to move map canvas items

Deprecated:
since v2.4

Definition at line 100 of file qgsmapcanvasitem.h.

QgsRectangle QgsMapCanvasItem::mRect
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 93 of file qgsmapcanvasitem.h.

double QgsMapCanvasItem::mRectRotation
protected

Definition at line 95 of file qgsmapcanvasitem.h.


The documentation for this class was generated from the following files: