2017-06-07 16:16:21 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/gui/qgsmaptool.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2007-08-06 23:33:00 +00:00
|
|
|
%ModuleHeaderCode
|
|
|
|
// fix to allow compilation with sip 4.7 that for some reason
|
|
|
|
// doesn't add these includes to the file where the code from
|
|
|
|
// ConvertToSubClassCode goes.
|
|
|
|
#include <qgsmaptoolzoom.h>
|
|
|
|
#include <qgsmaptoolpan.h>
|
|
|
|
#include <qgsmaptoolemitpoint.h>
|
2013-01-25 08:06:30 +01:00
|
|
|
#include <qgsmaptoolidentify.h>
|
2007-08-06 23:33:00 +00:00
|
|
|
%End
|
|
|
|
|
2007-04-23 14:57:08 +00:00
|
|
|
class QgsMapTool : QObject
|
2007-01-09 02:39:15 +00:00
|
|
|
{
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Abstract base class for all map tools.
|
|
|
|
Map tools are user interactive tools for manipulating the
|
|
|
|
map canvas. For example map pan and zoom features are
|
|
|
|
implemented as map tools.
|
2017-06-07 16:16:21 +02:00
|
|
|
%End
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
%TypeHeaderCode
|
2017-06-07 16:16:21 +02:00
|
|
|
#include "qgsmaptool.h"
|
2007-01-09 02:39:15 +00:00
|
|
|
%End
|
|
|
|
%ConvertToSubClassCode
|
2017-06-07 16:16:21 +02:00
|
|
|
if ( dynamic_cast<QgsMapToolZoom *>( sipCpp ) != NULL )
|
|
|
|
sipType = sipType_QgsMapToolZoom;
|
|
|
|
else if ( dynamic_cast<QgsMapToolPan *>( sipCpp ) != NULL )
|
|
|
|
sipType = sipType_QgsMapToolPan;
|
|
|
|
else if ( dynamic_cast<QgsMapToolEmitPoint *>( sipCpp ) != NULL )
|
|
|
|
sipType = sipType_QgsMapToolEmitPoint;
|
|
|
|
else if ( dynamic_cast<QgsMapToolIdentify *>( sipCpp ) != NULL )
|
|
|
|
sipType = sipType_QgsMapToolIdentify;
|
|
|
|
else
|
|
|
|
sipType = NULL;
|
2007-01-09 02:39:15 +00:00
|
|
|
%End
|
|
|
|
public:
|
2013-01-12 23:48:58 +01:00
|
|
|
|
2016-05-30 02:42:12 +10:00
|
|
|
enum Flag
|
|
|
|
{
|
2017-06-07 16:16:21 +02:00
|
|
|
Transient,
|
|
|
|
EditTool,
|
|
|
|
AllowZoomRect,
|
2016-05-30 02:42:12 +10:00
|
|
|
};
|
|
|
|
typedef QFlags<QgsMapTool::Flag> Flags;
|
|
|
|
|
2017-06-07 16:16:21 +02:00
|
|
|
|
2016-05-30 02:42:12 +10:00
|
|
|
virtual Flags flags() const;
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the flags for the map tool.
|
|
|
|
|
2017-06-07 16:16:21 +02:00
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
2016-05-30 02:42:12 +10:00
|
|
|
|
2017-12-15 08:57:22 +10:00
|
|
|
~QgsMapTool();
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual void canvasMoveEvent( QgsMapMouseEvent *e );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
Mouse move event for overriding. Default implementation does nothing.
|
|
|
|
%End
|
2008-05-29 15:59:57 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual void canvasDoubleClickEvent( QgsMapMouseEvent *e );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-07-04 21:36:59 +02:00
|
|
|
Mouse double-click event for overriding. Default implementation does nothing.
|
2017-06-07 16:16:21 +02:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual void canvasPressEvent( QgsMapMouseEvent *e );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
Mouse press event for overriding. Default implementation does nothing.
|
|
|
|
%End
|
2009-02-06 15:42:35 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual void canvasReleaseEvent( QgsMapMouseEvent *e );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
Mouse release event for overriding. Default implementation does nothing.
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual void wheelEvent( QWheelEvent *e );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
Mouse wheel event for overriding. Default implementation does nothing.
|
|
|
|
%End
|
2013-03-30 20:12:02 +01:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual void keyPressEvent( QKeyEvent *e );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
Key event for overriding. Default implementation does nothing.
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual void keyReleaseEvent( QKeyEvent *e );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
Key event for overriding. Default implementation does nothing.
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual bool gestureEvent( QGestureEvent *e );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
gesture event for overriding. Default implementation does nothing.
|
|
|
|
%End
|
2009-02-06 15:42:35 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setAction( QAction *action );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Use this to associate a QAction to this maptool. Then when the setMapTool
|
|
|
|
method of mapcanvas is called the action state will be set to on.
|
|
|
|
Usually this will cause e.g. a toolbutton to appear pressed in and
|
|
|
|
the previously used toolbutton to pop out. *
|
2017-06-07 16:16:21 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QAction *action();
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
Return associated action with map tool or NULL if no action is associated
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setButton( QAbstractButton *button );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Use this to associate a button to this maptool. It has the same meaning
|
|
|
|
as setAction() function except it works with a button instead of an QAction. *
|
2017-06-07 16:16:21 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QAbstractButton *button();
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
Return associated button with map tool or NULL if no button is associated
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual void setCursor( const QCursor &cursor );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
Set a user defined cursor
|
|
|
|
%End
|
2013-06-28 09:56:56 +02:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
virtual void activate();
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
called when set as currently active map tool
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
virtual void deactivate();
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
called when map tool is being deactivated
|
2017-10-16 22:13:47 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
virtual void clean();
|
|
|
|
%Docstring
|
|
|
|
convenient method to clean members
|
2017-06-07 16:16:21 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsMapCanvas *canvas();
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
returns pointer to the tool's map canvas
|
|
|
|
%End
|
2014-05-02 10:32:37 +02:00
|
|
|
|
2014-01-29 16:35:20 +01:00
|
|
|
QString toolName();
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emit map tool changed with the old tool
|
|
|
|
|
2017-06-07 16:16:21 +02:00
|
|
|
.. versionadded:: 2.3
|
|
|
|
%End
|
2014-03-19 08:16:33 +01:00
|
|
|
|
2014-03-27 13:45:25 +01:00
|
|
|
static double searchRadiusMM();
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Get search radius in mm. Used by identify, tip etc.
|
|
|
|
The values is currently set in identify tool options (move somewhere else?)
|
|
|
|
and defaults to Qgis.DEFAULT_SEARCH_RADIUS_MM.
|
|
|
|
|
2017-06-07 16:16:21 +02:00
|
|
|
.. versionadded:: 2.3
|
|
|
|
%End
|
2014-03-27 13:45:25 +01:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
static double searchRadiusMU( const QgsRenderContext &context );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Get search radius in map units for given context. Used by identify, tip etc.
|
|
|
|
The values is calculated from searchRadiusMM().
|
|
|
|
|
2017-06-07 16:16:21 +02:00
|
|
|
.. versionadded:: 2.3
|
|
|
|
%End
|
2014-03-27 13:45:25 +01:00
|
|
|
|
2017-05-03 07:45:22 +02:00
|
|
|
static double searchRadiusMU( QgsMapCanvas *canvas );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Get search radius in map units for given canvas. Used by identify, tip etc.
|
|
|
|
The values is calculated from searchRadiusMM().
|
|
|
|
|
2017-06-07 16:16:21 +02:00
|
|
|
.. versionadded:: 2.3
|
|
|
|
%End
|
2014-03-27 13:45:25 +01:00
|
|
|
|
2014-03-19 08:16:33 +01:00
|
|
|
signals:
|
2018-02-05 22:11:34 -04:00
|
|
|
void messageEmitted( const QString &message, Qgis::MessageLevel = Qgis::Info );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
emit a message
|
|
|
|
%End
|
2014-03-19 08:16:33 +01:00
|
|
|
|
2014-03-21 07:08:56 +01:00
|
|
|
void messageDiscarded();
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
emit signal to clear previous message
|
|
|
|
%End
|
2014-09-11 10:41:02 +02:00
|
|
|
|
|
|
|
void activated();
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
signal emitted once the map tool is activated
|
|
|
|
%End
|
2014-09-11 10:41:02 +02:00
|
|
|
|
|
|
|
void deactivated();
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
signal emitted once the map tool is deactivated
|
|
|
|
%End
|
2008-11-25 21:37:38 +00:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
protected:
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsMapTool( QgsMapCanvas *canvas /TransferThis/ );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
constructor takes map canvas as a parameter
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsPointXY toMapCoordinates( QPoint point );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
transformation from screen coordinates to map coordinates
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsPointXY toLayerCoordinates( const QgsMapLayer *layer, QPoint point );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
transformation from screen coordinates to layer's coordinates
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsPointXY toLayerCoordinates( const QgsMapLayer *layer, const QgsPointXY &point );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
transformation from map coordinates to layer's coordinates
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsPointXY toMapCoordinates( const QgsMapLayer *layer, const QgsPointXY &point );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
transformation from layer's coordinates to map coordinates (which is different in case reprojection is used)
|
|
|
|
%End
|
2008-11-25 21:37:38 +00:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsPoint toMapCoordinates( const QgsMapLayer *layer, const QgsPoint &point ) /PyName=toMapCoordinatesV2/;
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
transformation from layer's coordinates to map coordinates (which is different in case reprojection is used)
|
|
|
|
|
2017-06-07 16:16:21 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
available in Python bindings as toMapCoordinatesV2
|
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsRectangle toLayerCoordinates( const QgsMapLayer *layer, const QgsRectangle &rect );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
trnasformation of the rect from map coordinates to layer's coordinates
|
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QPoint toCanvasCoordinates( const QgsPointXY &point );
|
2017-06-07 16:16:21 +02:00
|
|
|
%Docstring
|
|
|
|
transformation from map coordinates to screen coordinates
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2013-01-12 23:48:58 +01:00
|
|
|
|
2016-05-30 06:19:34 +10:00
|
|
|
|
|
|
|
|
2017-06-07 16:16:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-05-30 06:19:34 +10:00
|
|
|
QFlags<QgsMapTool::Flag> operator|(QgsMapTool::Flag f1, QFlags<QgsMapTool::Flag> f2);
|
2017-06-07 16:16:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/gui/qgsmaptool.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|