# sec_interp.gui.preview_renderer module

Preview Renderer Module (PyQGIS Native).

Handles rendering of interactive previews using native QGIS resources. This module has been refactored to delegate specialized tasks to modular components.

class sec_interp.gui.preview_renderer.PreviewRenderer(canvas: 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.

  __init__(canvas: QgsMapCanvas | None = None) → None

    Initialize preview renderer.

    Parameters:

      canvas – QgsMapCanvas instance (optional)

  property active_units: dict[str, Any]

    Expose active units from factory for legend compatibility.

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

    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, show_legend: bool = True) → bool

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

  render(topo_data: ProfileData, geol_data: GeologyData | None = None, struct_data: StructureData | 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, interp_data: list[InterpretationPolygon] | None = None, show_legend: bool = True, **kwargs) → tuple[QgsMapCanvas | None, list]

    Render preview with all data layers.