QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgsmapcanvasannotationitem.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmapcanvasannotationitem.h
3 ----------------------------
4 begin : January 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSMAPCANVASANNOTATIONITEM_H
19#define QGSMAPCANVASANNOTATIONITEM_H
20
21#ifdef SIP_RUN
22% ModuleHeaderCode
23// For ConvertToSubClassCode.
25% End
26#endif
27
28#include "qgsmapcanvasitem.h"
29#include "qgis_gui.h"
30
31class QgsAnnotation;
32
38class GUI_EXPORT QgsMapCanvasAnnotationItem: public QObject, public QgsMapCanvasItem
39{
40 Q_OBJECT
41
42#ifdef SIP_RUN
44 if ( dynamic_cast<QgsMapCanvasAnnotationItem *>( sipCpp ) )
45 {
46 sipType = sipType_QgsMapCanvasAnnotationItem;
47 *sipCppRet = dynamic_cast<QgsMapCanvasAnnotationItem *>( sipCpp );
48 }
49 else
50 sipType = nullptr;
52#endif
53
54 public:
55
71
76
81 const QgsAnnotation *annotation() const { return mAnnotation; } SIP_SKIP
82
86 QgsAnnotation *annotation() { return mAnnotation; }
87
88 void updatePosition() override;
89
90 QRectF boundingRect() const override;
91
92 void paint( QPainter *painter ) override;
93
97 MouseMoveAction moveActionForPosition( QPointF pos ) const;
98
102 Qt::CursorShape cursorShapeForAction( MouseMoveAction moveAction ) const;
103
104 private slots:
105
106 void updateBoundingRect();
107
108 void onCanvasLayersChanged();
109
111 void setFeatureForMapPosition();
112
113 void annotationDeleted();
114
115 private:
116
118 void drawSelectionBoxes( QPainter *p ) const;
119
121 double scaledSymbolSize() const;
122
123 QgsAnnotation *mAnnotation = nullptr;
124
126 QRectF mBoundingRect;
127
128};
129
130#endif // QGSMAPCANVASANNOTATIONITEM_H
Abstract base class for annotation items which are drawn over a map.
An interactive map canvas item which displays a QgsAnnotation.
const QgsAnnotation * annotation() const
Returns the item's annotation.
QgsAnnotation * annotation()
Returns the item's annotation.
MouseMoveAction
Mouse actions for interacting with item.
@ ResizeFrameRightUp
Resize frame right up.
@ MoveFramePosition
Moving position of frame relative to annotation.
@ MoveMapPosition
Moving annotation map position.
@ ResizeFrameLeftUp
Resize frame left up.
@ ResizeFrameLeftDown
Resize frame left down.
An abstract class for items that can be placed on the map canvas.
QRectF boundingRect() const override
virtual void paint(QPainter *painter)=0
function to be implemented by derived classes
virtual void updatePosition()
called on changed extent or resize event to update position of the item
Map canvas is a class for displaying all GIS data types on a canvas.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:191
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_END
Definition qgis_sip.h:208