/usr/include/qgis/qgsmaptooladvanceddigitizing.h is in libqgis-dev 2.18.17+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | /***************************************************************************
qgsmaptooladvanceddigitizing.h - map tool with event in map coordinates
----------------------
begin : October 2014
copyright : (C) Denis Rouzaud
email : denis.rouzaud@gmail.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 QGSMAPTOOLADVANCEDDIGITIZE_H
#define QGSMAPTOOLADVANCEDDIGITIZE_H
#include "qgsmaptool.h"
#include "qgsmaptooledit.h"
#include "qgsadvanceddigitizingdockwidget.h"
class QgsMapMouseEvent;
/** \ingroup gui
* @brief The QgsMapToolAdvancedDigitizing class is a QgsMapTool whcih gives event directly in map coordinates and allows filtering its events.
* 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.
* An event filter can be set on the map tool to filter and modify the events in map coordinates (@see QgsMapToolMapEventFilter).
* @note at the moment, the event filter is used by the CAD tools (@see QgsCadDocWidget).
* @note the event filter definition is not exposed in python API to avoid any unexpected behavior.
*/
class GUI_EXPORT QgsMapToolAdvancedDigitizing : public QgsMapToolEdit
{
Q_OBJECT
public:
//! Different capture modes
enum CaptureMode
{
CaptureNone, //!< Do not capture
CapturePoint, //!< Capture points
CaptureLine, //!< Capture lines
CapturePolygon //!< Capture polygons
};
/**
* Creates an advanced digitizing maptool
* @param canvas The map canvas on which the tool works
* @param cadDockWidget The cad dock widget which will be used to adjust mouse events
*/
explicit QgsMapToolAdvancedDigitizing( QgsMapCanvas* canvas, QgsAdvancedDigitizingDockWidget* cadDockWidget );
~QgsMapToolAdvancedDigitizing();
//! catch the mouse press event, filters it, transforms it to map coordinates and send it to virtual method
virtual void canvasPressEvent( QgsMapMouseEvent* e ) override;
//! catch the mouse release event, filters it, transforms it to map coordinates and send it to virtual method
virtual void canvasReleaseEvent( QgsMapMouseEvent* e ) override;
//! catch the mouse move event, filters it, transforms it to map coordinates and send it to virtual method
virtual void canvasMoveEvent( QgsMapMouseEvent* e ) override;
/**
* The capture mode
*
* @return Capture mode
*/
CaptureMode mode() const { return mCaptureMode; }
/**
* Set capture mode. This should correspond to the layer on which the digitizing
* happens.
*
* @param mode Capture Mode
*/
void setMode( CaptureMode mode ) { mCaptureMode = mode; }
/**
* Registers this maptool with the cad dock widget
*/
virtual void activate() override;
/**
* Unregisters this maptool from the cad dock widget
*/
virtual void deactivate() override;
QgsAdvancedDigitizingDockWidget* cadDockWidget() const { return mCadDockWidget; }
protected:
/**
* 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.
*
* @param e Mouse events prepared by the cad system
*/
virtual void cadCanvasPressEvent( QgsMapMouseEvent* e ) { Q_UNUSED( e ) }
/**
* 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.
*
* @param e Mouse events prepared by the cad system
*/
virtual void cadCanvasReleaseEvent( QgsMapMouseEvent* e ) { Q_UNUSED( e ) }
/**
* 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.
*
* @param e Mouse events prepared by the cad system
*/
virtual void cadCanvasMoveEvent( QgsMapMouseEvent* e ) { Q_UNUSED( e ) }
//! The capture mode in which this tool operates
CaptureMode mCaptureMode;
bool mSnapOnPress; //!< snap on press
bool mSnapOnRelease; //!< snap on release
bool mSnapOnMove; //!< snap on move
bool mSnapOnDoubleClick; //!< snap on double click
private slots:
/**
* Is to be called by the cad system whenever a point changes outside of a
* mouse event. E.g. when additional constraints are toggled.
* The specified point will be used to generate a fake mouse event which will
* be sent as move event to cadCanvasMoveEvent.
*
* @param point The last point known to the cad system.
*/
void cadPointChanged( const QgsPoint& point );
private:
QgsAdvancedDigitizingDockWidget* mCadDockWidget;
void snap( QgsMapMouseEvent* e );
};
#endif // QGSMAPTOOLADVANCEDDIGITIZE_H
|