| QGIS API Documentation
    3.20.0-Odense (decaadbb31)
    | 
Class that runs a hit test with given map settings. More...
#include <qgsmaphittest.h>
| Public Types | |
| typedef QMap< QString, QString > | LayerFilterExpression | 
| Maps an expression string to a layer id.  More... | |
| Public Member Functions | |
| QgsMapHitTest (const QgsMapSettings &settings, const QgsGeometry &polygon=QgsGeometry(), const QgsMapHitTest::LayerFilterExpression &layerFilterExpression=QgsMapHitTest::LayerFilterExpression()) | |
| QgsMapHitTest (const QgsMapSettings &settings, const QgsMapHitTest::LayerFilterExpression &layerFilterExpression) | |
| Constructor version used with only expressions to filter symbols (no extent or polygon intersection)  More... | |
| bool | legendKeyVisible (const QString &ruleKey, QgsVectorLayer *layer) const | 
| Tests whether a given legend key is visible for a specified layer.  More... | |
| void | run () | 
| Runs the map hit test.  More... | |
| bool | symbolVisible (QgsSymbol *symbol, QgsVectorLayer *layer) const | 
| Tests whether a symbol is visible for a specified layer.  More... | |
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.
Definition at line 37 of file qgsmaphittest.h.
| typedef QMap<QString, QString> QgsMapHitTest::LayerFilterExpression | 
Maps an expression string to a layer id.
Definition at line 41 of file qgsmaphittest.h.
| QgsMapHitTest::QgsMapHitTest | ( | const QgsMapSettings & | settings, | 
| const QgsGeometry & | polygon = QgsGeometry(), | ||
| const QgsMapHitTest::LayerFilterExpression & | layerFilterExpression = QgsMapHitTest::LayerFilterExpression() | ||
| ) | 
| settings | Map settings used to evaluate symbols | 
| polygon | Polygon geometry to refine the hit test | 
| layerFilterExpression | Expression string for each layer id to evaluate in order to refine the symbol selection | 
Definition at line 31 of file qgsmaphittest.cpp.
| QgsMapHitTest::QgsMapHitTest | ( | const QgsMapSettings & | settings, | 
| const QgsMapHitTest::LayerFilterExpression & | layerFilterExpression | ||
| ) | 
Constructor version used with only expressions to filter symbols (no extent or polygon intersection)
Definition at line 42 of file qgsmaphittest.cpp.
| bool QgsMapHitTest::legendKeyVisible | ( | const QString & | ruleKey, | 
| QgsVectorLayer * | layer | ||
| ) | const | 
Tests whether a given legend key is visible for a specified layer.
| ruleKey | legend rule key | 
| layer | vector layer | 
Definition at line 97 of file qgsmaphittest.cpp.
| void QgsMapHitTest::run | ( | ) | 
Runs the map hit test.
Definition at line 49 of file qgsmaphittest.cpp.
| bool QgsMapHitTest::symbolVisible | ( | QgsSymbol * | symbol, | 
| QgsVectorLayer * | layer | ||
| ) | const | 
Tests whether a symbol is visible for a specified layer.
| symbol | symbol to find | 
| layer | vector layer | 
Definition at line 89 of file qgsmaphittest.cpp.