QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsannotationlineitem.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsannotationlineitem.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 QGSANNOTATIONLINEITEM_H
19 #define QGSANNOTATIONLINEITEM_H
20 
21 #include "qgis_core.h"
22 #include "qgis_sip.h"
23 #include "qgsannotationitem.h"
24 
25 class QgsCurve;
26 
33 class CORE_EXPORT QgsAnnotationLineItem : public QgsAnnotationItem
34 {
35  public:
36 
42 
43  QString type() const override;
44  void render( QgsRenderContext &context, QgsFeedback *feedback ) override;
45  bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
46 
50  static QgsAnnotationLineItem *create() SIP_FACTORY;
51 
52  bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
53  QgsRectangle boundingBox() const override;
54 
55  QgsAnnotationLineItem *clone() override SIP_FACTORY;
56 
64  const QgsCurve *geometry() const { return mCurve.get(); }
65 
73  void setGeometry( QgsCurve *geometry SIP_TRANSFER ) { mCurve.reset( geometry ); }
74 
80  const QgsLineSymbol *symbol() const;
81 
89  void setSymbol( QgsLineSymbol *symbol SIP_TRANSFER );
90 
91  private:
92 
93  std::unique_ptr< QgsCurve > mCurve;
94  std::unique_ptr< QgsLineSymbol > mSymbol;
95 
96 #ifdef SIP_RUN
98 #endif
99 
100 };
101 
102 #endif // QGSANNOTATIONLINEITEM_H
QgsCurve
Abstract base class for curved geometry type.
Definition: qgscurve.h:36
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:35
QgsAnnotationLineItem::setGeometry
void setGeometry(QgsCurve *geometry)
Sets the geometry of the item.
Definition: qgsannotationlineitem.h:73
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
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
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
QgsLineSymbol
A line symbol type, for rendering LineString and MultiLineString geometries.
Definition: qgssymbol.h:1131
QgsAnnotationItem::render
virtual void render(QgsRenderContext &context, QgsFeedback *feedback)=0
Renders the item to the specified render context.
QgsAnnotationLineItem::~QgsAnnotationLineItem
~QgsAnnotationLineItem() override
QgsAnnotationLineItem
An annotation item which renders a line symbol along a line geometry.
Definition: qgsannotationlineitem.h:34
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.