Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make current item bounds available for annotation edit operations #58198

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,34 @@ Implementations should include a call to :py:func:`~QgsAnnotationItem.readCommon
.. seealso:: :py:func:`readCommonProperties`
%End

virtual Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation );
virtual Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation ) /Deprecated/;
%Docstring
Applies an edit ``operation`` to the item.

.. versionadded:: 3.22
.. deprecated::
QGIS 3.40, use :py:func:`~QgsAnnotationItem.applyEditV2` instead.
%End

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResults( QgsAbstractAnnotationItemEditOperation *operation ) /Factory/;
virtual Qgis::AnnotationItemEditOperationResult applyEditV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context );
%Docstring
Applies an edit ``operation`` to the item.

.. versionadded:: 3.40
%End

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResults( QgsAbstractAnnotationItemEditOperation *operation ) /Factory/;
%Docstring
Retrieves the results of a transient (in progress) edit ``operation`` on the item.

.. versionadded:: 3.22
.. deprecated::
QGIS 3.40, use :py:func:`~QgsAnnotationItem.transientEditResultsV2` instead.
%End

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResultsV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context ) /Factory/;
%Docstring
Retrieves the results of a transient (in progress) edit ``operation`` on the item.

.. versionadded:: 3.40
%End

int zIndex() const;
Expand Down Expand Up @@ -163,11 +179,19 @@ Sets if the item will be rendered or not in the layer.
.. versionadded:: 3.36
%End

virtual QList< QgsAnnotationItemNode > nodes() const;
virtual QList< QgsAnnotationItemNode > nodes() const /Deprecated/;
%Docstring
Returns the nodes for the item, used for editing the item.

.. versionadded:: 3.22
.. deprecated::
QGIS 3.40, use :py:func:`~QgsAnnotationItem.nodesV2` instead.
%End

virtual QList< QgsAnnotationItemNode > nodesV2( const QgsAnnotationItemEditContext &context ) const;
%Docstring
Returns the nodes for the item, used for editing the item.

.. versionadded:: 3.40
%End

bool useSymbologyReferenceScale() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,37 @@



class QgsAnnotationItemEditContext
{
%Docstring(signature="appended")
Encapsulates the context for an annotation item edit operation.

.. versionadded:: 3.40
%End

%TypeHeaderCode
#include "qgsannotationitemeditoperation.h"
%End
public:

QgsAnnotationItemEditContext();

QgsRectangle currentItemBounds() const;
%Docstring
Returns the current rendered bounds of the item, in the annotation layer's CRS.

.. seealso:: :py:func:`setCurrentItemBounds`
%End

void setCurrentItemBounds( const QgsRectangle &bounds );
%Docstring
Sets the current rendered ``bounds`` of the item, in the annotation layer's CRS.

.. seealso:: :py:func:`currentItemBounds`
%End

};

class QgsAbstractAnnotationItemEditOperation
{
%Docstring(signature="appended")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,23 @@ The optional ``feedback`` argument can be used to cancel the search early.
.. versionadded:: 3.22
%End

Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation );
Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation ) /Deprecated/;
%Docstring
Applies an edit ``operation`` to the layer.

Returns ``True`` if the operation was successfully applied.

.. versionadded:: 3.22
.. deprecated::
QGIS 3.40 Use :py:func:`~QgsAnnotationLayer.applyEditV2` instead.
%End

Qgis::AnnotationItemEditOperationResult applyEditV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context );
%Docstring
Applies an edit ``operation`` to the layer.

Returns ``True`` if the operation was successfully applied.

.. versionadded:: 3.40
%End

virtual Qgis::MapLayerProperties properties() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ Constructor for QgsAnnotationLineItem, with the specified ``curve``.

virtual bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;

virtual QList< QgsAnnotationItemNode > nodes() const;
virtual QList< QgsAnnotationItemNode > nodesV2( const QgsAnnotationItemEditContext &context ) const;

virtual Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation );
virtual Qgis::AnnotationItemEditOperationResult applyEditV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context );

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResults( QgsAbstractAnnotationItemEditOperation *operation ) /Factory/;
virtual QgsAnnotationItemEditOperationTransientResults *transientEditResultsV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context ) /Factory/;


static QgsAnnotationLineItem *create() /Factory/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ Constructor for QgsAnnotationLineTextItem, with the specified ``curve`` and ``te

virtual bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;

virtual QList< QgsAnnotationItemNode > nodes() const;
virtual QList< QgsAnnotationItemNode > nodesV2( const QgsAnnotationItemEditContext &context ) const;

virtual Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation );
virtual Qgis::AnnotationItemEditOperationResult applyEditV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context );

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResults( QgsAbstractAnnotationItemEditOperation *operation ) /Factory/;
virtual QgsAnnotationItemEditOperationTransientResults *transientEditResultsV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context ) /Factory/;


static QgsAnnotationLineTextItem *create() /Factory/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ Constructor for QgsAnnotationMarkerItem, at the specified ``point``.

virtual Qgis::AnnotationItemFlags flags() const;

virtual QList< QgsAnnotationItemNode > nodes() const;
virtual QList< QgsAnnotationItemNode > nodesV2( const QgsAnnotationItemEditContext &context ) const;

virtual Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation );
virtual Qgis::AnnotationItemEditOperationResult applyEditV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context );

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResults( QgsAbstractAnnotationItemEditOperation *operation ) /Factory/;
virtual QgsAnnotationItemEditOperationTransientResults *transientEditResultsV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context ) /Factory/;


static QgsAnnotationMarkerItem *create() /Factory/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ Creates a new text at point annotation item.

virtual QgsRectangle boundingBox( QgsRenderContext &context ) const;

virtual QList< QgsAnnotationItemNode > nodes() const;
virtual QList< QgsAnnotationItemNode > nodesV2( const QgsAnnotationItemEditContext &context ) const;

virtual Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation );
virtual Qgis::AnnotationItemEditOperationResult applyEditV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context );

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResults( QgsAbstractAnnotationItemEditOperation *operation ) /Factory/;
virtual QgsAnnotationItemEditOperationTransientResults *transientEditResultsV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context ) /Factory/;


QgsPointXY point() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ Constructor for QgsAnnotationPolygonItem, with the specified ``polygon`` geometr

virtual bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;

virtual QList< QgsAnnotationItemNode > nodes() const;
virtual QList< QgsAnnotationItemNode > nodesV2( const QgsAnnotationItemEditContext &context ) const;

virtual Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation );
virtual Qgis::AnnotationItemEditOperationResult applyEditV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context );

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResults( QgsAbstractAnnotationItemEditOperation *operation ) /Factory/;
virtual QgsAnnotationItemEditOperationTransientResults *transientEditResultsV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context ) /Factory/;


static QgsAnnotationPolygonItem *create() /Factory/;
Expand Down
36 changes: 30 additions & 6 deletions python/core/auto_generated/annotations/qgsannotationitem.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,34 @@ Implementations should include a call to :py:func:`~QgsAnnotationItem.readCommon
.. seealso:: :py:func:`readCommonProperties`
%End

virtual Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation );
virtual Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation ) /Deprecated/;
%Docstring
Applies an edit ``operation`` to the item.

.. versionadded:: 3.22
.. deprecated::
QGIS 3.40, use :py:func:`~QgsAnnotationItem.applyEditV2` instead.
%End

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResults( QgsAbstractAnnotationItemEditOperation *operation ) /Factory/;
virtual Qgis::AnnotationItemEditOperationResult applyEditV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context );
%Docstring
Applies an edit ``operation`` to the item.

.. versionadded:: 3.40
%End

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResults( QgsAbstractAnnotationItemEditOperation *operation ) /Factory/;
%Docstring
Retrieves the results of a transient (in progress) edit ``operation`` on the item.

.. versionadded:: 3.22
.. deprecated::
QGIS 3.40, use :py:func:`~QgsAnnotationItem.transientEditResultsV2` instead.
%End

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResultsV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context ) /Factory/;
%Docstring
Retrieves the results of a transient (in progress) edit ``operation`` on the item.

.. versionadded:: 3.40
%End

int zIndex() const;
Expand Down Expand Up @@ -163,11 +179,19 @@ Sets if the item will be rendered or not in the layer.
.. versionadded:: 3.36
%End

virtual QList< QgsAnnotationItemNode > nodes() const;
virtual QList< QgsAnnotationItemNode > nodes() const /Deprecated/;
%Docstring
Returns the nodes for the item, used for editing the item.

.. versionadded:: 3.22
.. deprecated::
QGIS 3.40, use :py:func:`~QgsAnnotationItem.nodesV2` instead.
%End

virtual QList< QgsAnnotationItemNode > nodesV2( const QgsAnnotationItemEditContext &context ) const;
%Docstring
Returns the nodes for the item, used for editing the item.

.. versionadded:: 3.40
%End

bool useSymbologyReferenceScale() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,37 @@



class QgsAnnotationItemEditContext
{
%Docstring(signature="appended")
Encapsulates the context for an annotation item edit operation.

.. versionadded:: 3.40
%End

%TypeHeaderCode
#include "qgsannotationitemeditoperation.h"
%End
public:

QgsAnnotationItemEditContext();

QgsRectangle currentItemBounds() const;
%Docstring
Returns the current rendered bounds of the item, in the annotation layer's CRS.

.. seealso:: :py:func:`setCurrentItemBounds`
%End

void setCurrentItemBounds( const QgsRectangle &bounds );
%Docstring
Sets the current rendered ``bounds`` of the item, in the annotation layer's CRS.

.. seealso:: :py:func:`currentItemBounds`
%End

};

class QgsAbstractAnnotationItemEditOperation
{
%Docstring(signature="appended")
Expand Down
14 changes: 12 additions & 2 deletions python/core/auto_generated/annotations/qgsannotationlayer.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,23 @@ The optional ``feedback`` argument can be used to cancel the search early.
.. versionadded:: 3.22
%End

Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation );
Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation ) /Deprecated/;
%Docstring
Applies an edit ``operation`` to the layer.

Returns ``True`` if the operation was successfully applied.

.. versionadded:: 3.22
.. deprecated::
QGIS 3.40 Use :py:func:`~QgsAnnotationLayer.applyEditV2` instead.
%End

Qgis::AnnotationItemEditOperationResult applyEditV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context );
%Docstring
Applies an edit ``operation`` to the layer.

Returns ``True`` if the operation was successfully applied.

.. versionadded:: 3.40
%End

virtual Qgis::MapLayerProperties properties() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ Constructor for QgsAnnotationLineItem, with the specified ``curve``.

virtual bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;

virtual QList< QgsAnnotationItemNode > nodes() const;
virtual QList< QgsAnnotationItemNode > nodesV2( const QgsAnnotationItemEditContext &context ) const;

virtual Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation );
virtual Qgis::AnnotationItemEditOperationResult applyEditV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context );

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResults( QgsAbstractAnnotationItemEditOperation *operation ) /Factory/;
virtual QgsAnnotationItemEditOperationTransientResults *transientEditResultsV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context ) /Factory/;


static QgsAnnotationLineItem *create() /Factory/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ Constructor for QgsAnnotationLineTextItem, with the specified ``curve`` and ``te

virtual bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;

virtual QList< QgsAnnotationItemNode > nodes() const;
virtual QList< QgsAnnotationItemNode > nodesV2( const QgsAnnotationItemEditContext &context ) const;

virtual Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation );
virtual Qgis::AnnotationItemEditOperationResult applyEditV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context );

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResults( QgsAbstractAnnotationItemEditOperation *operation ) /Factory/;
virtual QgsAnnotationItemEditOperationTransientResults *transientEditResultsV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context ) /Factory/;


static QgsAnnotationLineTextItem *create() /Factory/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ Constructor for QgsAnnotationMarkerItem, at the specified ``point``.

virtual Qgis::AnnotationItemFlags flags() const;

virtual QList< QgsAnnotationItemNode > nodes() const;
virtual QList< QgsAnnotationItemNode > nodesV2( const QgsAnnotationItemEditContext &context ) const;

virtual Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation );
virtual Qgis::AnnotationItemEditOperationResult applyEditV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context );

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResults( QgsAbstractAnnotationItemEditOperation *operation ) /Factory/;
virtual QgsAnnotationItemEditOperationTransientResults *transientEditResultsV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context ) /Factory/;


static QgsAnnotationMarkerItem *create() /Factory/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ Creates a new text at point annotation item.

virtual QgsRectangle boundingBox( QgsRenderContext &context ) const;

virtual QList< QgsAnnotationItemNode > nodes() const;
virtual QList< QgsAnnotationItemNode > nodesV2( const QgsAnnotationItemEditContext &context ) const;

virtual Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation );
virtual Qgis::AnnotationItemEditOperationResult applyEditV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context );

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResults( QgsAbstractAnnotationItemEditOperation *operation ) /Factory/;
virtual QgsAnnotationItemEditOperationTransientResults *transientEditResultsV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context ) /Factory/;


QgsPointXY point() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ Constructor for QgsAnnotationPolygonItem, with the specified ``polygon`` geometr

virtual bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;

virtual QList< QgsAnnotationItemNode > nodes() const;
virtual QList< QgsAnnotationItemNode > nodesV2( const QgsAnnotationItemEditContext &context ) const;

virtual Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation );
virtual Qgis::AnnotationItemEditOperationResult applyEditV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context );

virtual QgsAnnotationItemEditOperationTransientResults *transientEditResults( QgsAbstractAnnotationItemEditOperation *operation ) /Factory/;
virtual QgsAnnotationItemEditOperationTransientResults *transientEditResultsV2( QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context ) /Factory/;


static QgsAnnotationPolygonItem *create() /Factory/;
Expand Down
Loading
Loading