Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[annotations] Add framework for map tools for creating new annotation
items
- Loading branch information
1 parent
3a082f5
commit 01226a3
Showing
10 changed files
with
298 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
python/gui/auto_generated/annotations/qgscreateannotationitemmaptool.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/annotations/qgscreateannotationitemmaptool.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
class QgsCreateAnnotationItemMapTool: QgsMapToolAdvancedDigitizing | ||
{ | ||
%Docstring(signature="appended") | ||
|
||
A base class for map tools which create annotation items. | ||
|
||
Clients should connect to the map tool's :py:func:`~itemCreated` signal, and call the | ||
:py:func:`~takeCreatedItem` implementation to take ownership of the newly created item | ||
whenever this signal is emitted. | ||
|
||
.. versionadded:: 3.22 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgscreateannotationitemmaptool.h" | ||
%End | ||
public: | ||
|
||
QgsCreateAnnotationItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget ); | ||
%Docstring | ||
Constructor for QgsCreateAnnotationItemMapTool. | ||
%End | ||
|
||
virtual QgsAnnotationItem *takeCreatedItem() = 0 /TransferBack/; | ||
%Docstring | ||
Takes the newly created item from the tool, transferring ownership to the caller. | ||
|
||
Subclasses must implement this method, and ensure that they emit the :py:func:`~QgsCreateAnnotationItemMapTool.itemCreated` signal whenever | ||
they have a created item ready for clients to take. | ||
%End | ||
|
||
signals: | ||
|
||
void itemCreated(); | ||
%Docstring | ||
Emitted by the tool when a new annotation item has been created. | ||
|
||
Clients should connect to this signal and call :py:func:`~QgsCreateAnnotationItemMapTool.takeCreatedItem` to take the newly created item from the map tool. | ||
%End | ||
|
||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/annotations/qgscreateannotationitemmaptool.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/*************************************************************************** | ||
qgscreateannotationitemmaptool.cpp | ||
------------------------ | ||
Date : September 2021 | ||
Copyright : (C) 2021 Nyall Dawson | ||
Email : nyall dot dawson at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgscreateannotationitemmaptool.h" | ||
|
||
QgsCreateAnnotationItemMapTool::QgsCreateAnnotationItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget ) | ||
: QgsMapToolAdvancedDigitizing( canvas, cadDockWidget ) | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/*************************************************************************** | ||
qgscreateannotationitemmaptool.h | ||
------------------------ | ||
Date : September 2021 | ||
Copyright : (C) 2021 Nyall Dawson | ||
Email : nyall dot dawson at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
#ifndef QGSCREATEANNOTATIONITEMMAPTOOL_H | ||
#define QGSCREATEANNOTATIONITEMMAPTOOL_H | ||
|
||
#include "qgis_gui.h" | ||
#include "qgis_sip.h" | ||
#include "qgsmaptooladvanceddigitizing.h" | ||
|
||
class QgsAnnotationItem; | ||
|
||
/** | ||
* \class QgsCreateAnnotationItemMapTool | ||
* \ingroup gui | ||
* | ||
* \brief A base class for map tools which create annotation items. | ||
* | ||
* Clients should connect to the map tool's itemCreated() signal, and call the | ||
* takeCreatedItem() implementation to take ownership of the newly created item | ||
* whenever this signal is emitted. | ||
* | ||
* \since QGIS 3.22 | ||
*/ | ||
class GUI_EXPORT QgsCreateAnnotationItemMapTool: public QgsMapToolAdvancedDigitizing | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
|
||
/** | ||
* Constructor for QgsCreateAnnotationItemMapTool. | ||
*/ | ||
QgsCreateAnnotationItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget ); | ||
|
||
/** | ||
* Takes the newly created item from the tool, transferring ownership to the caller. | ||
* | ||
* Subclasses must implement this method, and ensure that they emit the itemCreated() signal whenever | ||
* they have a created item ready for clients to take. | ||
*/ | ||
virtual QgsAnnotationItem *takeCreatedItem() = 0 SIP_TRANSFERBACK; | ||
|
||
signals: | ||
|
||
/** | ||
* Emitted by the tool when a new annotation item has been created. | ||
* | ||
* Clients should connect to this signal and call takeCreatedItem() to take the newly created item from the map tool. | ||
*/ | ||
void itemCreated(); | ||
|
||
|
||
}; | ||
|
||
#endif // QGSCREATEANNOTATIONITEMMAPTOOL_H |
Oops, something went wrong.