sec_interp.core.domain package

SecInterp Core Domain Package.

This package contains the domain entities, DTOs, and enums that define the core business logic of the plugin, decoupled from QGIS-specific implementation details where possible.

sec_interp.core.domain.DomainGeometry

alias of str

class sec_interp.core.domain.DrillholeTaskInput(line_geometry_wkt: str, line_start_x: float, line_start_y: float, line_crs_authid: str, section_azimuth: float, buffer_width: float, collar_id_field: str, use_geometry: bool, collar_x_field: str, collar_y_field: str, collar_z_field: str, collar_depth_field: str, collar_data: list[dict[str, ~typing.Any]], survey_data: dict[~typing.Any, list[tuple[float, float, float]]], interval_data: dict[~typing.Any, list[tuple[float, float, str]]], pre_sampled_z: dict[~typing.Any, float] = <factory>)

Bases: object

Data Transfer Object for DrillholeGenerationTask.

Encapsulates all data required to project and process drillholes in a background thread without accessing QGIS API objects.

line_geometry_wkt

Section geometry in WKT.

Type:

str

line_start_x

Start vertex X.

Type:

float

line_start_y

Start vertex Y.

Type:

float

line_crs_authid

CRS of the section line.

Type:

str

section_azimuth

Azimuth orientation in degrees.

Type:

float

buffer_width

Maximum horizontal projection buffer.

Type:

float

collar_id_field

ID field name.

Type:

str

use_geometry

Whether to use geometric coordinates for collars.

Type:

bool

collar_x_field

Fallback X field name.

Type:

str

collar_y_field

Fallback Y field name.

Type:

str

collar_z_field

Collar elevation field.

Type:

str

collar_depth_field

Total depth field.

Type:

str

collar_data

List of detached features.

Type:

list[dict[str, Any]]

survey_data

Dictionary mapping hole IDs to survey readings.

Type:

dict[Any, list[tuple[float, float, float]]]

interval_data

Dictionary mapping hole IDs to geological logs.

Type:

dict[Any, list[tuple[float, float, str]]]

pre_sampled_z

Dictionary of pre-calculated collar elevations.

Type:

dict[Any, float]

buffer_width: float
collar_data: list[dict[str, Any]]
collar_depth_field: str
collar_id_field: str
collar_x_field: str
collar_y_field: str
collar_z_field: str
interval_data: dict[Any, list[tuple[float, float, str]]]
line_crs_authid: str
line_geometry_wkt: str
line_start_x: float
line_start_y: float
pre_sampled_z: dict[Any, float]
section_azimuth: float
survey_data: dict[Any, list[tuple[float, float, float]]]
use_geometry: bool
class sec_interp.core.domain.FieldType(*values)

Bases: IntEnum

Core-safe field types mapping to QVariant.Type values.

This allows the core module to perform type validation WITHOUT direct dependencies on PyQt components.

BOOL = 1
DATE = 14
DATE_TIME = 16
DOUBLE = 6
INT = 2
LONG_LONG = 4
NULL = 0
STRING = 10
class sec_interp.core.domain.GeologySegment(unit_name: str, geometry_wkt: str | None, attributes: dict[str, ~typing.Any], points: list[tuple[float, float]], points_3d: list[tuple[float, float, float]] = <factory>, points_3d_projected: list[tuple[float, float, float]] = <factory>)

Bases: object

Represents a geological unit segment along the profile.

unit_name

Name of the geological unit.

Type:

str

geometry_wkt

WKT representation of the segment geometry (optional).

Type:

str | None

attributes

Dictionary containing original feature attributes.

Type:

dict[str, Any]

points

Sampled points (distance, elevation) representing the segment boundary.

Type:

list[tuple[float, float]]

attributes: dict[str, Any]
geometry_wkt: str | None
points: list[tuple[float, float]]
points_3d: list[tuple[float, float, float]]
points_3d_projected: list[tuple[float, float, float]]
unit_name: str
class sec_interp.core.domain.GeologyTaskInput(line_geometry_wkt: str, line_start_x: float, line_start_y: float, crs_authid: str, master_profile_data: list[tuple[float, float]], master_grid_dists: list[tuple[float, tuple[float, float], float]], outcrop_data: list[dict[str, Any]], outcrop_name_field: str, tolerance: float = 0.001)

Bases: object

Data Transfer Object for GeologyGenerationTask.

Contains all necessary data to process geological profiles without accessing QGIS layers directly.

line_geometry_wkt

Section geometry in WKT format.

Type:

str

line_start_x

X coordinate of section start vertex.

Type:

float

line_start_y

Y coordinate of section start vertex.

Type:

float

crs_authid

Authority ID for the CRS (e.g., ‘EPSG:4326’).

Type:

str

master_profile_data

Sampled topography elevations.

Type:

list[tuple[float, float]]

master_grid_dists

Grid distances for point sampling.

Type:

list[tuple[float, tuple[float, float], float]]

outcrop_data

Detached outcrop features (geometries and attrs).

Type:

list[dict[str, Any]]

outcrop_name_field

Name of the field containing unit info.

Type:

str

tolerance

Distance tolerance for intersection sampling.

Type:

float

crs_authid: str
line_geometry_wkt: str
line_start_x: float
line_start_y: float
master_grid_dists: list[tuple[float, tuple[float, float], float]]
master_profile_data: list[tuple[float, float]]
outcrop_data: list[dict[str, Any]]
outcrop_name_field: str
tolerance: float = 0.001
class sec_interp.core.domain.InterpretationPolygon(id: str, name: str, type: str, vertices_2d: list[tuple[float, float]], attributes: dict[str, ~typing.Any] = <factory>, color: str = '#FF0000', created_at: str = '')

Bases: object

Represents a 2D digitized interpretation polygon on the section profile.

id

Unique identifier for the polygon.

Type:

str

name

User-defined name for the interpreted unit/feature.

Type:

str

type

Classification (e.g., ‘lithology’, ‘fault’, ‘alteration’).

Type:

str

vertices_2d

List of (distance, elevation) points defining the polygon.

Type:

list[tuple[float, float]]

attributes

Metadata for the interpretation.

Type:

dict[str, Any]

color

Visual representation color (HEX).

Type:

str

created_at

ISO timestamp of creation.

Type:

str

attributes: dict[str, Any]
color: str = '#FF0000'
created_at: str = ''
id: str
name: str
type: str
vertices_2d: list[tuple[float, float]]
class sec_interp.core.domain.InterpretationPolygon25D(id: str, name: str, type: str, geometry_wkt: str, attributes: dict[str, Any], crs_authid: str)

Bases: object

Represents a georeferenced 2.5D interpretation geometry (with M coordinates).

id

Inherited identifier.

Type:

str

name

Inherited name.

Type:

str

type

Inherited type.

Type:

str

geometry_wkt

Domain Geometry in WKT format.

Type:

str

attributes

Inherited and calculated attributes.

Type:

dict[str, Any]

crs_authid

CRS Auth ID (e.g. ‘EPSG:4326’).

Type:

str

attributes: dict[str, Any]
crs_authid: str
geometry_wkt: str
id: str
name: str
type: str
class sec_interp.core.domain.PreviewParams(raster_layer: str, line_layer: str, band_num: int, buffer_dist: float = 100.0, outcrop_layer: str | None = None, outcrop_name_field: str | None = None, struct_layer: str | None = None, dip_field: str | None = None, strike_field: str | None = None, dip_scale_factor: float = 1.0, collar_layer: str | None = None, collar_id_field: str | None = None, collar_use_geometry: bool = True, collar_x_field: str | None = None, collar_y_field: str | None = None, collar_z_field: str | None = None, collar_depth_field: str | None = None, survey_layer: str | None = None, survey_id_field: str | None = None, survey_depth_field: str | None = None, survey_azim_field: str | None = None, survey_incl_field: str | None = None, interval_layer: str | None = None, interval_id_field: str | None = None, interval_from_field: str | None = None, interval_to_field: str | None = None, interval_lith_field: str | None = None, max_points: int = 1000, canvas_width: int = 800, auto_lod: bool = True)

Bases: object

Consolidated parameters for profile generation and preview.

raster_layer

QGIS layer ID for DEM sampling.

Type:

str

line_layer

QGIS layer ID for the section orientation.

Type:

str

band_num

Raster band number to use for elevation.

Type:

int

buffer_dist

Search buffer for projecting data onto the section.

Type:

float

outcrop_layer

Optional layer ID with geological outcrops.

Type:

str | None

outcrop_name_field

Field name for geological unit names.

Type:

str | None

struct_layer

Optional layer ID with structural measurements.

Type:

str | None

dip_field

Field name for dip values.

Type:

str | None

strike_field

Field name for strike/azimuth values.

Type:

str | None

dip_scale_factor

Visual scale factor for dip lines.

Type:

float

collar_layer

Optional layer ID with drillhole collars.

Type:

str | None

collar_id_field

Field name for drillhole IDs in collar layer.

Type:

str | None

collar_use_geometry

Whether to use layer geometry for collar coordinates.

Type:

bool

collar_x_field

Field name for X coordinate.

Type:

str | None

collar_y_field

Field name for Y coordinate.

Type:

str | None

collar_z_field

Field name for Z coordinate.

Type:

str | None

collar_depth_field

Field name for total hole depth.

Type:

str | None

survey_layer

Optional layer ID with drillhole surveys.

Type:

str | None

survey_id_field

Field name for drillhole IDs in survey layer.

Type:

str | None

survey_depth_field

Field name for downhole depth in survey.

Type:

str | None

survey_azim_field

Field name for azimuth in survey.

Type:

str | None

survey_incl_field

Field name for inclination in survey.

Type:

str | None

interval_layer

Optional layer ID with drillhole intervals.

Type:

str | None

interval_id_field

Field name for drillhole IDs in interval layer.

Type:

str | None

interval_from_field

Field name for ‘from’ depth.

Type:

str | None

interval_to_field

Field name for ‘to’ depth.

Type:

str | None

interval_lith_field

Field name for lithology code/name.

Type:

str | None

max_points

Max number of points for simplified preview (LOD).

Type:

int

canvas_width

Width of the preview canvas in pixels.

Type:

int

auto_lod

Whether to automatically adjust LOD based on canvas width.

Type:

bool

auto_lod: bool = True
band_num: int
buffer_dist: float = 100.0
canvas_width: int = 800
collar_depth_field: str | None = None
collar_id_field: str | None = None
collar_layer: str | None = None
collar_use_geometry: bool = True
collar_x_field: str | None = None
collar_y_field: str | None = None
collar_z_field: str | None = None
dip_field: str | None = None
dip_scale_factor: float = 1.0
interval_from_field: str | None = None
interval_id_field: str | None = None
interval_layer: str | None = None
interval_lith_field: str | None = None
interval_to_field: str | None = None
line_layer: str
max_points: int = 1000
outcrop_layer: str | None = None
outcrop_name_field: str | None = None
raster_layer: str
strike_field: str | None = None
struct_layer: str | None = None
survey_azim_field: str | None = None
survey_depth_field: str | None = None
survey_id_field: str | None = None
survey_incl_field: str | None = None
survey_layer: str | None = None
validate() None

Perform native validation of parameters.

Raises:

ValidationError – If critical parameters are missing or invalid.

class sec_interp.core.domain.PreviewResult(topo: list[tuple[float, float]] | None=None, geol: list[GeologySegment] | None = None, struct: list[StructureMeasurement] | None = None, drillhole: Any | None = None, metrics: MetricsCollector = <factory>, buffer_dist: float = 0.0)

Bases: object

Consolidated result set from profile generation.

topo

Sampled topographic profile data.

Type:

list[tuple[float, float]] | None

geol

List of geological unit segments.

Type:

list[sec_interp.core.domain.entities.GeologySegment] | None

struct

List of projected structural measurements.

Type:

list[sec_interp.core.domain.entities.StructureMeasurement] | None

drillhole

Processed drillhole projection data.

Type:

Any | None

metrics

Performance metrics collector for the generation cycle.

Type:

sec_interp.core.performance_metrics.MetricsCollector

buffer_dist

Buffer distance used for this result.

Type:

float

buffer_dist: float = 0.0
drillhole: Any | None = None
geol: list[GeologySegment] | None = None
get_distance_range() tuple[float, float]

Calculate the horizontal distance range based on topography.

Uses the first and last points of the sampled topography as the authoritative horizontal bounds of the section.

Returns:

A tuple containing (min_distance, max_distance).

get_elevation_range() tuple[float, float]

Calculate the global minimum and maximum elevation across all active layers.

Scans topography, geology, structural measurements, and drillhole data to find the absolute vertical bounds.

Returns:

A tuple containing (min_elevation, max_elevation).

metrics: MetricsCollector
struct: list[StructureMeasurement] | None = None
topo: list[tuple[float, float]] | None = None
class sec_interp.core.domain.SpatialMeta(hole_id: str | None = None, dist_along: float = 0.0, offset: float = 0.0, z: float = 0.0, x_3d: float | None = None, y_3d: float | None = None, x_proj: float | None = None, y_proj: float | None = None, norm_x: float | None = None, norm_y: float | None = None, attributes: dict[str, Any] | None = None)

Bases: object

Carrying spatial metadata for 3D/2D decoupling.

This DTO acts as a universal bridge between raw spatial data and various renderers (2D profiling or 3D engines), carrying coordinates, normalization vectors, and original attributes without layer dependencies.

hole_id

Unique identifier for the drillhole.

Type:

str | None

dist_along

Distance along the section line (station).

Type:

float

offset

Orthogonal distance from the section line.

Type:

float

z

Elevation or vertical coordinate.

Type:

float

x_3d

X coordinate in global 3D space.

Type:

float | None

y_3d

Y coordinate in global 3D space.

Type:

float | None

norm_x

Normalized X component of the orientation vector.

Type:

float | None

norm_y

Normalized Y component of the orientation vector.

Type:

float | None

attributes

Original feature attributes for contextual display.

Type:

dict[str, Any] | None

attributes: dict[str, Any] | None = None
dist_along: float = 0.0
hole_id: str | None = None
norm_x: float | None = None
norm_y: float | None = None
offset: float = 0.0
to_vec2_profile() tuple[float, float]

Convert spatial data to a 2D profile vector (Distance, Z).

to_vec3() tuple[float, float, float]

Convert spatial data to a 3D vector tuple (X, Y, Z).

x_3d: float | None = None
x_proj: float | None = None
y_3d: float | None = None
y_proj: float | None = None
z: float = 0.0
class sec_interp.core.domain.StructureMeasurement(distance: float, elevation: float, apparent_dip: float, original_dip: float, original_strike: float, attributes: dict[str, Any])

Bases: object

Represents a projected structural measurement on the section plane.

distance

Horizontal distance from the start of the profile.

Type:

float

elevation

Elevation (Z) at the projected point.

Type:

float

apparent_dip

Dip angle relative to the section plane.

Type:

float

original_dip

True dip measured in the field.

Type:

float

original_strike

True strike (azimuth) measured in the field.

Type:

float

attributes

Dictionary containing original feature attributes.

Type:

dict[str, Any]

apparent_dip: float
attributes: dict[str, Any]
distance: float
elevation: float
original_dip: float
original_strike: float

Submodules