QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
|
Abstract base class for annotation items which render annotations in a rectangular shape. More...
#include <qgsannotationrectitem.h>
Public Member Functions | |
QgsAnnotationRectItem (const QgsRectangle &bounds) | |
Constructor for QgsAnnotationRectItem, rendering the annotation within the specified bounds geometry. | |
~QgsAnnotationRectItem () override | |
Qgis::AnnotationItemEditOperationResult | applyEditV2 (QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context) override |
Applies an edit operation to the item. | |
bool | backgroundEnabled () const |
Returns true if the item's background should be rendered. | |
const QgsFillSymbol * | backgroundSymbol () const |
Returns the symbol used to render the item's background. | |
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. | |
QgsRectangle | bounds () const |
Returns the bounds of the item. | |
QSizeF | fixedSize () const |
Returns the fixed size to use for the item, when the placementMode() is Qgis::AnnotationPlacementMode::FixedSize. | |
Qgis::RenderUnit | fixedSizeUnit () const |
Returns the units to use for fixed item sizes, when the placementMode() is Qgis::AnnotationPlacementMode::FixedSize. | |
Qgis::AnnotationItemFlags | flags () const override |
Returns item flags. | |
bool | frameEnabled () const |
Returns true if the item's frame should be rendered. | |
const QgsFillSymbol * | frameSymbol () const |
Returns the symbol used to render the item's frame. | |
QList< QgsAnnotationItemNode > | nodesV2 (const QgsAnnotationItemEditContext &context) const override |
Returns the nodes for the item, used for editing the item. | |
Qgis::AnnotationPlacementMode | placementMode () const |
Returns the placement mode for the item. | |
void | render (QgsRenderContext &context, QgsFeedback *feedback) override |
Renders the item to the specified render context. | |
void | setBackgroundEnabled (bool enabled) |
Sets whether the item's background should be rendered. | |
void | setBackgroundSymbol (QgsFillSymbol *symbol) |
Sets the symbol used to render the item's background. | |
void | setBounds (const QgsRectangle &bounds) |
Sets the bounds of the item. | |
void | setFixedSize (const QSizeF &size) |
Sets the fixed size to use for the item, when the placementMode() is Qgis::AnnotationPlacementMode::FixedSize. | |
void | setFixedSizeUnit (Qgis::RenderUnit unit) |
Sets the unit to use for fixed item sizes, when the placementMode() is Qgis::AnnotationPlacementMode::FixedSize. | |
void | setFrameEnabled (bool enabled) |
Sets whether the item's frame should be rendered. | |
void | setFrameSymbol (QgsFillSymbol *symbol) |
Sets the symbol used to render the item's frame. | |
void | setPlacementMode (Qgis::AnnotationPlacementMode mode) |
Sets the placement mode for the item. | |
QgsAnnotationItemEditOperationTransientResults * | transientEditResultsV2 (QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context) override |
Retrieves the results of a transient (in progress) edit operation on the item. | |
Public Member Functions inherited from QgsAnnotationItem | |
QgsAnnotationItem () | |
QgsAnnotationItem (const QgsAnnotationItem &other)=delete | |
virtual | ~QgsAnnotationItem () |
virtual Q_DECL_DEPRECATED Qgis::AnnotationItemEditOperationResult | applyEdit (QgsAbstractAnnotationItemEditOperation *operation) |
Applies an edit operation to the item. | |
QgsCallout * | callout () const |
Returns the item's callout renderer, responsible for drawing item callouts. | |
QgsGeometry | calloutAnchor () const |
Returns the callout's anchor geometry. | |
virtual QgsAnnotationItem * | clone () const =0 |
Returns a clone of the item. | |
bool | enabled () const |
Returns true if the item is enabled and will be rendered in the layer. | |
virtual Q_DECL_DEPRECATED QList< QgsAnnotationItemNode > | nodes () const |
Returns the nodes for the item, used for editing the item. | |
QSizeF | offsetFromCallout () const |
Returns the (optional) offset of the annotation item from the calloutAnchor(). | |
Qgis::RenderUnit | offsetFromCalloutUnit () const |
Returns the units for the offsetFromCallout(). | |
QgsAnnotationItem & | operator= (const QgsAnnotationItem &other)=delete |
virtual bool | readXml (const QDomElement &element, const QgsReadWriteContext &context)=0 |
Reads the item's state from the given DOM element. | |
void | setCallout (QgsCallout *callout) |
Sets the item's callout renderer, responsible for drawing item callouts. | |
void | setCalloutAnchor (const QgsGeometry &anchor) |
Sets the callout's anchor geometry. | |
void | setEnabled (bool enabled) |
Sets if the item will be rendered or not in the layer. | |
void | setOffsetFromCallout (const QSizeF &offset) |
Sets the offset of the annotation item from the calloutAnchor(). | |
void | setOffsetFromCalloutUnit (Qgis::RenderUnit unit) |
Sets the unit for the offsetFromCallout(). | |
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. | |
virtual Q_DECL_DEPRECATED QgsAnnotationItemEditOperationTransientResults * | transientEditResults (QgsAbstractAnnotationItemEditOperation *operation) |
Retrieves the results of a transient (in progress) edit operation on the item. | |
virtual QString | type () const =0 |
Returns a unique (untranslated) string identifying the type of item. | |
bool | useSymbologyReferenceScale () const |
Returns true if the annotation item uses a symbology reference scale. | |
virtual bool | writeXml (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const =0 |
Writes the item's state into an XML element. | |
int | zIndex () const |
Returns the item's z index, which controls the order in which annotation items are rendered in the layer. | |
Protected Member Functions | |
void | copyCommonProperties (const QgsAnnotationItem *other) override |
Copies common properties from the base class from an other item. | |
bool | readCommonProperties (const QDomElement &element, const QgsReadWriteContext &context) override |
Reads common properties from the base class from the given DOM element. | |
virtual void | renderInBounds (QgsRenderContext &context, const QRectF &painterRect, QgsFeedback *feedback)=0 |
Renders the item to the specified render context. | |
bool | writeCommonProperties (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override |
Writes common properties from the base class into an XML element. | |
Protected Member Functions inherited from QgsAnnotationItem | |
void | renderCallout (QgsRenderContext &context, const QRectF &rect, double angle, QgsCallout::QgsCalloutContext &calloutContext, QgsFeedback *feedback) |
Renders the item's callout. | |
Abstract base class for annotation items which render annotations in a rectangular shape.
Subclasses should implement the pure virtual render() method which takes a painter bounds argument.
Definition at line 33 of file qgsannotationrectitem.h.
QgsAnnotationRectItem::QgsAnnotationRectItem | ( | const QgsRectangle & | bounds | ) |
Constructor for QgsAnnotationRectItem, rendering the annotation within the specified bounds geometry.
Definition at line 34 of file qgsannotationrectitem.cpp.
|
overridedefault |
|
overridevirtual |
Applies an edit operation to the item.
Reimplemented from QgsAnnotationItem.
Definition at line 230 of file qgsannotationrectitem.cpp.
|
inline |
Returns true
if the item's background should be rendered.
Definition at line 132 of file qgsannotationrectitem.h.
const QgsFillSymbol * QgsAnnotationRectItem::backgroundSymbol | ( | ) | const |
Returns the symbol used to render the item's background.
Definition at line 642 of file qgsannotationrectitem.cpp.
|
overridevirtual |
Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system.
Implements QgsAnnotationItem.
Definition at line 497 of file qgsannotationrectitem.cpp.
|
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 532 of file qgsannotationrectitem.cpp.
|
inline |
Returns the bounds of the item.
The coordinate reference system for the item will be the parent layer's QgsAnnotationLayer::crs().
When the placementMode() is Qgis::AnnotationPlacementMode::FixedSize then the item will be placed at the center of the bounds.
Definition at line 62 of file qgsannotationrectitem.h.
|
overrideprotectedvirtual |
Copies common properties from the base class from an other item.
Reimplemented from QgsAnnotationItem.
Definition at line 662 of file qgsannotationrectitem.cpp.
QSizeF QgsAnnotationRectItem::fixedSize | ( | ) | const |
Returns the fixed size to use for the item, when the placementMode() is Qgis::AnnotationPlacementMode::FixedSize.
Units are retrieved via fixedSizeUnit()
Definition at line 744 of file qgsannotationrectitem.cpp.
Qgis::RenderUnit QgsAnnotationRectItem::fixedSizeUnit | ( | ) | const |
Returns the units to use for fixed item sizes, when the placementMode() is Qgis::AnnotationPlacementMode::FixedSize.
Definition at line 754 of file qgsannotationrectitem.cpp.
|
overridevirtual |
Returns item flags.
Reimplemented from QgsAnnotationItem.
Definition at line 49 of file qgsannotationrectitem.cpp.
|
inline |
Returns true
if the item's frame should be rendered.
Definition at line 166 of file qgsannotationrectitem.h.
const QgsFillSymbol * QgsAnnotationRectItem::frameSymbol | ( | ) | const |
Returns the symbol used to render the item's frame.
Definition at line 652 of file qgsannotationrectitem.cpp.
|
overridevirtual |
Returns the nodes for the item, used for editing the item.
Reimplemented from QgsAnnotationItem.
Definition at line 168 of file qgsannotationrectitem.cpp.
Qgis::AnnotationPlacementMode QgsAnnotationRectItem::placementMode | ( | ) | const |
Returns the placement mode for the item.
Definition at line 764 of file qgsannotationrectitem.cpp.
|
overrideprotectedvirtual |
Reads common properties from the base class from the given DOM element.
Reimplemented from QgsAnnotationItem.
Definition at line 712 of file qgsannotationrectitem.cpp.
|
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 64 of file qgsannotationrectitem.cpp.
|
protectedpure virtual |
Renders the item to the specified render context.
The painterRect argument specifies the bounds in painter units where the rectangular item should be rendered within.
The feedback argument can be used to detect render cancellations during expensive render operations.
Implemented in QgsAnnotationPictureItem, and QgsAnnotationRectangleTextItem.
|
inline |
Sets whether the item's background should be rendered.
Definition at line 140 of file qgsannotationrectitem.h.
void QgsAnnotationRectItem::setBackgroundSymbol | ( | QgsFillSymbol * | symbol | ) |
Sets the symbol used to render the item's background.
The item takes ownership of the symbol.
Definition at line 647 of file qgsannotationrectitem.cpp.
void QgsAnnotationRectItem::setBounds | ( | const QgsRectangle & | bounds | ) |
Sets the bounds of the item.
The coordinate reference system for the bounds will be the parent layer's QgsAnnotationLayer::crs().
When the placementMode() is Qgis::AnnotationPlacementMode::FixedSize then the item will be placed at the center of the bounds.
Definition at line 637 of file qgsannotationrectitem.cpp.
void QgsAnnotationRectItem::setFixedSize | ( | const QSizeF & | size | ) |
Sets the fixed size to use for the item, when the placementMode() is Qgis::AnnotationPlacementMode::FixedSize.
Units are set via setFixedSizeUnit()
Definition at line 749 of file qgsannotationrectitem.cpp.
void QgsAnnotationRectItem::setFixedSizeUnit | ( | Qgis::RenderUnit | unit | ) |
Sets the unit to use for fixed item sizes, when the placementMode() is Qgis::AnnotationPlacementMode::FixedSize.
Definition at line 759 of file qgsannotationrectitem.cpp.
|
inline |
Sets whether the item's frame should be rendered.
Definition at line 174 of file qgsannotationrectitem.h.
void QgsAnnotationRectItem::setFrameSymbol | ( | QgsFillSymbol * | symbol | ) |
Sets the symbol used to render the item's frame.
The item takes ownership of the symbol.
Definition at line 657 of file qgsannotationrectitem.cpp.
void QgsAnnotationRectItem::setPlacementMode | ( | Qgis::AnnotationPlacementMode | mode | ) |
Sets the placement mode for the item.
Definition at line 769 of file qgsannotationrectitem.cpp.
|
overridevirtual |
Retrieves the results of a transient (in progress) edit operation on the item.
Reimplemented from QgsAnnotationItem.
Definition at line 355 of file qgsannotationrectitem.cpp.
|
overrideprotectedvirtual |
Writes common properties from the base class into an XML element.
Reimplemented from QgsAnnotationItem.
Definition at line 682 of file qgsannotationrectitem.cpp.