QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsannotationpolygonitem.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsannotationpolygonitem.h
3  ----------------
4  begin : July 2020
5  copyright : (C) 2020 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 QGSANNOTATIONPOLYGONITEM_H
19 #define QGSANNOTATIONPOLYGONITEM_H
20 
21 #include "qgis_core.h"
22 #include "qgis_sip.h"
23 #include "qgsannotationitem.h"
24 
25 
32 class CORE_EXPORT QgsAnnotationPolygonItem : public QgsAnnotationItem
33 {
34  public:
35 
41 
42  QString type() const override;
43  void render( QgsRenderContext &context, QgsFeedback *feedback ) override;
44  bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
45 
49  static QgsAnnotationPolygonItem *create() SIP_FACTORY;
50 
51  bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
52  QgsAnnotationPolygonItem *clone() override SIP_FACTORY;
53  QgsRectangle boundingBox() const override;
54 
62  const QgsCurvePolygon *geometry() const { return mPolygon.get(); }
63 
71  void setGeometry( QgsCurvePolygon *geometry SIP_TRANSFER ) { mPolygon.reset( geometry ); }
72 
78  const QgsFillSymbol *symbol() const;
79 
87  void setSymbol( QgsFillSymbol *symbol SIP_TRANSFER );
88 
89  private:
90 
91  std::unique_ptr< QgsCurvePolygon > mPolygon;
92  std::unique_ptr< QgsFillSymbol > mSymbol;
93 
94 #ifdef SIP_RUN
96 #endif
97 
98 };
99 #endif // QGSANNOTATIONPOLYGONITEM_H
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:35
QgsCurvePolygon
Curve polygon geometry type.
Definition: qgscurvepolygon.h:35
QgsAnnotationPolygonItem::~QgsAnnotationPolygonItem
~QgsAnnotationPolygonItem() override
QgsRenderContext
Contains information about the context of a rendering operation.
Definition: qgsrendercontext.h:58
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:42
QgsAnnotationPolygonItem::setGeometry
void setGeometry(QgsCurvePolygon *geometry)
Sets the geometry of the item.
Definition: qgsannotationpolygonitem.h:71
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsAnnotationPolygonItem
An annotation item which renders a fill symbol for a polygon geometry.
Definition: qgsannotationpolygonitem.h:33
QgsAnnotationItem::writeXml
virtual bool writeXml(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const =0
Writes the item's state into an XML element.
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:44
qgis_sip.h
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsAnnotationItem::render
virtual void render(QgsRenderContext &context, QgsFeedback *feedback)=0
Renders the item to the specified render context.
QgsFillSymbol
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
Definition: qgssymbol.h:1234
qgsannotationitem.h
QgsAnnotationItem
Abstract base class for annotation items which are drawn with QgsAnnotationLayers.
Definition: qgsannotationitem.h:39
QgsAnnotationItem::type
virtual QString type() const =0
Returns a unique (untranslated) string identifying the type of item.