# sec_interp.gui.preview_layer_factory module

Layer factory for SecInterp preview.

Handles creation of temporary memory layers and configuration of native QGIS symbology.

class sec_interp.gui.preview_layer_factory.PreviewLayerFactory

  Bases: `object`

  Factory for creating and styling QGIS memory layers for the preview.

  Initialize the layer factory.

  GEOLOGY_COLORS: ClassVar[list[qgis.PyQt.QtGui.QColor]] = [qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor]
  __init__()

    Initialize the layer factory.

  get_color_for_unit(name: str) → qgis.PyQt.QtGui.QColor

    Get a consistent color for a geological unit based on its name.

  create_memory_layer(geometry_type: str, name: str, fields: str | None = None) → tuple[QgsVectorLayer | None, Any]

    Create a memory layer with an unknown CRS.

    Parameters:

      - geometry_type – “Point”, “LineString”, “Polygon”

      - name – Layer display name

      - fields – Optional field definition string (e.g., “field=id:integer”)

    Returns:

      Tuple of (QgsVectorLayer, QgsDataProvider) or (None, None) if failed

  create_topo_layer(topo_data: list[tuple[float, float]], vert_exag: float = 1.0, max_points: int = 1000, use_adaptive_sampling: bool = False) → QgsVectorLayer | None

    Create temporary layer for topographic profile.

  create_geol_layer(geol_data: list[GeologySegment], vert_exag: float = 1.0, max_points: int = 1000) → QgsVectorLayer | None

    Create temporary layer for geological profile.

  create_struct_layer(struct_data: list[StructureMeasurement], reference_data: list[tuple[float, float]], vert_exag: float = 1.0, dip_line_length: float | None = None) → QgsVectorLayer | None

    Create temporary layer for structural dips.

  create_drillhole_trace_layer(drillhole_data: list, vert_exag: float = 1.0) → QgsVectorLayer | None

    Create temporary layer for drillhole traces.

  create_drillhole_interval_layer(drillhole_data: list, vert_exag: float = 1.0) → QgsVectorLayer | None

    Create temporary layer for drillhole intervals.

  interpolate_elevation(reference_data: list[tuple[float, float]], target_dist: float) → float

    Interpolate elevation at a given distance.