sec_interp.gui.tools.measure_tool module¶
Measurement tool for Profile View.
This module provides the ProfileMeasureTool for measuring distances, elevation differences, and slopes in the profile preview window. It separates UI event handling from spatial snapping logic.
- class sec_interp.gui.tools.measure_tool.ProfileSnapper(canvas: QgsMapCanvas)¶
Bases:
objectHelper class to handle point snapping functionality.
- snap(mouse_pos: QPoint) QgsPointXY¶
Find the nearest vertex or edge to the mouse position.
- class sec_interp.gui.tools.measure_tool.ProfileMeasureTool(canvas: QgsMapCanvas)¶
Bases:
QgsMapToolEmitPointMap tool for measuring distances in profile view.
Supports multi-point polyline measurements: - Click to add points along the trace - Click “Finalizar” button in UI to complete measurement - Right-click or Escape to cancel and reset
- measurementChanged¶
str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- measurementCleared¶
str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- activate(self)¶
called when set as currently active map tool
- deactivate(self)¶
called when map tool is being deactivated
- reset()¶
Reset the tool state.
If measurement is finalized, only clears the points data but keeps the visual elements (rubber band and markers) visible.
- canvasReleaseEvent(event)¶
Handle mouse click release.
Left click: Add point to measurement
Right click: Cancel and reset
Press Enter to finalize (see keyPressEvent)
- canvasMoveEvent(event)¶
Handle mouse move for rubber band update.
- keyPressEvent(event)¶
Handle keyboard events.
Enter/Return: Finalize measurement
Escape: Cancel measurement
- finalize_measurement()¶
Finalize the measurement and emit final metrics.
This is a public method that can be called from UI buttons. After finalizing, the tool is deactivated but results remain visible.