# 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: 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.

  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.

  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.