QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
QgsAnnotationLineTextItem Class Reference

An annotation item which renders text along a line geometry. More...

#include <qgsannotationlinetextitem.h>

Inheritance diagram for QgsAnnotationLineTextItem:
Inheritance graph
[legend]

Public Member Functions

 QgsAnnotationLineTextItem (const QString &text, QgsCurve *curve)
 Constructor for QgsAnnotationLineTextItem, with the specified curve and text.
 
 ~QgsAnnotationLineTextItem () override
 
Qgis::AnnotationItemEditOperationResult applyEdit (QgsAbstractAnnotationItemEditOperation *operation) override
 Applies an edit operation to the item.
 
QgsRectangle boundingBox () const override
 Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system.
 
QgsRectangle boundingBox (QgsRenderContext &context) const override
 Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system.
 
QgsAnnotationLineTextItemclone () const override
 Returns a clone of the item.
 
Qgis::AnnotationItemFlags flags () const override
 Returns item flags.
 
QgsTextFormat format () const
 Returns the text format used to render the text.
 
const QgsCurvegeometry () const
 Returns the geometry of the item.
 
QList< QgsAnnotationItemNodenodes () const override
 Returns the nodes for the item, used for editing the item.
 
double offsetFromLine () const
 Returns the offset distance from the line geometry() to the text's baseline.
 
const QgsMapUnitScaleoffsetFromLineMapUnitScale () const
 Returns the map unit scale for the offset from line geometry() distance.
 
Qgis::RenderUnit offsetFromLineUnit () const
 Returns the units for the offset from line geometry() distance.
 
bool readXml (const QDomElement &element, const QgsReadWriteContext &context) override
 Reads the item's state from the given DOM element.
 
void render (QgsRenderContext &context, QgsFeedback *feedback) override
 Renders the item to the specified render context.
 
void setFormat (const QgsTextFormat &format)
 Sets the text format used to render the text.
 
void setGeometry (QgsCurve *geometry)
 Sets the geometry of the item.
 
void setOffsetFromLine (double distance)
 Sets the offset distance from the line geometry() to the text's baseline.
 
void setOffsetFromLineMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale for the offset from line geometry() distance.
 
void setOffsetFromLineUnit (Qgis::RenderUnit unit)
 Sets the unit for the offset from line geometry() distance.
 
void setText (const QString &text)
 Sets the text rendered by the item.
 
QString text () const
 Returns the text rendered by the item.
 
QgsAnnotationItemEditOperationTransientResultstransientEditResults (QgsAbstractAnnotationItemEditOperation *operation) override
 Retrieves the results of a transient (in progress) edit operation on the item.
 
QString type () const override
 Returns a unique (untranslated) string identifying the type of item.
 
bool writeXml (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
 Writes the item's state into an XML element.
 
- Public Member Functions inherited from QgsAnnotationItem
 QgsAnnotationItem ()=default
 Constructor for an annotation item.
 
 QgsAnnotationItem (const QgsAnnotationItem &other)=delete
 QgsAnnotationItem cannot be copied.
 
virtual ~QgsAnnotationItem ()=default
 
bool enabled () const
 Returns true if the item is enabled and will be rendered in the layer.
 
QgsAnnotationItemoperator= (const QgsAnnotationItem &other)=delete
 QgsAnnotationItem cannot be copied.
 
void setEnabled (bool enabled)
 Sets if the item will be rendered or not in the layer.
 
void setSymbologyReferenceScale (double scale)
 Sets the annotation's symbology reference scale.
 
void setUseSymbologyReferenceScale (bool enabled)
 Sets whether the annotation item uses a symbology reference scale.
 
void setZIndex (int index)
 Sets the item's z index, which controls the order in which annotation items are rendered in the layer.
 
double symbologyReferenceScale () const
 Returns the annotation's symbology reference scale.
 
bool useSymbologyReferenceScale () const
 Returns true if the annotation item uses a symbology reference scale.
 
int zIndex () const
 Returns the item's z index, which controls the order in which annotation items are rendered in the layer.
 

Static Public Member Functions

static QgsAnnotationLineTextItemcreate ()
 Creates a new linestring annotation item.
 

Additional Inherited Members

- Protected Member Functions inherited from QgsAnnotationItem
void copyCommonProperties (const QgsAnnotationItem *other)
 Copies common properties from the base class from an other item.
 
bool readCommonProperties (const QDomElement &element, const QgsReadWriteContext &context)
 Reads common properties from the base class from the given DOM element.
 
bool writeCommonProperties (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
 Writes common properties from the base class into an XML element.
 

Detailed Description

An annotation item which renders text along a line geometry.

Since
QGIS 3.32

Definition at line 34 of file qgsannotationlinetextitem.h.

Constructor & Destructor Documentation

◆ QgsAnnotationLineTextItem()

QgsAnnotationLineTextItem::QgsAnnotationLineTextItem ( const QString &  text,
QgsCurve curve 
)

Constructor for QgsAnnotationLineTextItem, with the specified curve and text.

Definition at line 28 of file qgsannotationlinetextitem.cpp.

◆ ~QgsAnnotationLineTextItem()

QgsAnnotationLineTextItem::~QgsAnnotationLineTextItem ( )
overridedefault

Member Function Documentation

◆ applyEdit()

Qgis::AnnotationItemEditOperationResult QgsAnnotationLineTextItem::applyEdit ( QgsAbstractAnnotationItemEditOperation operation)
overridevirtual

Applies an edit operation to the item.

Since
QGIS 3.22

Reimplemented from QgsAnnotationItem.

Definition at line 119 of file qgsannotationlinetextitem.cpp.

◆ boundingBox() [1/2]

QgsRectangle QgsAnnotationLineTextItem::boundingBox ( ) const
overridevirtual

Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system.

Implements QgsAnnotationItem.

Definition at line 228 of file qgsannotationlinetextitem.cpp.

◆ boundingBox() [2/2]

QgsRectangle QgsAnnotationLineTextItem::boundingBox ( QgsRenderContext context) const
overridevirtual

Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system.

Reimplemented from QgsAnnotationItem.

Definition at line 233 of file qgsannotationlinetextitem.cpp.

◆ clone()

QgsAnnotationLineTextItem * QgsAnnotationLineTextItem::clone ( ) const
overridevirtual

Returns a clone of the item.

Ownership is transferred to the caller.

Implementations should include a call to copyCommonProperties() to copy the base class properties.

See also
copyCommonProperties()

Implements QgsAnnotationItem.

Definition at line 249 of file qgsannotationlinetextitem.cpp.

◆ create()

QgsAnnotationLineTextItem * QgsAnnotationLineTextItem::create ( )
static

Creates a new linestring annotation item.

Definition at line 194 of file qgsannotationlinetextitem.cpp.

◆ flags()

Qgis::AnnotationItemFlags QgsAnnotationLineTextItem::flags ( ) const
overridevirtual

Returns item flags.

Since
QGIS 3.22

Reimplemented from QgsAnnotationItem.

Definition at line 36 of file qgsannotationlinetextitem.cpp.

◆ format()

QgsTextFormat QgsAnnotationLineTextItem::format ( ) const

Returns the text format used to render the text.

See also
setFormat()

Definition at line 265 of file qgsannotationlinetextitem.cpp.

◆ geometry()

const QgsCurve * QgsAnnotationLineTextItem::geometry ( ) const
inline

Returns the geometry of the item.

The coordinate reference system for the line will be the parent layer's QgsAnnotationLayer::crs().

See also
setGeometry()

Definition at line 70 of file qgsannotationlinetextitem.h.

◆ nodes()

QList< QgsAnnotationItemNode > QgsAnnotationLineTextItem::nodes ( ) const
overridevirtual

Returns the nodes for the item, used for editing the item.

Since
QGIS 3.22

Reimplemented from QgsAnnotationItem.

Definition at line 108 of file qgsannotationlinetextitem.cpp.

◆ offsetFromLine()

double QgsAnnotationLineTextItem::offsetFromLine ( ) const
inline

Returns the offset distance from the line geometry() to the text's baseline.

Units are specified through offsetFromLineUnit().

See also
setOffsetFromLine()
offsetFromLineUnit()

Definition at line 115 of file qgsannotationlinetextitem.h.

◆ offsetFromLineMapUnitScale()

const QgsMapUnitScale & QgsAnnotationLineTextItem::offsetFromLineMapUnitScale ( ) const
inline

Returns the map unit scale for the offset from line geometry() distance.

See also
setOffsetFromLineMapUnitScale()
offsetFromLineUnit()
offsetFromLine()

Definition at line 157 of file qgsannotationlinetextitem.h.

◆ offsetFromLineUnit()

Qgis::RenderUnit QgsAnnotationLineTextItem::offsetFromLineUnit ( ) const
inline

Returns the units for the offset from line geometry() distance.

See also
setOffsetFromLineUnit()
offsetFromLine()

Definition at line 139 of file qgsannotationlinetextitem.h.

◆ readXml()

bool QgsAnnotationLineTextItem::readXml ( const QDomElement &  element,
const QgsReadWriteContext context 
)
overridevirtual

Reads the item's state from the given DOM element.

Implementations should include a call to readCommonProperties() to read the base class properties.

See also
writeXml()
readCommonProperties()

Implements QgsAnnotationItem.

Definition at line 199 of file qgsannotationlinetextitem.cpp.

◆ render()

void QgsAnnotationLineTextItem::render ( QgsRenderContext context,
QgsFeedback feedback 
)
overridevirtual

Renders the item to the specified render context.

The feedback argument can be used to detect render cancellations during expensive render operations.

Implements QgsAnnotationItem.

Definition at line 49 of file qgsannotationlinetextitem.cpp.

◆ setFormat()

void QgsAnnotationLineTextItem::setFormat ( const QgsTextFormat format)

Sets the text format used to render the text.

See also
format()

Definition at line 270 of file qgsannotationlinetextitem.cpp.

◆ setGeometry()

void QgsAnnotationLineTextItem::setGeometry ( QgsCurve geometry)

Sets the geometry of the item.

Ownership of geometry is transferred.

The coordinate reference system for the line will be the parent layer's QgsAnnotationLayer::crs().

See also
geometry()

Definition at line 260 of file qgsannotationlinetextitem.cpp.

◆ setOffsetFromLine()

void QgsAnnotationLineTextItem::setOffsetFromLine ( double  distance)
inline

Sets the offset distance from the line geometry() to the text's baseline.

Units are specified through setOffsetFromLineUnit().

See also
offsetFromLine()
setOffsetFromLineUnit()

Definition at line 123 of file qgsannotationlinetextitem.h.

◆ setOffsetFromLineMapUnitScale()

void QgsAnnotationLineTextItem::setOffsetFromLineMapUnitScale ( const QgsMapUnitScale scale)
inline

Sets the map unit scale for the offset from line geometry() distance.

See also
offsetFromLineMapUnitScale()
setOffsetFromLineUnit()
setOffsetFromLine()

Definition at line 148 of file qgsannotationlinetextitem.h.

◆ setOffsetFromLineUnit()

void QgsAnnotationLineTextItem::setOffsetFromLineUnit ( Qgis::RenderUnit  unit)
inline

Sets the unit for the offset from line geometry() distance.

See also
offsetFromLineUnit()
setOffsetFromLine()

Definition at line 131 of file qgsannotationlinetextitem.h.

◆ setText()

void QgsAnnotationLineTextItem::setText ( const QString &  text)
inline

Sets the text rendered by the item.

See also
text()

Definition at line 93 of file qgsannotationlinetextitem.h.

◆ text()

QString QgsAnnotationLineTextItem::text ( ) const
inline

Returns the text rendered by the item.

See also
setText()

Definition at line 86 of file qgsannotationlinetextitem.h.

◆ transientEditResults()

QgsAnnotationItemEditOperationTransientResults * QgsAnnotationLineTextItem::transientEditResults ( QgsAbstractAnnotationItemEditOperation operation)
overridevirtual

Retrieves the results of a transient (in progress) edit operation on the item.

Since
QGIS 3.22

Reimplemented from QgsAnnotationItem.

Definition at line 163 of file qgsannotationlinetextitem.cpp.

◆ type()

QString QgsAnnotationLineTextItem::type ( ) const
overridevirtual

Returns a unique (untranslated) string identifying the type of item.

Implements QgsAnnotationItem.

Definition at line 44 of file qgsannotationlinetextitem.cpp.

◆ writeXml()

bool QgsAnnotationLineTextItem::writeXml ( QDomElement &  element,
QDomDocument &  document,
const QgsReadWriteContext context 
) const
overridevirtual

Writes the item's state into an XML element.

Implementations should include a call to writeCommonProperties() to store the base class properties.

See also
readXml()
writeCommonProperties()

Implements QgsAnnotationItem.

Definition at line 90 of file qgsannotationlinetextitem.cpp.


The documentation for this class was generated from the following files: