Skip to content

Commit

Permalink
[advanced digitizing] Add circles intersection digitizing tool (qgis#…
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn authored Jul 31, 2024
1 parent 1c0484f commit 6994d1c
Show file tree
Hide file tree
Showing 35 changed files with 1,690 additions and 34 deletions.
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 @@ -138,6 +138,22 @@ is equal to :py:func:`~QgsDoubleSpinBox.minimum`. Typical use is to indicate tha
virtual void stepBy( int steps );


signals:

void returnPressed();
%Docstring
Emitted when the Return or Enter key is used in the line edit.

.. versionadded:: 3.40
%End

void textEdited( const QString &text );
%Docstring
Emitted when the the value has been manually edited via line edit.

.. versionadded:: 3.40
%End

protected:
virtual void changeEvent( QEvent *event );

Expand Down
16 changes: 16 additions & 0 deletions python/PyQt6/gui/auto_generated/editorwidgets/qgsspinbox.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,22 @@ is equal to :py:func:`~QgsSpinBox.minimum`. Typical use is to indicate that this
virtual void stepBy( int steps );


signals:

void returnPressed();
%Docstring
Emitted when the Return or Enter key is used in the line edit

.. versionadded:: 3.40
%End

void textEdited( const QString &text );
%Docstring
Emitted when the the value has been manually edited via line edit.

.. versionadded:: 3.40
%End

protected:

virtual void changeEvent( QEvent *event );
Expand Down
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 Expand Up @@ -372,6 +403,13 @@ Returns the X value of the X soft lock. The value is NaN is the constraint isn't
double softLockY() const;
%Docstring
Returns the Y value of the Y soft lock. The value is NaN is the constraint isn't magnetized to a line
%End

void toggleConstraintDistance();
%Docstring
Toggles the distance constraint.

.. versionadded:: 3.40
%End

QgsPointLocator::Match mapPointMatch() const;
Expand Down
104 changes: 104 additions & 0 deletions python/PyQt6/gui/auto_generated/qgsadvanceddigitizingtools.sip.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/************************************************************************
* 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

protected:

};


/************************************************************************
* 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
Loading

0 comments on commit 6994d1c

Please sign in to comment.