# sec_interp.core.services.preview_service module

Service for managing preview generation and rendering.

This module provides a service to orchestrate the generation of all preview components, including topography, structures, and drillholes. It remains decoupled from the GUI layer.

class sec_interp.core.services.preview_service.PreviewService(controller: Any)

  Bases: `object`

  Orchestrates preview data generation.

  __init__(controller: Any) → None

    Initialize with plugin controller to access other services.

    Parameters:

      controller – The SecInterpController instance.

  static calculate_max_points(canvas_width: int, manual_max: int = 1000, auto_lod: bool = True, ratio: float = 1.0) → int

    Calculate the optimal number of points for rendering.

    Parameters:

      - canvas_width – Current width of the preview canvas in pixels.

      - manual_max – User-specified maximum points for plotting.

      - auto_lod – Whether to use automatic level of detail (LOD).

      - ratio – Current zoom ratio (full_extent / current_extent).

    Returns:

      The optimal number of points to use for 2D rendering.

  property drillhole_orchestrator: Any

    Expose drillhole orchestrator from controller.

  generate_all(params: PreviewParams, transform_context: Any, skip_drillholes: bool = False) → PreviewResult

    Generate all preview components in a consolidated result.

    Parameters:

      - params – Validated parameters for preview generation.

      - transform_context – QgsCoordinateTransformContext for CRS operations.

      - skip_drillholes – If True, skips synchronous drillhole generation.

    Returns:

      A consolidated object containing all generated preview data.

  property geology_service: Any

    Expose geology service from controller.

  property profile_service: Any

    Expose profile service from controller.

  property structure_service: Any

    Expose structure service from controller.