# sec_interp.gui package

## Subpackages

- sec_interp.gui.tools package
  - Submodules
    - sec_interp.gui.tools.measure_tool module
      - `ProfileSnapper`
      - `ProfileMeasureTool`
  - Module contents
- sec_interp.gui.ui package
  - Subpackages
    - sec_interp.gui.ui.pages package
      - Submodules
      - Module contents
  - Submodules
    - sec_interp.gui.ui.main_window module
      - `SecInterpMainWindow`
    - sec_interp.gui.ui.sidebar module
      - `Sidebar`
  - Module contents

## Submodules

- sec_interp.gui.legend_widget module
  - `LegendWidget`
    - `LegendWidget.eventFilter()`
    - `LegendWidget.update_legend()`
    - `LegendWidget.paintEvent()`
- sec_interp.gui.main_dialog module
  - `SecInterpDialog`
    - `SecInterpDialog.iface`
    - `SecInterpDialog.plugin_instance`
    - `SecInterpDialog.messagebar`
    - `SecInterpDialog.__init__()`
    - `SecInterpDialog.wheelEvent()`
    - `SecInterpDialog.open_help()`
    - `SecInterpDialog.toggle_measure_tool()`
    - `SecInterpDialog.update_measurement_display()`
    - `SecInterpDialog.update_preview_checkbox_states()`
    - `SecInterpDialog.update_button_state()`
    - `SecInterpDialog.get_selected_values()`
    - `SecInterpDialog.get_preview_options()`
    - `SecInterpDialog.update_preview_from_checkboxes()`
    - `SecInterpDialog.preview_profile_handler()`
    - `SecInterpDialog.export_preview()`
    - `SecInterpDialog.accept_handler()`
    - `SecInterpDialog.reject_handler()`
    - `SecInterpDialog.validate_inputs()`
    - `SecInterpDialog.clear_cache_handler()`
    - `SecInterpDialog.get_layer_names_by_type()`
    - `SecInterpDialog.get_layer_names_by_geometry()`
    - `SecInterpDialog.getThemeIcon()`
- sec_interp.gui.main_dialog_cache_handler module
  - `CacheHandler`
    - `CacheHandler.__init__()`
- sec_interp.gui.main_dialog_config module
  - `DialogDefaults`
    - `DialogDefaults.SCALE`
    - `DialogDefaults.VERTICAL_EXAGGERATION`
    - `DialogDefaults.DIP_SCALE`
    - `DialogDefaults.DIP_SCALE_FACTOR`
    - `DialogDefaults.BUFFER_DISTANCE`
    - `DialogDefaults.SAMPLING_INTERVAL`
    - `DialogDefaults.DPI`
    - `DialogDefaults.PREVIEW_WIDTH`
    - `DialogDefaults.PREVIEW_HEIGHT`
    - `DialogDefaults.EXPORT_QUALITY`
    - `DialogDefaults.BACKGROUND_COLOR`
    - `DialogDefaults.GRID_COLOR`
    - `DialogDefaults.DEFAULT_BAND`
    - `DialogDefaults.SUPPORTED_IMAGE_FORMATS`
    - `DialogDefaults.SUPPORTED_VECTOR_FORMATS`
    - `DialogDefaults.SUPPORTED_DOCUMENT_FORMATS`
  - `DialogConfig`
    - `DialogConfig.ENABLE_CACHE`
    - `DialogConfig.CACHE_EXPIRY_SECONDS`
    - `DialogConfig.ENABLE_PERFORMANCE_METRICS`
    - `DialogConfig.SHOW_METRICS_IN_RESULTS`
    - `DialogConfig.LOG_DETAILED_METRICS`
    - `DialogConfig.AUTO_SAVE_SETTINGS`
    - `DialogConfig.SHOW_HELP_ON_START`
    - `DialogConfig.ENABLE_TOOLTIPS`
    - `DialogConfig.STRICT_VALIDATION`
    - `DialogConfig.ALLOW_EMPTY_GEOLOGY`
    - `DialogConfig.ALLOW_EMPTY_STRUCTURES`
    - `DialogConfig.AUTO_REFRESH_PREVIEW`
    - `DialogConfig.SHOW_LEGEND`
    - `DialogConfig.ENABLE_ZOOM`
    - `DialogConfig.MAX_PREVIEW_POINTS`
    - `DialogConfig.ENABLE_LOD`
    - `DialogConfig.VERBOSE_LOGGING`
    - `DialogConfig.LOG_PERFORMANCE`
  - `ValidationMessages`
    - `ValidationMessages.MISSING_RASTER`
    - `ValidationMessages.MISSING_SECTION_LINE`
    - `ValidationMessages.MISSING_OUTPUT_PATH`
    - `ValidationMessages.INVALID_RASTER`
    - `ValidationMessages.INVALID_SECTION_LINE`
    - `ValidationMessages.INVALID_OUTPUT_PATH`
    - `ValidationMessages.WRONG_GEOMETRY_TYPE`
    - `ValidationMessages.EMPTY_LAYER`
    - `ValidationMessages.INVALID_GEOMETRY`
    - `ValidationMessages.MISSING_FIELD`
    - `ValidationMessages.INVALID_FIELD_TYPE`
    - `ValidationMessages.MISSING_OUTCROP_LAYER`
    - `ValidationMessages.MISSING_OUTCROP_FIELD`
    - `ValidationMessages.MISSING_STRUCTURAL_LAYER`
    - `ValidationMessages.MISSING_DIP_FIELD`
    - `ValidationMessages.MISSING_STRIKE_FIELD`
    - `ValidationMessages.VALIDATION_FAILED`
    - `ValidationMessages.UNKNOWN_ERROR`
  - `UIConstants`
    - `UIConstants.MIN_PREVIEW_WIDTH`
    - `UIConstants.MIN_PREVIEW_HEIGHT`
    - `UIConstants.MAX_PREVIEW_WIDTH`
    - `UIConstants.MAX_PREVIEW_HEIGHT`
    - `UIConstants.ICON_HELP`
    - `UIConstants.ICON_REFRESH`
    - `UIConstants.ICON_EXPORT`
    - `UIConstants.ICON_CLEAR`
    - `UIConstants.STATUS_OK`
    - `UIConstants.STATUS_ERROR`
    - `UIConstants.STATUS_WARNING`
    - `UIConstants.REQUIRED_INDICATOR`
    - `UIConstants.REQUIRED_COLOR`
- sec_interp.gui.main_dialog_data module
  - `DialogDataAggregator`
    - `DialogDataAggregator.__init__()`
    - `DialogDataAggregator.get_all_values()`
- sec_interp.gui.main_dialog_export module
  - `ExportManager`
    - `ExportManager.__init__()`
    - `ExportManager.export_preview()`
    - `ExportManager.export_data()`
- sec_interp.gui.main_dialog_preview module
  - `PreviewManager`
    - `PreviewManager.__init__()`
    - `PreviewManager.generate_preview()`
    - `PreviewManager.update_from_checkboxes()`
- sec_interp.gui.main_dialog_settings module
  - `DialogSettingsManager`
    - `DialogSettingsManager.__init__()`
    - `DialogSettingsManager.load_settings()`
    - `DialogSettingsManager.save_settings()`
- sec_interp.gui.main_dialog_signals module
  - `DialogSignalManager`
    - `DialogSignalManager.__init__()`
    - `DialogSignalManager.connect_all()`
- sec_interp.gui.main_dialog_status module
  - `DialogStatusManager`
    - `DialogStatusManager.__init__()`
    - `DialogStatusManager.update_all()`
    - `DialogStatusManager.update_preview_checkbox_states()`
    - `DialogStatusManager.update_button_state()`
    - `DialogStatusManager.setup_indicators()`
    - `DialogStatusManager.update_raster_status()`
    - `DialogStatusManager.update_section_status()`
- sec_interp.gui.main_dialog_utils module
  - `DialogEntityManager`
    - `DialogEntityManager.populate_field_combobox()`
    - `DialogEntityManager.get_layer_names_by_type()`
    - `DialogEntityManager.get_layer_names_by_geometry()`
    - `DialogEntityManager.get_theme_icon()`
- sec_interp.gui.main_dialog_validation module
  - `DialogValidator`
    - `DialogValidator.__init__()`
    - `DialogValidator.validate_inputs()`
    - `DialogValidator.validate_preview_requirements()`
- sec_interp.gui.parallel_geology module
  - `GeologyProcessingThread`
    - `GeologyProcessingThread.progress_updated`
    - `GeologyProcessingThread.processing_finished`
    - `GeologyProcessingThread.error_occurred`
    - `GeologyProcessingThread.__init__()`
    - `GeologyProcessingThread.run()`
  - `ParallelGeologyService`
    - `ParallelGeologyService.all_finished`
    - `ParallelGeologyService.batch_progress`
    - `ParallelGeologyService.error_occurred`
    - `ParallelGeologyService.process_profiles_parallel()`
- sec_interp.gui.preview_axes_manager module
  - `PreviewAxesManager`
    - `PreviewAxesManager.get_nice_interval()`
    - `PreviewAxesManager.create_axes_layer()`
    - `PreviewAxesManager.create_axes_labels_layer()`
- sec_interp.gui.preview_layer_factory module
  - `PreviewLayerFactory`
    - `PreviewLayerFactory.GEOLOGY_COLORS`
    - `PreviewLayerFactory.__init__()`
    - `PreviewLayerFactory.get_color_for_unit()`
    - `PreviewLayerFactory.create_memory_layer()`
    - `PreviewLayerFactory.create_topo_layer()`
    - `PreviewLayerFactory.create_geol_layer()`
    - `PreviewLayerFactory.create_struct_layer()`
    - `PreviewLayerFactory.create_drillhole_trace_layer()`
    - `PreviewLayerFactory.create_drillhole_interval_layer()`
    - `PreviewLayerFactory.interpolate_elevation()`
- sec_interp.gui.preview_legend_renderer module
  - `PreviewLegendRenderer`
    - `PreviewLegendRenderer.draw_legend()`
- sec_interp.gui.preview_optimizer module
  - `PreviewOptimizer`
    - `PreviewOptimizer.decimate()`
    - `PreviewOptimizer.calculate_curvature()`
    - `PreviewOptimizer.adaptive_sample()`
- sec_interp.gui.preview_renderer module
  - `PreviewRenderer`
    - `PreviewRenderer.__init__()`
    - `PreviewRenderer.active_units`
    - `PreviewRenderer.render()`
    - `PreviewRenderer.draw_legend()`
    - `PreviewRenderer.export_to_image()`
- sec_interp.gui.utils module
  - `show_user_message()`

## Module contents

GUI module for SecInterp plugin.

Contains dialogs, widgets, and rendering components.

class sec_interp.gui.PreviewRenderer(canvas: qgis.gui.QgsMapCanvas | None = None)

  Bases: `object`

  Renders interactive preview using native PyQGIS resources.

  Acts as an orchestrator for several specialized modules: - PreviewLayerFactory: Handles layer creation and symbology. - PreviewAxesManager: Handles grid lines and axes labels. - PreviewOptimizer: Handles geometric simplification (LOD). - PreviewLegendRenderer: Handles legend drawing.

  Initialize preview renderer.

  Parameters:

    canvas – QgsMapCanvas instance (optional)

  __init__(canvas: qgis.gui.QgsMapCanvas | None = None)

    Initialize preview renderer.

    Parameters:

      canvas – QgsMapCanvas instance (optional)

  property active_units

    Expose active units from factory for legend compatibility.

  draw_legend(painter: qgis.PyQt.QtGui.QPainter, rect: qgis.PyQt.QtCore.QRectF)

    Draw legend on the given painter. Delegates to PreviewLegendRenderer.

  export_to_image(layers: List, extent, width: int, height: int, output_path: str, dpi: int = 300) → bool

    Export preview to image file. Maintains same logic but orchestrated.

  render(topo_data: list[tuple[float, float]], geol_data: list[GeologySegment] | None = None, struct_data: list[StructureMeasurement] | None = None, vert_exag: float = 1.0, dip_line_length: float | None = None, max_points: int = 1000, preserve_extent: bool = False, use_adaptive_sampling: bool = False, drillhole_data: List | None = None, **kwargs) → Tuple[qgis.gui.QgsMapCanvas | None, List]

    Render preview with all data layers.

class sec_interp.gui.SecInterpDialog(*args: Any, **kwargs: Any)

  Bases: `SecInterpMainWindow`

  Dialog for the SecInterp QGIS plugin.

  This dialog provides the user interface and helper methods to populate combo boxes with layers from the current QGIS project (raster and vector layers filtered by geometry type). It also exposes the interface and plugin instance for interaction with the host application.

  iface

    The QGIS interface instance.

    Type:

      QgsInterface

  plugin_instance

    The plugin instance that created this dialog.

    Type:

      SecInterp

  messagebar

    The message bar widget for notifications.

    Type:

      QgsMessageBar

  Constructor.

  __init__(iface=None, plugin_instance=None, parent=None)

    Constructor.

  accept_handler()

    Handle the accept button click event.

  clear_cache_handler()

    Clear cached data and notify user.

  export_preview()

    Export the current preview to a file using ExportManager.

  getThemeIcon(name)

    Get a theme icon via DialogEntityManager.

  get_layer_names_by_geometry(geometry_type) → list[str]

    Get layer names by geometry.

  get_layer_names_by_type(layer_type) → list[str]

    Get layer names by type.

  get_preview_options()

    Return the state of preview layer checkboxes.

    Returns:

      Keys ‘show_topo’, ‘show_geol’, ‘show_struct’ with boolean values.

    Return type:

      dict

  get_selected_values()

    Get the selected values from the dialog.

    Returns:

      Dictionary with all dialog values in legacy flat format

  open_help()

    Open the help file in the default browser.

  preview_profile_handler()

    Generate a quick preview with topographic, geological, and structural data.

    This method delegates to PreviewManager for preview generation.

  reject_handler()

    Handle the reject button click event.

  toggle_measure_tool(checked)

    Toggle measurement tool.

  update_button_state()

    Enable or disable buttons via status_manager.

  update_measurement_display(dx, dy, dist, slope)

    Display measurement results.

  update_preview_checkbox_states()

    Enable or disable preview checkboxes via status_manager.

  update_preview_from_checkboxes()

    Update preview when checkboxes change.

    This method delegates to PreviewManager for preview updates.

  validate_inputs()

    Validate the inputs from the dialog.

    This method delegates to DialogValidator for input validation.

  wheelEvent(event)

    Handle mouse wheel for zooming in preview.