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: qgis.gui.QgsMapCanvas)¶
Bases:
objectHelper class to handle point snapping functionality.
- snap(mouse_pos: qgis.PyQt.QtCore.QPoint) qgis.core.QgsPointXY¶
Finds the nearest vertex or edge to the mouse position.
- class sec_interp.gui.tools.measure_tool.ProfileMeasureTool(*args: Any, **kwargs: Any)¶
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¶
alias of
dict
- activate()¶
- deactivate()¶
- reset()¶
Resets 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.