sec_interp.gui.tools.measure_tool module

class sec_interp.gui.tools.measure_tool.ProfileMeasureTool(*args: Any, **kwargs: Any)[source]

Bases: QgsMapToolEmitPoint

Map 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

activate() None[source]

Activate the measurement tool.

canvasMoveEvent(event: Any) None[source]

Handle mouse move for rubber band update.

Parameters:

event – Map tool event from QGIS

canvasReleaseEvent(event: Any) None[source]

Handle mouse click release.

  • Left click: Add point to measurement

  • Right click: Cancel and reset

  • Press Enter to finalize (see keyPressEvent)

Parameters:

event – Map tool event from QGIS

deactivate() None[source]

Deactivate the measurement tool.

Note: We no longer call reset() here to allow measurements to persist visually until a new one is started or explicitly cleared.

finalize_measurement()[source]

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.

keyPressEvent(event: Any) None[source]

Handle keyboard events.

  • Enter/Return: Finalize measurement

  • Escape: Cancel measurement

Parameters:

event – Key event from QGIS

measurementChanged

alias of dict

reset()[source]

Reset the tool state.

If measurement is finalized, only clears the points data but keeps the visual elements (rubber band and markers) visible.

class sec_interp.gui.tools.measure_tool.ProfileSnapper(canvas: qgis.gui.QgsMapCanvas)[source]

Bases: object

Helper class to handle point snapping functionality.

snap(mouse_pos: qgis.PyQt.QtCore.QPoint) qgis.core.QgsPointXY[source]

Find the nearest vertex or edge to the mouse position.