2017-06-07 16:16:21 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/gui/qgsmaptooladvanceddigitizing.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-11 09:10:35 +02:00
|
|
|
class QgsMapToolAdvancedDigitizing : QgsMapToolEdit
|
|
|
|
{
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2018-05-26 14:10:30 +10:00
|
|
|
The QgsMapToolAdvancedDigitizing class is a QgsMapTool which gives event directly in map coordinates and allows filtering its events.
|
2017-12-15 10:36:55 -04:00
|
|
|
Events from QgsMapTool are caught and their QMouseEvent are transformed into QgsMapMouseEvent (with map coordinates).
|
|
|
|
Events are then forwarded to corresponding virtual methods which can be reimplemented in subclasses.
|
2018-01-09 17:26:37 -04:00
|
|
|
An event filter can be set on the map tool to filter and modify the events in map coordinates (:py:class:`QgsMapToolMapEventFilter`).
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. note::
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
at the moment, the event filter is used by the CAD tools (:py:class:`QgsCadDocWidget`).
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-06-07 16:16:21 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
the event filter definition is not exposed in Python API to avoid any unexpected behavior.
|
|
|
|
%End
|
|
|
|
|
2015-09-11 09:10:35 +02:00
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsmaptooladvanceddigitizing.h"
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
explicit QgsMapToolAdvancedDigitizing( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Creates an advanced digitizing maptool
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2018-05-27 16:42:41 +10:00
|
|
|
:param canvas: The map canvas on which the tool works
|
|
|
|
:param cadDockWidget: The cad dock widget which will be used to adjust mouse events
|
2017-06-07 16:16:21 +02:00
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual void canvasPressEvent( QgsMapMouseEvent *e );
|
2017-12-15 08:57:22 +10:00
|
|
|
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
Catch the mouse press event, filters it, transforms it to map coordinates and send it to virtual method
|
|
|
|
%End
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual void canvasReleaseEvent( QgsMapMouseEvent *e );
|
2017-12-15 08:57:22 +10:00
|
|
|
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
Catch the mouse release event, filters it, transforms it to map coordinates and send it to virtual method
|
|
|
|
%End
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual void canvasMoveEvent( QgsMapMouseEvent *e );
|
2017-12-15 08:57:22 +10:00
|
|
|
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
Catch the mouse move event, filters it, transforms it to map coordinates and send it to virtual method
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
2015-10-20 20:41:47 +02:00
|
|
|
virtual void activate();
|
2017-12-15 08:57:22 +10:00
|
|
|
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Registers this maptool with the cad dock widget
|
2017-06-07 16:16:21 +02:00
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
2015-10-20 20:41:47 +02:00
|
|
|
virtual void deactivate();
|
2017-12-15 08:57:22 +10:00
|
|
|
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Unregisters this maptool from the cad dock widget
|
2017-06-07 16:16:21 +02:00
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsAdvancedDigitizingDockWidget *cadDockWidget() const;
|
2017-06-07 16:16:21 +02:00
|
|
|
|
2017-08-29 18:37:27 +02:00
|
|
|
bool isAdvancedDigitizingAllowed() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns whether functionality of advanced digitizing dock widget is currently allowed.
|
|
|
|
|
|
|
|
Tools may decide to switch this support on/off based on the current state of the map tool.
|
2018-01-29 20:52:50 +01:00
|
|
|
For example, in vertex tool before user picks a vertex to move, advanced digitizing dock
|
2017-12-15 10:36:55 -04:00
|
|
|
widget should be disabled and only enabled once a vertex is being moved. Other map tools
|
|
|
|
may keep advanced digitizing allowed all the time.
|
2017-08-29 18:37:27 +02:00
|
|
|
|
2019-02-26 19:54:09 +10:00
|
|
|
If ``True`` is returned, that does not mean that advanced digitizing is actually active,
|
2017-12-15 10:36:55 -04:00
|
|
|
because it is up to the user to enable/disable it when it is allowed.
|
|
|
|
\sa setAdvancedDigitizingAllowed()
|
|
|
|
|
2017-08-29 18:37:27 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
bool isAutoSnapEnabled() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns whether mouse events (press/move/release) should automatically try to snap mouse position
|
|
|
|
(according to the snapping configuration of map canvas) before passing the mouse coordinates
|
|
|
|
to the tool. This may be desirable default behavior for some map tools, but not for other map tools.
|
|
|
|
It is therefore possible to configure the behavior by the map tool.
|
|
|
|
\sa isAutoSnapEnabled()
|
|
|
|
|
2017-08-29 18:37:27 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
|
|
|
protected:
|
2017-06-07 16:16:21 +02:00
|
|
|
|
2017-08-29 18:37:27 +02:00
|
|
|
void setAdvancedDigitizingAllowed( bool allowed );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets whether functionality of advanced digitizing dock widget is currently allowed.
|
|
|
|
This method is protected because it should be a decision of the map tool and not from elsewhere.
|
|
|
|
\sa isAdvancedDigitizingAllowed()
|
|
|
|
|
2017-08-29 18:37:27 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setAutoSnapEnabled( bool enabled );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets whether mouse events (press/move/release) should automatically try to snap mouse position
|
|
|
|
This method is protected because it should be a decision of the map tool and not from elsewhere.
|
|
|
|
\sa isAutoSnapEnabled()
|
|
|
|
|
2017-08-29 18:37:27 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2019-06-04 10:23:16 +02:00
|
|
|
|
|
|
|
|
2017-10-09 19:06:21 +02:00
|
|
|
public:
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual void cadCanvasPressEvent( QgsMapMouseEvent *e );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Override this method when subclassing this class.
|
|
|
|
This will receive adapted events from the cad system whenever a
|
|
|
|
canvasPressEvent is triggered and it's not hidden by the cad's
|
|
|
|
construction mode.
|
2017-06-07 16:16:21 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param e: Mouse events prepared by the cad system
|
2017-06-07 16:16:21 +02:00
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual void cadCanvasReleaseEvent( QgsMapMouseEvent *e );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Override this method when subclassing this class.
|
|
|
|
This will receive adapted events from the cad system whenever a
|
|
|
|
canvasReleaseEvent is triggered and it's not hidden by the cad's
|
|
|
|
construction mode.
|
2017-06-07 16:16:21 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param e: Mouse events prepared by the cad system
|
2017-06-07 16:16:21 +02:00
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual void cadCanvasMoveEvent( QgsMapMouseEvent *e );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Override this method when subclassing this class.
|
|
|
|
This will receive adapted events from the cad system whenever a
|
|
|
|
canvasMoveEvent is triggered and it's not hidden by the cad's
|
|
|
|
construction mode.
|
2017-06-07 16:16:21 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param e: Mouse events prepared by the cad system
|
2018-08-23 10:46:02 +02:00
|
|
|
%End
|
|
|
|
|
2018-09-07 16:21:37 +02:00
|
|
|
bool snapToLayerGridEnabled() const;
|
2018-08-23 10:46:02 +02:00
|
|
|
%Docstring
|
|
|
|
Enables or disables snap to grid of mouse events.
|
2018-09-07 16:21:37 +02:00
|
|
|
The snapping will occur in the layer's CRS.
|
2018-08-23 10:46:02 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.4
|
|
|
|
%End
|
|
|
|
|
2018-09-07 16:21:37 +02:00
|
|
|
void setSnapToLayerGridEnabled( bool snapToLayerGridEnabled );
|
2018-08-23 10:46:02 +02:00
|
|
|
%Docstring
|
|
|
|
Enables or disables snap to grid of mouse events.
|
2018-09-07 16:21:37 +02:00
|
|
|
The snapping will occur in the layer's CRS.
|
2018-08-23 10:46:02 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.4
|
2017-06-07 16:16:21 +02:00
|
|
|
%End
|
|
|
|
|
2015-09-11 09:10:35 +02:00
|
|
|
};
|
2017-06-07 16:16:21 +02:00
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/gui/qgsmaptooladvanceddigitizing.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|