# sec_interp.core.utils.qgis module

QGIS-specific utilities for SecInterp.

This module centralizes interaction with the QGIS API to ensure consistent behavior and reduce code duplication across the plugin.

class sec_interp.core.utils.qgis.LayerResolver

  Bases: `object`

  Centralized service to resolve and cache QgsMapLayer references.

  Acts as a singleton/cache to avoid repeated project.mapLayer() calls within the same processing transaction.

  classmethod clear_cache() → None

    Clear the internal layer cache.

  classmethod invalidate(layer_id: str) → None

    Remove a specific layer from the cache.

  classmethod resolve(layer_ref: Any, use_cache: bool = True) → QgsMapLayer | None

    Resolve a layer reference (ID, name, or object) to a QgsMapLayer.

    Parameters:

      - layer_ref – A string (layer ID or name) or a QgsMapLayer object.

      - use_cache – If True, uses the internal dict cache for faster lookups.

    Returns:

      The resolved QgsMapLayer object if valid, else None.

sec_interp.core.utils.qgis.resolve_layer(layer_ref: Any) → QgsMapLayer | None

  Resolve a layer reference. (Legacy wrapper).

  Delegates to LayerResolver for backward compatibility.