mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-22 00:14:55 -05:00
Because some annotation items have scale dependent bounding boxes, we can only index items which have a fixed bounding box. Other item bounds need to be dynamically determined based on a specific render context. So rework the annotation layer index handling to only index appropriate items and store other items in a non-indexed item set. This isn't ideal, because it means we need to clone ALL non-indexed items upfront whenever we render an annotation layer (it's too expensive to calculate their actual bounding box and selectively clone them, as it's a process which blocks the main thread). Hopefully we can think of an alternative approach to this down the line so that we DO have some form of spatial index for scale dependent items, unlocking better performance for annotation layers with 10,000s of items. But we'll ignore that situation for now ;)
128 lines
3.7 KiB
Plaintext
128 lines
3.7 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/annotations/qgsannotationitem.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
class QgsAnnotationItem
|
|
{
|
|
%Docstring(signature="appended")
|
|
Abstract base class for annotation items which are drawn with :py:class:`QgsAnnotationLayers`.
|
|
|
|
.. versionadded:: 3.16
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsannotationitem.h"
|
|
%End
|
|
%ConvertToSubClassCode
|
|
if ( sipCpp->type() == QLatin1String( "marker" ) )
|
|
{
|
|
sipType = sipType_QgsAnnotationMarkerItem;
|
|
}
|
|
else if ( sipCpp->type() == QLatin1String( "linestring" ) )
|
|
{
|
|
sipType = sipType_QgsAnnotationLineItem;
|
|
}
|
|
else if ( sipCpp->type() == QLatin1String( "polygon" ) )
|
|
{
|
|
sipType = sipType_QgsAnnotationPolygonItem;
|
|
}
|
|
else if ( sipCpp->type() == QLatin1String( "pointtext" ) )
|
|
{
|
|
sipType = sipType_QgsAnnotationPointTextItem;
|
|
}
|
|
else
|
|
{
|
|
sipType = 0;
|
|
}
|
|
%End
|
|
public:
|
|
|
|
QgsAnnotationItem();
|
|
%Docstring
|
|
Constructor for an annotation item.
|
|
%End
|
|
|
|
|
|
virtual ~QgsAnnotationItem();
|
|
|
|
virtual Qgis::AnnotationItemFlags flags() const;
|
|
%Docstring
|
|
Returns item flags.
|
|
|
|
.. versionadded:: 3.22
|
|
%End
|
|
|
|
virtual QgsAnnotationItem *clone() = 0 /Factory/;
|
|
%Docstring
|
|
Returns a clone of the item. Ownership is transferred to the caller.
|
|
%End
|
|
|
|
virtual QString type() const = 0;
|
|
%Docstring
|
|
Returns a unique (untranslated) string identifying the type of item.
|
|
%End
|
|
|
|
virtual QgsRectangle boundingBox() const = 0;
|
|
%Docstring
|
|
Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system.
|
|
%End
|
|
|
|
virtual QgsRectangle boundingBox( const QgsRenderContext &context ) const;
|
|
%Docstring
|
|
Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system.
|
|
%End
|
|
|
|
virtual void render( QgsRenderContext &context, QgsFeedback *feedback ) = 0;
|
|
%Docstring
|
|
Renders the item to the specified render ``context``.
|
|
|
|
The ``feedback`` argument can be used to detect render cancellations during expensive
|
|
render operations.
|
|
%End
|
|
|
|
virtual bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const = 0;
|
|
%Docstring
|
|
Writes the item's state into an XML ``element``.
|
|
%End
|
|
|
|
virtual bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) = 0;
|
|
%Docstring
|
|
Reads the item's state from the given DOM ``element``.
|
|
%End
|
|
|
|
int zIndex() const;
|
|
%Docstring
|
|
Returns the item's z index, which controls the order in which annotation items
|
|
are rendered in the layer.
|
|
|
|
.. seealso:: :py:func:`setZIndex`
|
|
%End
|
|
|
|
void setZIndex( int index );
|
|
%Docstring
|
|
Sets the item's z ``index``, which controls the order in which annotation items
|
|
are rendered in the layer.
|
|
|
|
.. seealso:: :py:func:`zIndex`
|
|
%End
|
|
|
|
private:
|
|
QgsAnnotationItem( const QgsAnnotationItem &other );
|
|
};
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/annotations/qgsannotationitem.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|