safe.gis.qgis_legend_interface module

Mock like implementation for the QgsLegendInterface - used for testing.

class safe.gis.qgis_legend_interface.QgisLegend(canvas)[source]

A fake QgsLegendInterface with minimal implementation.

isLayerVisible(layer)[source]

Fake implementation for QgisLegendInterface.isLayerVisible.

Since this is a fake interface pretending to be a real running QGIS app and we do not have a legend, we work on the premise that if a layer is in the canvas, it is also in the (fake) legend.

Parameters:layer (QgsMapLayer) – A QgsCanvasLayer that we want to determine if it is visible or not.
Returns:Hard coded to always return true if the layer is in the canvas!
Return type:bool
layers()[source]

Fake implementation for QgisLegendInterface.layers().

Returns:A list of QgsMapLayers - one per layer present in the map layer list will be returned.
Return type:list