QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsannotation.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsannotation.h
3  ---------------
4  begin : July 2016
5  copyright : (C) 2016 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 QGSANNOTATION_H
19 #define QGSANNOTATION_H
20 
21 #include "qgspoint.h"
23 
24 class QPainter;
26 
40 class CORE_EXPORT QgsAnnotation
41 {
42  public:
43 
45  virtual bool showItem() const = 0;
46 
53  //TODO QGIS 3 - rename to hasFixedMapPosition()
54  virtual bool mapPositionFixed() const = 0;
55 
61  virtual QgsPoint mapPosition() const { return QgsPoint(); }
62 
67 
73  virtual QPointF relativePosition() const { return QPointF(); }
74 
78  virtual double scaleFactor() const = 0;
79 
81  // TODO QGIS 3.0 - remove
82  virtual void setItemData( int role, const QVariant& value ) = 0;
83 
85  virtual void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) = 0;
86 
87 
88 };
89 
90 #endif // QGSANNOTATION_H
virtual QgsPoint mapPosition() const
Returns the map position of the annotation, if it is attached to a fixed map position.
Definition: qgsannotation.h:61
An interface for annotation items which are drawn over a map.
Definition: qgsannotation.h:40
virtual QPointF relativePosition() const
Returns the relative position of the annotation, if it is not attached to a fixed map position...
Definition: qgsannotation.h:73
A class to represent a point.
Definition: qgspoint.h:117
virtual QgsCoordinateReferenceSystem mapPositionCrs() const
Returns the CRS of the map position, or an invalid CRS if the annotation does not have a fixed map po...
Definition: qgsannotation.h:66
Class for storing a coordinate reference system (CRS)