# sec_interp.gui.preview_legend_renderer module

Legend rendering logic for SecInterp preview.

Handles the drawing of the legend on a QPainter, including topography, structures, and geological units.

class sec_interp.gui.preview_legend_renderer.PreviewLegendRenderer

  Bases: `object`

  Handles drawing the map legend for the profile preview.

  static draw_legend(painter: qgis.PyQt.QtGui.QPainter, rect: qgis.PyQt.QtCore.QRectF, active_units: Dict[str, qgis.PyQt.QtGui.QColor], has_topography: bool = False, has_structures: bool = False)

    Draw legend on the given painter within the rect.

    Parameters:

      - painter – QPainter instance

      - rect – QRectF defining the drawing area

      - active_units – Dictionary of unit names and their colors

      - has_topography – Whether topography is present in the preview

      - has_structures – Whether structures are present in the preview