sec_interp.exporters package
- class sec_interp.exporters.AxesShpExporter(settings: dict[str, Any])
Bases:
BaseExporterExports the profile axes to a Shapefile.
- 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 supported file extensions.
- Returns:
List of supported extensions.
- class sec_interp.exporters.BaseExporter(settings: dict[str, Any])
Bases:
ABCAbstract 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]) None
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:
BaseExporterExporter for CSV tabular format.
- 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.DrillholeInterval3DExporter(settings: dict[str, Any])
Bases:
BaseExporterExports 3D drillhole intervals to a Shapefile.
- export(output_path: Any, data: dict[str, Any]) bool
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]
Get supported extensions.
- class sec_interp.exporters.DrillholeIntervalShpExporter(settings: dict[str, Any])
Bases:
BaseExporterExports drillhole intervals to a Shapefile.
- 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’.
- Returns:
True if export successful, False otherwise.
- Return type:
bool
- get_supported_extensions() list[str]
Get supported file extensions.
- Returns:
List of supported extensions.
- class sec_interp.exporters.DrillholeTrace3DExporter(settings: dict[str, Any])
Bases:
BaseExporterExports 3D drillhole traces to a Shapefile.
- export(output_path: Any, data: dict[str, Any]) bool
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]
Get supported extensions.
- class sec_interp.exporters.DrillholeTraceShpExporter(settings: dict[str, Any])
Bases:
BaseExporterExports drillhole traces to a Shapefile.
- 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’.
- Returns:
True if export successful, False otherwise.
- Return type:
bool
- get_supported_extensions() list[str]
Get supported file extensions.
- Returns:
List of supported extensions.
- class sec_interp.exporters.GeologyShpExporter(settings: dict[str, Any])
Bases:
BaseExporterExports the geological profile to a Shapefile.
- 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 supported file extensions.
- Returns:
List of supported extensions.
- class sec_interp.exporters.ImageExporter(settings: dict[str, Any])
Bases:
BaseExporterExporter for raster image formats (PNG, JPG, JPEG).
- 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:
BaseExporterExports interpretations in 2D profile coordinates.
- __init__(settings: dict[str, Any]) None
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 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:
BaseExporterExporter for 3D Interpretation polygons (Shapefile 2.5D).
- export(output_path: str, data: dict[str, Any]) bool
Export interpretation data to a 3D Shapefile.
- get_supported_extensions() list[str]
Get supported extensions.
- class sec_interp.exporters.PDFExporter(settings: dict[str, Any])
Bases:
BaseExporterExporter for PDF format.
- 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:
BaseExporterExports the topographic profile line to a Shapefile.
- 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 supported file extensions.
- Returns:
List of supported extensions.
- class sec_interp.exporters.SVGExporter(settings: dict[str, Any])
Bases:
BaseExporterExporter for SVG vector format.
- 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:
BaseExporterExporter for Shapefile and GeoPackage formats.
- 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:
BaseExporterExports the structural profile to a Shapefile.
- 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 supported file extensions.
- Returns:
List of supported extensions.
- sec_interp.exporters.get_exporter(extension: str, settings: dict) BaseExporter
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
- sec_interp.exporters.base_exporter module
- sec_interp.exporters.csv_exporter module
- sec_interp.exporters.drillhole_3d_exporter module
- sec_interp.exporters.drillhole_exporters module
- sec_interp.exporters.image_exporter module
- sec_interp.exporters.interpretation_3d_exporter module
- sec_interp.exporters.interpretation_exporters module
- sec_interp.exporters.pdf_exporter module
- sec_interp.exporters.profile_exporters module
- sec_interp.exporters.shp_exporter module
- sec_interp.exporters.svg_exporter module