QGIS API Documentation  3.6.0-Noosa (5873452)
Public Types | Public Member Functions | List of all members
QgsMapHitTest Class Reference

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...
 

Detailed Description

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.

Since
QGIS 2.6

Definition at line 37 of file qgsmaphittest.h.

Member Typedef Documentation

◆ LayerFilterExpression

typedef QMap<QString, QString> QgsMapHitTest::LayerFilterExpression

Maps an expression string to a layer id.

Definition at line 41 of file qgsmaphittest.h.

Constructor & Destructor Documentation

◆ QgsMapHitTest() [1/2]

QgsMapHitTest::QgsMapHitTest ( const QgsMapSettings settings,
const QgsGeometry polygon = QgsGeometry(),
const QgsMapHitTest::LayerFilterExpression layerFilterExpression = QgsMapHitTest::LayerFilterExpression() 
)
Parameters
settingsMap settings used to evaluate symbols
polygonPolygon geometry to refine the hit test
layerFilterExpressionExpression string for each layer id to evaluate in order to refine the symbol selection

Definition at line 30 of file qgsmaphittest.cpp.

◆ QgsMapHitTest() [2/2]

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 41 of file qgsmaphittest.cpp.

Member Function Documentation

◆ legendKeyVisible()

bool QgsMapHitTest::legendKeyVisible ( const QString &  ruleKey,
QgsVectorLayer layer 
) const

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

Parameters
ruleKeylegend rule key
layervector layer
See also
symbolVisible()
Since
QGIS 2.14

Definition at line 95 of file qgsmaphittest.cpp.

◆ run()

void QgsMapHitTest::run ( )

Runs the map hit test.

Definition at line 48 of file qgsmaphittest.cpp.

◆ symbolVisible()

bool QgsMapHitTest::symbolVisible ( QgsSymbol symbol,
QgsVectorLayer layer 
) const

Tests whether a symbol is visible for a specified layer.

Parameters
symbolsymbol to find
layervector layer
See also
legendKeyVisible()
Since
QGIS 2.12

Definition at line 87 of file qgsmaphittest.cpp.


The documentation for this class was generated from the following files: