# sec_interp.exporters package

## Submodules

- sec_interp.exporters.base_exporter module
  - `BaseExporter`
    - `BaseExporter.__init__()`
    - `BaseExporter.export()`
    - `BaseExporter.validate_export_path()`
    - `BaseExporter.get_supported_extensions()`
    - `BaseExporter.validate_path()`
    - `BaseExporter.get_setting()`
- sec_interp.exporters.csv_exporter module
  - `CSVExporter`
    - `CSVExporter.get_supported_extensions()`
    - `CSVExporter.export()`
- sec_interp.exporters.drillhole_exporters module
  - `DrillholeTraceShpExporter`
    - `DrillholeTraceShpExporter.get_supported_extensions()`
    - `DrillholeTraceShpExporter.export()`
  - `DrillholeIntervalShpExporter`
    - `DrillholeIntervalShpExporter.get_supported_extensions()`
    - `DrillholeIntervalShpExporter.export()`
- sec_interp.exporters.image_exporter module
  - `ImageExporter`
    - `ImageExporter.get_supported_extensions()`
    - `ImageExporter.export()`
- sec_interp.exporters.interpretation_exporters module
  - `Interpretation2DExporter`
    - `Interpretation2DExporter.__init__()`
    - `Interpretation2DExporter.export()`
    - `Interpretation2DExporter.get_supported_extensions()`
- sec_interp.exporters.pdf_exporter module
  - `PDFExporter`
    - `PDFExporter.get_supported_extensions()`
    - `PDFExporter.export()`
- sec_interp.exporters.profile_exporters module
  - `ProfileLineShpExporter`
    - `ProfileLineShpExporter.get_supported_extensions()`
    - `ProfileLineShpExporter.export()`
  - `GeologyShpExporter`
    - `GeologyShpExporter.get_supported_extensions()`
    - `GeologyShpExporter.export()`
  - `StructureShpExporter`
    - `StructureShpExporter.get_supported_extensions()`
    - `StructureShpExporter.export()`
  - `AxesShpExporter`
    - `AxesShpExporter.get_supported_extensions()`
    - `AxesShpExporter.export()`
- sec_interp.exporters.shp_exporter module
  - `ShapefileExporter`
    - `ShapefileExporter.get_supported_extensions()`
    - `ShapefileExporter.export()`
- sec_interp.exporters.svg_exporter module
  - `SVGExporter`
    - `SVGExporter.get_supported_extensions()`
    - `SVGExporter.export()`

## Module contents

Exporters package for Sec Interp plugin.

Provides specialized exporters for different file formats.

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

  Bases: `BaseExporter`

  Exports the profile axes to a Shapefile.

  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

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

    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]

    Get list of supported file extensions.

    Returns:

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

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

  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.

  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

  __init__(settings: dict[str, Any])

    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

    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

    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]

    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]

    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

    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])

  Bases: `BaseExporter`

  Exporter for CSV tabular format.

  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

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

    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]

    Get supported CSV extension.

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

  Bases: `BaseExporter`

  Exports drillhole intervals to a Shapefile.

  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

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

    Export drillhole intervals to a Shapefile.

    Parameters:

      - output_path – Path to the output Shapefile.

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

  get_supported_extensions() → list[str]

    Get list of supported file extensions.

    Returns:

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

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

  Bases: `BaseExporter`

  Exports drillhole traces to a Shapefile.

  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

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

    Export drillhole traces to a Shapefile.

    Parameters:

      - output_path – Path to the output Shapefile.

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

  get_supported_extensions() → list[str]

    Get list of supported file extensions.

    Returns:

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

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

  Bases: `BaseExporter`

  Exports the geological profile to a Shapefile.

  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

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

    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]

    Get list of supported file extensions.

    Returns:

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

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

  Bases: `BaseExporter`

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

  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

  export(output_path: Path, map_settings: qgis.core.QgsMapSettings) → bool

    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]

    Get supported image extensions.

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

  Bases: `BaseExporter`

  Exports interpretations in 2D profile coordinates.

  Initialize with settings.

  Parameters:

    settings – Dictionary of configuration settings.

  __init__(settings: dict[str, Any])

    Initialize with settings.

    Parameters:

      settings – Dictionary of configuration settings.

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

    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 was successful, False otherwise

    Return type:

      bool

  get_supported_extensions() → list[str]

    Get list of supported file extensions.

    Returns:

      List of supported extensions.

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

  Bases: `BaseExporter`

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

  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

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

    Export interpretation data to a 3D Shapefile.

    Parameters:

      - output_path – Destination path for the shapefile.

      - data – Dictionary containing: - ‘interpretations’: List of InterpretationPolygon objects. - ‘section_line’: QgsGeometry of the section line (LineString). - ‘crs’: QgsCoordinateReferenceSystem for the output.

    Returns:

      True if export successful.

    Raises:

      ExportError – If data is invalid or export fails.

  get_supported_extensions() → list[str]

    Get supported extensions.

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

  Bases: `BaseExporter`

  Exporter for PDF format.

  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

  export(output_path: Path, map_settings: qgis.core.QgsMapSettings) → bool

    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]

    Get supported PDF extension.

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

  Bases: `BaseExporter`

  Exports the topographic profile line to a Shapefile.

  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

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

    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]

    Get list of supported file extensions.

    Returns:

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

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

  Bases: `BaseExporter`

  Exporter for SVG vector format.

  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

  export(output_path: Path, map_settings) → bool

    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]

    Get supported SVG extension.

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

  Bases: `BaseExporter`

  Exporter for Shapefile and GeoPackage formats.

  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

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

    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]

    Get supported vector format extensions.

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

  Bases: `BaseExporter`

  Exports the structural profile to a Shapefile.

  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

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

    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]

    Get list of supported file extensions.

    Returns:

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

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

  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