QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
src
gui
qgsmapcanvasitem.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsmapcanvasitem.h - base class for map canvas items
3
----------------------
4
begin : February 2006
5
copyright : (C) 2006 by Martin Dobias
6
email : wonder.sk at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#ifndef QGSMAPCANVASITEM_H
17
#define QGSMAPCANVASITEM_H
18
19
#include <QGraphicsItem>
20
#include "
qgsrectangle.h
"
21
22
class
QgsMapCanvas
;
23
class
QgsRenderContext
;
24
class
QPainter
;
25
30
class
GUI_EXPORT
QgsMapCanvasItem
:
public
QGraphicsItem
31
{
32
protected
:
33
35
QgsMapCanvasItem
(
QgsMapCanvas
* mapCanvas );
36
37
virtual
~
QgsMapCanvasItem
();
38
40
virtual
void
paint
(
QPainter
* painter ) = 0;
41
43
virtual
void
paint
(
QPainter
* painter,
44
const
QStyleOptionGraphicsItem
* option,
45
QWidget
* widget =
nullptr
)
override
;
46
48
void
updateCanvas();
49
54
bool
setRenderContextVariables(
QPainter
* p,
QgsRenderContext
& context )
const
;
55
56
public
:
57
59
virtual
void
updatePosition();
60
62
virtual
QRectF
boundingRect
()
const override
;
63
66
Q_DECL_DEPRECATED
void
setPanningOffset(
QPoint
point );
67
69
QgsRectangle
rect()
const
;
70
72
void
setRect(
const
QgsRectangle
& r,
bool
resetRotation =
true
);
73
75
QgsPoint
toMapCoordinates(
QPoint
point )
const
;
76
78
QPointF
toCanvasCoordinates(
const
QgsPoint
& point )
const
;
79
80
protected
:
81
83
QgsMapCanvas
*
mMapCanvas
;
84
93
QgsRectangle
mRect
;
94
95
double
mRectRotation
;
96
100
QPoint
mPanningOffset
;
101
103
QSizeF
mItemSize
;
104
105
};
106
107
108
#endif
QWidget
QgsRectangle
A rectangle specified with double values.
Definition:
qgsrectangle.h:35
QGraphicsItem::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)=0
QgsMapCanvasItem::mRectRotation
double mRectRotation
Definition:
qgsmapcanvasitem.h:95
QgsMapCanvasItem
An abstract class for items that can be placed on the map canvas.
Definition:
qgsmapcanvasitem.h:30
QGraphicsItem
QPoint
QgsMapCanvasItem::mPanningOffset
QPoint mPanningOffset
offset from normal position due current panning operation, used when converting map coordinates to mo...
Definition:
qgsmapcanvasitem.h:100
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition:
qgsmapcanvas.h:109
QPointF
QgsMapCanvasItem::mItemSize
QSizeF mItemSize
cached size of the item (to return in boundingRect())
Definition:
qgsmapcanvasitem.h:103
QPainter
QgsMapCanvasItem::mRect
QgsRectangle mRect
cached canvas item rectangle in map coordinates encodes position (xmin,ymax) and size (width/height) ...
Definition:
qgsmapcanvasitem.h:93
qgsrectangle.h
QgsPoint
A class to represent a point.
Definition:
qgspoint.h:117
QgsRenderContext
Contains information about the context of a rendering operation.
Definition:
qgsrendercontext.h:45
QSizeF
QGraphicsItem::boundingRect
virtual QRectF boundingRect() const=0
QRectF
QgsMapCanvasItem::mMapCanvas
QgsMapCanvas * mMapCanvas
pointer to map canvas
Definition:
qgsmapcanvasitem.h:83
QStyleOptionGraphicsItem
Generated on Sun Jun 24 2018 11:42:48 for QGIS API Documentation by
1.8.13