QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsannotationpointtextitem.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsannotationpointtextitem.h
3 ----------------
4 begin : August 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 QGSANNOTATIONPOINTTEXTITEM_H
19#define QGSANNOTATIONPOINTTEXTITEM_H
20
21#include "qgis.h"
22#include "qgis_core.h"
23#include "qgis_sip.h"
24#include "qgsannotationitem.h"
25#include "qgstextformat.h"
26
34{
35 public:
36
42
43 Qgis::AnnotationItemFlags flags() const override;
44 QString type() const override;
45 void render( QgsRenderContext &context, QgsFeedback *feedback ) override;
46 bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
47
52
53 bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
55 QgsRectangle boundingBox() const override;
56 QgsRectangle boundingBox( QgsRenderContext &context ) const override;
57 QList< QgsAnnotationItemNode > nodesV2( const QgsAnnotationItemEditContext &context ) const override;
58 Qgis::AnnotationItemEditOperationResult applyEditV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context ) override;
60
68 QgsPointXY point() const { return mPoint; }
69
77 void setPoint( QgsPointXY point ) { mPoint = point; }
78
84 QString text() const { return mText; }
85
91 void setText( const QString &text ) { mText = text; }
92
98 QgsTextFormat format() const;
99
105 void setFormat( const QgsTextFormat &format );
106
112 double angle() const { return mAngle; }
113
119 void setAngle( double angle ) { mAngle = angle; }
120
126 Qt::Alignment alignment() const;
127
133 void setAlignment( Qt::Alignment alignment );
134
141 Qgis::SymbolRotationMode rotationMode() const;
142
149 void setRotationMode( Qgis::SymbolRotationMode mode );
150
151 private:
152
153 QString mText;
154 QgsPointXY mPoint;
155 QgsTextFormat mTextFormat;
156 double mAngle = 0;
157 Qt::Alignment mAlignment = Qt::AlignHCenter;
159
160#ifdef SIP_RUN
162#endif
163
164};
165
166#endif // QGSANNOTATIONPOINTTEXTITEM_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:56
SymbolRotationMode
Modes for handling how symbol and text entity rotation is handled when maps are rotated.
Definition qgis.h:786
@ IgnoreMapRotation
Entity ignores map rotation.
Definition qgis.h:788
QFlags< AnnotationItemFlag > AnnotationItemFlags
Annotation item flags.
Definition qgis.h:2470
Abstract base class for annotation item edit operations.
Encapsulates the context for an annotation item edit operation.
Encapsulates the transient results of an in-progress annotation edit operation.
Contains information about a node used for editing an annotation item.
virtual bool writeXml(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const =0
Writes the item's state into an XML element.
virtual QString type() const =0
Returns a unique (untranslated) string identifying the type of item.
virtual void render(QgsRenderContext &context, QgsFeedback *feedback)=0
Renders the item to the specified render context.
virtual Qgis::AnnotationItemFlags flags() const
Returns item flags.
An annotation item which renders a text string at a point location.
QgsPointXY point() const
Returns the point location of the text.
void setText(const QString &text)
Sets the text rendered by the item.
~QgsAnnotationPointTextItem() override
QgsAnnotationPointTextItem * clone() const override
Returns a clone of the item.
double angle() const
Returns the text's rotation angle, in degrees clockwise.
void setAngle(double angle)
Sets the text's rotation angle, in degrees clockwise.
QgsRectangle boundingBox() const override
Returns the bounding box of the item's geographic location, in the parent layer's coordinate referenc...
void setPoint(QgsPointXY point)
Sets the point location of the text.
static QgsAnnotationPointTextItem * create()
Creates a new text at point annotation item.
bool readXml(const QDomElement &element, const QgsReadWriteContext &context) override
Reads the item's state from the given DOM element.
QString text() const
Returns the text rendered by the item.
QgsAnnotationPointTextItem(const QString &text, QgsPointXY point)
Constructor for QgsAnnotationPointTextItem, containing the specified text at the specified point.
QList< QgsAnnotationItemNode > nodesV2(const QgsAnnotationItemEditContext &context) const override
Returns the nodes for the item, used for editing the item.
QgsAnnotationItemEditOperationTransientResults * transientEditResultsV2(QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context) override
Retrieves the results of a transient (in progress) edit operation on the item.
Qgis::AnnotationItemEditOperationResult applyEditV2(QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context) override
Applies an edit operation to the item.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
Represents a 2D point.
Definition qgspointxy.h:60
A container for the context for various read/write operations on objects.
A rectangle specified with double values.
Contains information about the context of a rendering operation.
Container for all settings relating to text rendering.
#define SIP_FACTORY
Definition qgis_sip.h:84