QGIS API Documentation
3.4.15-Madeira (e83d02e274)
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
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 "
qgis.h
"
21
#include "
qgsrectangle.h
"
22
#include "qgis_gui.h"
23
24
class
QgsMapCanvas
;
25
class
QgsRenderContext
;
26
class
QPainter;
27
33
class
GUI_EXPORT
QgsMapCanvasItem
:
public
QGraphicsItem
34
{
35
protected
:
36
38
QgsMapCanvasItem
(
QgsMapCanvas
*mapCanvas
SIP_TRANSFERTHIS
);
39
40
~
QgsMapCanvasItem
()
override
;
41
43
virtual
void
paint( QPainter *painter ) = 0;
44
45
void
paint( QPainter *painter,
46
const
QStyleOptionGraphicsItem *option,
47
QWidget *widget =
nullptr
)
override
;
48
50
void
updateCanvas();
51
57
bool
setRenderContextVariables( QPainter *p,
QgsRenderContext
&context )
const
;
58
59
public
:
60
62
virtual
void
updatePosition();
63
64
QRectF boundingRect()
const override
;
65
67
QgsRectangle
rect()
const
;
68
70
void
setRect(
const
QgsRectangle
&r,
bool
resetRotation =
true
);
71
73
QgsPointXY
toMapCoordinates( QPoint point )
const
;
74
76
QPointF toCanvasCoordinates(
const
QgsPointXY
&point )
const
;
77
78
protected
:
79
81
QgsMapCanvas
*mMapCanvas =
nullptr
;
82
93
QgsRectangle
mRect
;
94
95
double
mRectRotation
;
96
98
QSizeF
mItemSize
;
99
100
};
101
102
103
#endif
QgsRectangle
A rectangle specified with double values.
Definition:
qgsrectangle.h:40
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition:
qgis_sip.h:46
QgsMapCanvasItem::mRectRotation
double mRectRotation
Definition:
qgsmapcanvasitem.h:95
QgsPointXY
A class to represent a 2D point.
Definition:
qgspointxy.h:43
QgsMapCanvasItem
An abstract class for items that can be placed on the map canvas.
Definition:
qgsmapcanvasitem.h:33
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition:
qgsmapcanvas.h:74
QgsMapCanvasItem::mItemSize
QSizeF mItemSize
cached size of the item (to return in boundingRect())
Definition:
qgsmapcanvasitem.h:98
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
QgsRenderContext
Contains information about the context of a rendering operation.
Definition:
qgsrendercontext.h:51
qgis.h
Generated on Sun Jan 19 2020 15:27:13 for QGIS API Documentation by
1.8.11