sec_interp.core.services.geology_service module

Geology Data Processing Service.

This module handles the extraction and projection of geological boundaries and unit segments from map layers to the cross-section plane.

class sec_interp.core.services.geology_service.GeologyService(profile_sampler: ProfileSampler | None = None, outcrop_processor: OutcropProcessor | None = None)

Bases: IGeologyService

Service for generating geological profiles.

__init__(profile_sampler: ProfileSampler | None = None, outcrop_processor: OutcropProcessor | None = None) None

Initialize service with specialized processors.

Parameters:
  • profile_sampler – Optional profile sampler.

  • outcrop_processor – Optional outcrop processor.

generate_geological_profile(line_lyr: qgis.core.QgsVectorLayer, raster_lyr: qgis.core.QgsRasterLayer, outcrop_lyr: qgis.core.QgsVectorLayer, outcrop_name_field: str, band_number: int = 1) list[GeologySegment]

Generate geological profile data by intersecting the section line with outcrop polygons.

Extracts geological unit intersections along the cross-section line, calculates elevations from the DEM, and returns a list of segments.

Parameters:
  • line_lyr – The QGIS vector layer representing the cross-section line.

  • raster_lyr – The Digital Elevation Model (DEM) raster layer.

  • outcrop_lyr – The QGIS vector layer containing geological outcrop polygons.

  • outcrop_name_field – The attribute field name for geological unit names.

  • band_number – The raster band to use for elevation sampling (default 1).

Returns:

A list of GeologySegment objects, sorted by distance along the section.

Return type:

GeologyData

Raises:
prepare_task_input(line_lyr: qgis.core.QgsVectorLayer, raster_lyr: qgis.core.QgsRasterLayer, outcrop_lyr: qgis.core.QgsVectorLayer, outcrop_name_field: str, band_number: int = 1) GeologyTaskInput

Prepare detached domain data for background task execution.

Extracts all necessary geometric and attribute data from QGIS layers to create a serializable input for asynchronous processing.

Parameters:
  • line_lyr – The cross-section line vector layer.

  • raster_lyr – The elevation raster layer.

  • outcrop_lyr – The geological outcrop vector layer.

  • outcrop_name_field – Field name for geological units.

  • band_number – Raster band for elevation sampling.

Returns:

Detached data ready for processing.

Return type:

GeologyTaskInput

process_task_data(task_input: GeologyTaskInput, feedback: Any | None = None) list[GeologySegment]

Process geological data in a thread-safe way (Domain-Pure logic).

Intersects the section line with detached outcrop geometries and assigns elevations sampled from the master profile.

Parameters:
  • task_input – Detached data for processing.

  • feedback – Optional QgsFeedback for progress tracking.

Returns:

Sorted list of geological segments.

Return type:

GeologyData