sec_interp.gui.adapters.profile_extractor module
Profile extraction adapter (Extract phase).
Bridges the QGIS object world and the QGIS-agnostic core layer for topographic
profiles. It reads the section line and samples elevations from a DEM raster,
returning a plain ProfileData list of (distance, elevation) tuples.
- class sec_interp.gui.adapters.profile_extractor.ProfileExtractor
Bases:
objectExtract topographic profile data from QGIS layers into primitives.
- calculate_lod_interval(line_lyr: qgis.core.QgsVectorLayer, canvas_width: int, feature_id: int | None = None) float | None
Compute the LOD sampling interval from the section line length.
- Parameters:
line_lyr – The cross-section line layer.
canvas_width – Current width of the preview canvas in pixels.
feature_id – Section feature id (first feature when
None).
- Returns:
The sampling interval, or None if the line length is unavailable.
- extract_profile(line_lyr: qgis.core.QgsVectorLayer, raster_lyr: qgis.core.QgsRasterLayer, band_number: int = 1, interval: float | None = None, feature_id: int | None = None) list[tuple[float, float]]
Sample elevation along a section line into a detached profile.
- Parameters:
line_lyr – The cross-section line layer.
raster_lyr – The DEM/raster layer for elevation.
band_number – Raster band to sample (default: 1).
interval – Optional sampling interval. If None, uses raster resolution.
feature_id – Section feature id (first feature when
None).
- Returns:
A list of
(distance, elevation)tuples representing the profile.- Raises:
DataMissingError – If the line layer has no features.
GeometryError – If the line geometry is invalid.
- tr(message: str) str
Translate a message using QCoreApplication.