QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsannotationmarkeritem.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsannotationmarkeritem.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 QGSANNOTATIONMARKERITEM_H
19 #define QGSANNOTATIONMARKERITEM_H
20 
21 #include "qgis_core.h"
22 #include "qgis_sip.h"
23 #include "qgsannotationitem.h"
24 #include "qgspoint.h"
25 
32 class CORE_EXPORT QgsAnnotationMarkerItem : public QgsAnnotationItem
33 {
34  public:
35 
39  QgsAnnotationMarkerItem( const QgsPoint &point );
40  ~QgsAnnotationMarkerItem() override;
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  Qgis::AnnotationItemFlags flags() const override;
46  QList< QgsAnnotationItemNode > nodes() const override;
49 
53  static QgsAnnotationMarkerItem *create() SIP_FACTORY;
54 
55  bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
57  QgsRectangle boundingBox() const override;
58  QgsRectangle boundingBox( QgsRenderContext &context ) const override;
59 
67  QgsPointXY geometry() const { return mPoint; }
68 
76  void setGeometry( const QgsPoint &geometry ) { mPoint = geometry; }
77 
83  const QgsMarkerSymbol *symbol() const;
84 
92  void setSymbol( QgsMarkerSymbol *symbol SIP_TRANSFER );
93 
94  private:
95 
96  QgsPoint mPoint;
97  std::unique_ptr< QgsMarkerSymbol > mSymbol;
98 
99 #ifdef SIP_RUN
101 #endif
102 
103 };
104 
105 #endif // QGSANNOTATIONMARKERITEM_H
QgsAnnotationItem::nodes
virtual QList< QgsAnnotationItemNode > nodes() const
Returns the nodes for the item, used for editing the item.
Definition: qgsannotationitem.cpp:36
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:34
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:48
QgsAnnotationItem::readXml
virtual bool readXml(const QDomElement &element, const QgsReadWriteContext &context)=0
Reads the item's state from the given DOM element.
QgsRenderContext
Contains information about the context of a rendering operation.
Definition: qgsrendercontext.h:59
qgspoint.h
QgsAnnotationItem::clone
virtual QgsAnnotationItem * clone()=0
Returns a clone of the item.
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:41
QgsAnnotationMarkerItem
An annotation item which renders a marker symbol at a point location.
Definition: qgsannotationmarkeritem.h:32
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
Qgis::AnnotationItemEditOperationResult
AnnotationItemEditOperationResult
Results from an edit operation on an annotation item.
Definition: qgis.h:1153
QgsMarkerSymbol
A marker symbol type, for rendering Point and MultiPoint geometries.
Definition: qgsmarkersymbol.h:30
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
QgsAbstractAnnotationItemEditOperation
Abstract base class for annotation item edit operations.
Definition: qgsannotationitemeditoperation.h:32
QgsPointXY
A class to represent a 2D point.
Definition: qgspointxy.h:58
QgsAnnotationItem::render
virtual void render(QgsRenderContext &context, QgsFeedback *feedback)=0
Renders the item to the specified render context.
QgsAnnotationItem::applyEdit
virtual Qgis::AnnotationItemEditOperationResult applyEdit(QgsAbstractAnnotationItemEditOperation *operation)
Applies an edit operation to the item.
Definition: qgsannotationitem.cpp:26
QgsAnnotationItem::boundingBox
virtual QgsRectangle boundingBox() const =0
Returns the bounding box of the item's geographic location, in the parent layer's coordinate referenc...
QgsAnnotationItem::flags
virtual Qgis::AnnotationItemFlags flags() const
Returns item flags.
Definition: qgsannotationitem.cpp:21
qgsannotationitem.h
QgsAnnotationItem::transientEditResults
virtual QgsAnnotationItemEditOperationTransientResults * transientEditResults(QgsAbstractAnnotationItemEditOperation *operation)
Retrieves the results of a transient (in progress) edit operation on the item.
Definition: qgsannotationitem.cpp:31
QgsAnnotationItem
Abstract base class for annotation items which are drawn with QgsAnnotationLayers.
Definition: qgsannotationitem.h:42
QgsAnnotationItemEditOperationTransientResults
Encapsulates the transient results of an in-progress annotation edit operation.
Definition: qgsannotationitemeditoperation.h:226
QgsAnnotationItem::type
virtual QString type() const =0
Returns a unique (untranslated) string identifying the type of item.