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

[advanced digitizing] Add circles intersection digitizing tool #57648

Merged
merged 7 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@
<file>themes/default/mActionPanHighlightFeature.svg</file>
<file>themes/default/mActionPrevious.svg</file>
<file>themes/default/mActionPlay.svg</file>
<file>themes/default/cadtools/circlesintersection.svg</file>
<file>themes/default/cadtools/construction.svg</file>
<file>themes/default/cadtools/delta.svg</file>
<file>themes/default/cadtools/floater.svg</file>
Expand Down
19 changes: 19 additions & 0 deletions images/themes/default/cadtools/circlesintersection.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,15 @@ Removes unit suffix from the constraint text.

};

explicit QgsAdvancedDigitizingDockWidget( QgsMapCanvas *canvas, QWidget *parent = 0 );
explicit QgsAdvancedDigitizingDockWidget( QgsMapCanvas *canvas, QWidget *parent = 0, QgsUserInputWidget *userInputWidget = 0 );
%Docstring
Create an advanced digitizing dock widget

:param canvas: The map canvas on which the widget operates
:param parent: The parent
:param userInputWidget: The user input widget on which tools can add widget overlays on top of the map canvas (since QGIS 3.40)
%End
~QgsAdvancedDigitizingDockWidget();

bool canvasKeyPressEventFilter( QKeyEvent *e );
%Docstring
Expand All @@ -232,6 +234,35 @@ apply the CAD constraints. The will modify the position of the map event in map
%Docstring
align to segment for between line constraint.
If between line constraints are used, this will determine the angle to be locked depending on the snapped segment.
%End

void processCanvasPressEvent( QgsMapMouseEvent *event );
%Docstring
Processes the canvas press ``event``.
%End

void processCanvasMoveEvent( QgsMapMouseEvent *event );
%Docstring
Processes the canvas move ``event``.
%End

void processCanvasReleaseEvent( QgsMapMouseEvent *event );
%Docstring
Processes the canvas release ``event``.
%End

void setTool( QgsAdvancedDigitizingTool *tool );
%Docstring
Sets an advanced digitizing tool which will take over digitizing until the tool is close.

.. versionadded:: 3.40
%End

QgsAdvancedDigitizingTool *tool() const;
%Docstring
Returns the current advanced digitizing tool. Returns ``None`` if not set.

.. versionadded:: 3.40
%End

void releaseLocks( bool releaseRepeatingLocks = true );
Expand Down
102 changes: 102 additions & 0 deletions python/PyQt6/gui/auto_generated/qgsadvanceddigitizingtools.sip.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsadvanceddigitizingtools.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsAdvancedDigitizingTool : QObject
{
%Docstring(signature="appended")
An abstract class for advanced digitizing tools.

.. versionadded:: 3.40
%End

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

explicit QgsAdvancedDigitizingTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget );
%Docstring
The advanced digitizing tool constructor.

:param canvas: The map canvas on which the widget operates
:param cadDockWidget: The cadDockWidget to which the floater belongs
%End

QgsMapCanvas *mapCanvas() const;
%Docstring
Returns the map canvas associated with the tool.
%End

QgsAdvancedDigitizingDockWidget *cadDockWidget() const;
%Docstring
Returns the advanced digitizing widget associated with the tool.
%End

virtual QWidget *createWidget();
%Docstring
Returns a widget to control the tool.

.. note::

The caller gets the ownership.
%End

virtual void paint( QPainter *painter );
%Docstring
Paints tool content onto the advanced digitizing canvas item.
%End

virtual void canvasPressEvent( QgsMapMouseEvent *event );
%Docstring
Handles canvas press event.

.. note::

To stop propagation, set the event's accepted property to ``False``.
%End

virtual void canvasMoveEvent( QgsMapMouseEvent *event );
%Docstring
Handles canvas press move.

.. note::

To stop propagation, set the event's accepted property to ``False``.
%End

virtual void canvasReleaseEvent( QgsMapMouseEvent *event );
%Docstring
Handles canvas release event.

.. note::

To stop propagation, set the event's accepted property to ``False``.
%End

signals:

void paintRequested();
%Docstring
Requests a new painting event to the advanced digitizing canvas item.
%End

};


/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsadvanceddigitizingtools.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsadvanceddigitizingtoolsregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsAdvancedDigitizingToolAbstractMetadata
{
%Docstring(signature="appended")
Stores metadata about one advanced digitizing tool class.

.. versionadded:: 3.40
%End

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

QgsAdvancedDigitizingToolAbstractMetadata( const QString &name, const QString &visibleName, const QIcon &icon = QIcon() );
%Docstring
Constructor for QgsAdvancedDigitizingToolAbstractMetadata with the specified tool ``name``.

``visibleName`` should be set to a translated, user visible name identifying the corresponding annotation item.

An optional ``icon`` can be set, which will be used by the advanced digitizing dock widget.
%End

virtual ~QgsAdvancedDigitizingToolAbstractMetadata();

QString name() const;
%Docstring
Returns the tool's unique name
%End

QString visibleName() const;
%Docstring
Returns the tool's translatable user-friendly name
%End

QIcon icon() const;
%Docstring
Returns the tool's icon
%End

virtual QgsAdvancedDigitizingTool *createTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget ) /Factory/;
%Docstring
Returns new tool of this type. Return ``None`` on error
%End

protected:
};


class QgsAdvancedDigitizingToolsRegistry
{
%Docstring(signature="appended")
Registry of available advanced digitizing tools.

:py:class:`QgsAdvancedDigitizingToolsRegistry` is not usually directly created, but rather accessed through
:py:func:`QgsGui.advancedDigitizingToolsRegistry()`.

.. versionadded:: 3.40
%End

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

QgsAdvancedDigitizingToolsRegistry();
~QgsAdvancedDigitizingToolsRegistry();


void addDefaultTools();
%Docstring
Adds the default tools shipped in QGIS
%End

bool addTool( QgsAdvancedDigitizingToolAbstractMetadata *toolMetaData /Transfer/ );
%Docstring
Adds an advanced digitizing tool (take ownership) and return ``True`` on success
%End

bool removeTool( const QString &name );
%Docstring
Removes the advanced digitizing tool matching the provided ``name`` and return ``True`` on success
%End

QgsAdvancedDigitizingToolAbstractMetadata *toolMetadata( const QString &name );
%Docstring
Returns the advanced digitizing tool matching the provided ``name`` or ``None`` when no match available
%End

const QStringList toolMetadataNames() const;
%Docstring
Returns the list of registered tool names
%End

private:
QgsAdvancedDigitizingToolsRegistry( const QgsAdvancedDigitizingToolsRegistry &rh );
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsadvanceddigitizingtoolsregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
7 changes: 7 additions & 0 deletions python/PyQt6/gui/auto_generated/qgsgui.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ Returns the global layout item GUI registry, used for registering the GUI behavi
Returns the global annotation item GUI registry, used for registering the GUI behavior of annotation items.

.. versionadded:: 3.22
%End

static QgsAdvancedDigitizingToolsRegistry *advancedDigitizingToolsRegistry() /KeepReference/;
%Docstring
Returns the global advanced digitizing tools registry, used for registering advanced digitizing tools.

.. versionadded:: 3.40
%End

static QgsProcessingGuiRegistry *processingGuiRegistry() /KeepReference/;
Expand Down
2 changes: 2 additions & 0 deletions python/PyQt6/gui/gui_auto.sip
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
%Include auto_generated/qgsadvanceddigitizingcanvasitem.sip
%Include auto_generated/qgsadvanceddigitizingdockwidget.sip
%Include auto_generated/qgsadvanceddigitizingfloater.sip
%Include auto_generated/qgsadvanceddigitizingtools.sip
%Include auto_generated/qgsadvanceddigitizingtoolsregistry.sip
%Include auto_generated/qgsaggregatetoolbutton.sip
%Include auto_generated/qgsalignmentcombobox.sip
%Include auto_generated/qgsapplicationexitblockerinterface.sip
Expand Down
33 changes: 32 additions & 1 deletion python/gui/auto_generated/qgsadvanceddigitizingdockwidget.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,15 @@ Removes unit suffix from the constraint text.

};

explicit QgsAdvancedDigitizingDockWidget( QgsMapCanvas *canvas, QWidget *parent = 0 );
explicit QgsAdvancedDigitizingDockWidget( QgsMapCanvas *canvas, QWidget *parent = 0, QgsUserInputWidget *userInputWidget = 0 );
%Docstring
Create an advanced digitizing dock widget

:param canvas: The map canvas on which the widget operates
:param parent: The parent
:param userInputWidget: The user input widget on which tools can add widget overlays on top of the map canvas (since QGIS 3.40)
%End
~QgsAdvancedDigitizingDockWidget();

bool canvasKeyPressEventFilter( QKeyEvent *e );
%Docstring
Expand All @@ -232,6 +234,35 @@ apply the CAD constraints. The will modify the position of the map event in map
%Docstring
align to segment for between line constraint.
If between line constraints are used, this will determine the angle to be locked depending on the snapped segment.
%End

void processCanvasPressEvent( QgsMapMouseEvent *event );
%Docstring
Processes the canvas press ``event``.
%End

void processCanvasMoveEvent( QgsMapMouseEvent *event );
%Docstring
Processes the canvas move ``event``.
%End

void processCanvasReleaseEvent( QgsMapMouseEvent *event );
%Docstring
Processes the canvas release ``event``.
%End

void setTool( QgsAdvancedDigitizingTool *tool );
%Docstring
Sets an advanced digitizing tool which will take over digitizing until the tool is close.

.. versionadded:: 3.40
%End

QgsAdvancedDigitizingTool *tool() const;
%Docstring
Returns the current advanced digitizing tool. Returns ``None`` if not set.

.. versionadded:: 3.40
%End

void releaseLocks( bool releaseRepeatingLocks = true );
Expand Down
Loading