Subgroup: Map

Class: QgsMapToolAdvancedDigitizing

class qgis.gui.QgsMapToolAdvancedDigitizing

Bases: qgis._gui.QgsMapToolEdit

The QgsMapToolAdvancedDigitizing class is a QgsMapTool which 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 (QgsMapToolMapEventFilter).

Note

at the moment, the event filter is used by the CAD tools (QgsCadDocWidget).

Note

the event filter definition is not exposed in Python API to avoid any unexpected behavior.

Methods

action Return associated action with map tool or NULL if no action is associated
activate Registers this maptool with the cad dock widget
addTopologicalPoints
blockSignals
button Return associated button with map tool or NULL if no button is associated
cadCanvasMoveEvent Override this method when subclassing this class.
cadCanvasPressEvent Override this method when subclassing this class.
cadCanvasReleaseEvent Override this method when subclassing this class.
cadDockWidget
canvas returns pointer to the tool’s map canvas
canvasDoubleClickEvent Mouse double-click event for overriding.
canvasMoveEvent Catch the mouse move event, filters it, transforms it to map coordinates and send it to virtual method
canvasPressEvent Catch the mouse press event, filters it, transforms it to map coordinates and send it to virtual method
canvasReleaseEvent Catch the mouse release event, filters it, transforms it to map coordinates and send it to virtual method
childEvent
children
clean convenient method to clean members
connectNotify
createGeometryRubberBand
createRubberBand
currentVectorLayer
customEvent
deactivate Unregisters this maptool from the cad dock widget
defaultZValue Return default Z value
deleteLater
digitizingFillColor
digitizingStrokeColor
digitizingStrokeWidth
disconnect
disconnectNotify
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
event
eventFilter
findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
flags
gestureEvent gesture event for overriding. Default implementation does nothing.
inherits
installEventFilter
isAdvancedDigitizingAllowed Returns whether functionality of advanced digitizing dock widget is currently allowed.
isAutoSnapEnabled 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.
isSignalConnected
isWidgetType
isWindowType
keyPressEvent Key event for overriding.
keyReleaseEvent Key event for overriding.
killTimer
metaObject
moveToThread
notifyNotEditableLayer
notifyNotVectorLayer
objectName
parent
property
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
receivers
removeEventFilter
searchRadiusMM Get search radius in mm.
searchRadiusMU Get search radius in map units for given context.
sender
senderSignalIndex
setAction Use this to associate a QAction to this maptool.
setAdvancedDigitizingAllowed Sets whether functionality of advanced digitizing dock widget is currently allowed.
setAutoSnapEnabled 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.
setButton Use this to associate a button to this maptool.
setCursor Set a user defined cursor
setObjectName
setParent
setProperty
signalsBlocked
startTimer
thread
timerEvent
toCanvasCoordinates
toLayerCoordinates
toMapCoordinates
toMapCoordinatesV2
toolName Emit map tool changed with the old tool
tr
wheelEvent Mouse wheel event for overriding.

Attributes

AllowZoomRect
EditTool
Transient
activated signal emitted once the map tool is activated [signal]
deactivated signal emitted once the map tool is deactivated [signal]
destroyed destroyed(self, QObject = None) [signal]
messageDiscarded emit signal to clear previous message [signal]
messageEmitted emit a message [signal]
objectNameChanged objectNameChanged(self, str) [signal]
staticMetaObject
activate(self)

Registers this maptool with the cad dock widget

addTopologicalPoints()
cadCanvasMoveEvent(self, e: QgsMapMouseEvent)

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.

Parameters:e – Mouse events prepared by the cad system
cadCanvasPressEvent(self, e: QgsMapMouseEvent)

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.

Parameters:e – Mouse events prepared by the cad system
cadCanvasReleaseEvent(self, e: QgsMapMouseEvent)

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.

Parameters:e – Mouse events prepared by the cad system
cadDockWidget(self) → QgsAdvancedDigitizingDockWidget
canvasMoveEvent(self, e: QgsMapMouseEvent)

Catch the mouse move event, filters it, transforms it to map coordinates and send it to virtual method

canvasPressEvent(self, e: QgsMapMouseEvent)

Catch the mouse press event, filters it, transforms it to map coordinates and send it to virtual method

canvasReleaseEvent(self, e: QgsMapMouseEvent)

Catch the mouse release event, filters it, transforms it to map coordinates and send it to virtual method

childEvent()
connectNotify()
createGeometryRubberBand()
createRubberBand()
currentVectorLayer()
customEvent()
deactivate(self)

Unregisters this maptool from the cad dock widget

digitizingFillColor()
digitizingStrokeColor()
digitizingStrokeWidth()
disconnectNotify()
isAdvancedDigitizingAllowed(self) → bool

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. For example, in node tool before user picks a vertex to move, advanced digitizing dock widget should be disabled and only enabled once a vertex is being moved. Other map tools may keep advanced digitizing allowed all the time.

If true is returned, that does not mean that advanced digitizing is actually active, because it is up to the user to enable/disable it when it is allowed. sa setAdvancedDigitizingAllowed()

New in version 3.0.

isAutoSnapEnabled(self) → bool

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()

New in version 3.0.

isSignalConnected()
notifyNotEditableLayer()
notifyNotVectorLayer()
receivers()
sender()
senderSignalIndex()
setAdvancedDigitizingAllowed(self, allowed: bool)

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()

New in version 3.0.

setAutoSnapEnabled(self, enabled: bool)

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()

New in version 3.0.

timerEvent()
toCanvasCoordinates()
toLayerCoordinates()
toMapCoordinates()
toMapCoordinatesV2()