sec_interp.exporters package

class sec_interp.exporters.AxesShpExporter(settings: dict[str, Any])[source]

Bases: BaseExporter

Exports the profile axes to a Shapefile.

export(output_path: Path, data: dict[str, Any]) bool[source]

Export the profile axes to a Shapefile.

Parameters:
  • output_path – Path to the output Shapefile.

  • data – Dictionary containing ‘profile_data’ and ‘crs’.

get_supported_extensions() list[str][source]

Get supported file extensions.

Returns:

List of supported extensions.

class sec_interp.exporters.BaseExporter(settings: dict[str, Any])[source]

Bases: ABC

Abstract base class for all exporters.

This class defines the interface that all concrete exporters must implement. It follows the Template Method pattern, providing common initialization and validation logic while delegating format-specific export to subclasses.

__init__(settings: dict[str, Any])[source]

Initialize the exporter with settings.

Parameters:

settings – Dictionary containing export settings such as: - width: Output width in pixels - height: Output height in pixels - dpi: Dots per inch for resolution - background_color: Background color (QColor) - legend_renderer: Optional renderer for legend overlay

abstractmethod export(output_path: Path, data: Any) bool[source]

Export data to file.

This method must be implemented by all concrete exporters.

Parameters:
  • output_path – Destination file path

  • data – Data to export (format depends on exporter type)

Returns:

True if export successful, False otherwise

Return type:

bool

get_setting(key: str, default: Any = None) Any[source]

Get a setting value with optional default.

Parameters:
  • key – Setting key

  • default – Default value if key not found

Returns:

Setting value or default

abstractmethod get_supported_extensions() list[str][source]

Get list of supported file extensions.

Returns:

List of supported extensions (e.g., [‘.png’, ‘.jpg’])

validate_export_path(output_path: Path, base_dir: Path | None = None) tuple[bool, str][source]

Validate export path for security.

Uses secure path validation to prevent path traversal attacks.

Parameters:
  • output_path – Path to validate

  • base_dir – Optional base directory to restrict exports to

Returns:

(is_valid, error_message)

Return type:

tuple

validate_path(path: Path) bool[source]

Validate that the output path has a supported extension.

Parameters:

path – Path to validate

Returns:

True if path has a supported extension, False otherwise

class sec_interp.exporters.CSVExporter(settings: dict[str, Any])[source]

Bases: BaseExporter

Exporter for CSV tabular format.

export(output_path: Path, data: dict[str, Any]) bool[source]

Export tabular data to CSV.

Parameters:
  • output_path – Output file path.

  • data – A dictionary containing ‘headers’ (list of strings) and ‘rows’ (list of tuples or lists).

Returns:

True if export successful, False otherwise

get_supported_extensions() list[str][source]

Get supported CSV extension.

class sec_interp.exporters.DrillholeInterval3DExporter(settings: dict[str, Any])[source]

Bases: BaseExporter

Exports 3D drillhole intervals to a Shapefile.

export(output_path: Any, data: dict[str, Any]) bool[source]

Export 3D drillhole intervals to a Shapefile.

Parameters:
  • output_path – Path to the output Shapefile.

  • data – Dictionary containing ‘drillhole_data’ and ‘crs’. Can include ‘use_projected’ (bool).

Returns:

True if export successful, False otherwise.

Return type:

bool

get_supported_extensions() list[str][source]

Get supported extensions.

class sec_interp.exporters.DrillholeIntervalShpExporter(settings: dict[str, Any])[source]

Bases: BaseExporter

Exports drillhole intervals to a Shapefile.

export(output_path: Any, data: dict[str, Any]) bool[source]

Export drillhole intervals to a Shapefile.

Parameters:
  • output_path – Path to the output Shapefile.

  • data – Dictionary containing ‘drillhole_data’ and ‘crs’.

Returns:

True if export successful, False otherwise.

Return type:

bool

get_supported_extensions() list[str][source]

Get supported file extensions.

Returns:

List of supported extensions.

class sec_interp.exporters.DrillholeTrace3DExporter(settings: dict[str, Any])[source]

Bases: BaseExporter

Exports 3D drillhole traces to a Shapefile.

export(output_path: Any, data: dict[str, Any]) bool[source]

Export 3D drillhole traces to a Shapefile.

Parameters:
  • output_path – Path to the output Shapefile.

  • data – Dictionary containing ‘drillhole_data’ and ‘crs’. Can include ‘use_projected’ (bool).

Returns:

True if export successful, False otherwise.

Return type:

bool

get_supported_extensions() list[str][source]

Get supported extensions.

class sec_interp.exporters.DrillholeTraceShpExporter(settings: dict[str, Any])[source]

Bases: BaseExporter

Exports drillhole traces to a Shapefile.

export(output_path: Any, data: dict[str, Any]) bool[source]

Export drillhole traces to a Shapefile.

Parameters:
  • output_path – Path to the output Shapefile.

  • data – Dictionary containing ‘drillhole_data’ and ‘crs’.

Returns:

True if export successful, False otherwise.

Return type:

bool

get_supported_extensions() list[str][source]

Get supported file extensions.

Returns:

List of supported extensions.

class sec_interp.exporters.GeologyShpExporter(settings: dict[str, Any])[source]

Bases: BaseExporter

Exports the geological profile to a Shapefile.

export(output_path: Path, data: dict[str, Any]) bool[source]

Export the geological profile to a Shapefile.

Parameters:
  • output_path – Path to the output Shapefile.

  • data – Dictionary containing ‘geology_data’ and ‘crs’.

get_supported_extensions() list[str][source]

Get supported file extensions.

Returns:

List of supported extensions.

class sec_interp.exporters.ImageExporter(settings: dict[str, Any])[source]

Bases: BaseExporter

Exporter for raster image formats (PNG, JPG, JPEG).

export(output_path: Path, map_settings: qgis.core.QgsMapSettings) bool[source]

Export map to raster image.

Parameters:
  • output_path – Output file path

  • map_settings – QgsMapSettings instance configured for rendering

Returns:

True if export successful, False otherwise

get_supported_extensions() list[str][source]

Get supported image extensions.

class sec_interp.exporters.Interpretation2DExporter(settings: dict[str, Any])[source]

Bases: BaseExporter

Exports interpretations in 2D profile coordinates.

__init__(settings: dict[str, Any])[source]

Initialize with settings.

Parameters:

settings – Dictionary of configuration settings.

export(output_path: Path, data: dict[str, Any]) bool[source]

Export interpretations to Shapefile.

Parameters:
  • output_path – Path to the output Shapefile (.shp)

  • data – Dictionary containing: - interpretations: List of InterpretationPolygon objects

Returns:

True if export successful, False otherwise

Return type:

bool

get_supported_extensions() list[str][source]

Get list of supported file extensions.

Returns:

List of supported extensions.

class sec_interp.exporters.Interpretation3DExporter(settings: dict[str, Any])[source]

Bases: BaseExporter

Exporter for 3D Interpretation polygons (Shapefile 2.5D).

export(output_path: str, data: dict[str, Any]) bool[source]

Export interpretation data to a 3D Shapefile.

get_supported_extensions() list[str][source]

Get supported extensions.

class sec_interp.exporters.PDFExporter(settings: dict[str, Any])[source]

Bases: BaseExporter

Exporter for PDF format.

export(output_path: Path, map_settings: qgis.core.QgsMapSettings) bool[source]

Export map to PDF.

Parameters:
  • output_path – Output file path

  • map_settings – QgsMapSettings instance configured for rendering

Returns:

True if export successful, False otherwise

get_supported_extensions() list[str][source]

Get supported PDF extension.

class sec_interp.exporters.ProfileLineShpExporter(settings: dict[str, Any])[source]

Bases: BaseExporter

Exports the topographic profile line to a Shapefile.

export(output_path: Path, data: dict[str, Any]) bool[source]

Export the topographic profile line to a Shapefile.

Parameters:
  • output_path – Path to the output Shapefile.

  • data – Dictionary containing ‘profile_data’ and ‘crs’.

get_supported_extensions() list[str][source]

Get supported file extensions.

Returns:

List of supported extensions.

class sec_interp.exporters.SVGExporter(settings: dict[str, Any])[source]

Bases: BaseExporter

Exporter for SVG vector format.

export(output_path: Path, map_settings) bool[source]

Export map to SVG.

Parameters:
  • output_path – Output file path

  • map_settings – QgsMapSettings instance configured for rendering

Returns:

True if export successful, False otherwise

get_supported_extensions() list[str][source]

Get supported SVG extension.

class sec_interp.exporters.ShapefileExporter(settings: dict[str, Any])[source]

Bases: BaseExporter

Exporter for Shapefile and GeoPackage formats.

export(output_path: Path, features_data: list[dict[str, Any]]) bool[source]

Export features to shapefile or geopackage.

Parameters:
  • output_path – Output file path

  • features_data – List of dicts with ‘geometry’ and ‘attributes’ keys

Returns:

True if export successful, False otherwise

get_supported_extensions() list[str][source]

Get supported vector format extensions.

class sec_interp.exporters.StructureShpExporter(settings: dict[str, Any])[source]

Bases: BaseExporter

Exports the structural profile to a Shapefile.

export(output_path: Path, data: dict[str, Any]) bool[source]

Export the structural profile to a Shapefile.

Parameters:
  • output_path – Path to the output Shapefile.

  • data – Dictionary containing ‘structural_data’, ‘crs’, ‘dip_scale_factor’, and ‘raster_res’.

get_supported_extensions() list[str][source]

Get supported file extensions.

Returns:

List of supported extensions.

sec_interp.exporters.get_exporter(extension: str, settings: dict)[source]

Get the appropriate exporter instance for the file extension.

Parameters:
  • extension – File extension (e.g., ‘.png’, ‘.svg’)

  • settings – Export settings dictionary

Returns:

Appropriate exporter instance

Raises:

ValueError – If extension is not supported

Submodules