Subgroup: Map

Class: QgsMapHitTest

class qgis.core.QgsMapHitTest

Bases: sip.wrapper

Class that runs a hit test with given map settings. Based on the hit test it returns which symbols will be visible on the map - this is useful for content based legend.

New in version 2.6: Methods

legendKeyVisible Tests whether a given legend key is visible for a specified layer.
run Runs the map hit test
symbolVisible Tests whether a symbol is visible for a specified layer.

Attributes

legendKeyVisible(self, ruleKey: str, layer: QgsVectorLayer) → bool

Tests whether a given legend key is visible for a specified layer.

Parameters:
  • ruleKey – legend rule key
  • layer – vector layer

New in version 2.14.

See also

symbolVisible()

run(self)

Runs the map hit test

symbolVisible(self, symbol: QgsSymbol, layer: QgsVectorLayer) → bool

Tests whether a symbol is visible for a specified layer.

Parameters:
  • symbol – symbol to find
  • layer – vector layer

New in version 2.12.