QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsmaphittest.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaphittest.h
3  ---------------------
4  begin : September 2014
5  copyright : (C) 2014 by Martin Dobias
6  email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSMAPHITTEST_H
16 #define QGSMAPHITTEST_H
17 
18 #include "qgis_core.h"
19 #include "qgis_sip.h"
20 #include "qgsmapsettings.h"
21 #include "qgsgeometry.h"
22 
23 #include <QSet>
24 
25 class QgsRenderContext;
26 class QgsSymbol;
27 class QgsVectorLayer;
28 class QgsExpression;
29 
37 class CORE_EXPORT QgsMapHitTest
38 {
39  public:
41  typedef QMap<QString, QString> LayerFilterExpression;
42 
48  QgsMapHitTest( const QgsMapSettings &settings, const QgsGeometry &polygon = QgsGeometry(), const QgsMapHitTest::LayerFilterExpression &layerFilterExpression = QgsMapHitTest::LayerFilterExpression() );
49 
51  QgsMapHitTest( const QgsMapSettings &settings, const QgsMapHitTest::LayerFilterExpression &layerFilterExpression );
52 
54  void run();
55 
63  bool symbolVisible( QgsSymbol *symbol, QgsVectorLayer *layer ) const;
64 
72  bool legendKeyVisible( const QString &ruleKey, QgsVectorLayer *layer ) const;
73 
74  private:
75 
77  typedef QSet<QString> SymbolSet;
78 
80  typedef QMap<QgsVectorLayer *, SymbolSet> HitTest;
81 
91  void runHitTestLayer( QgsVectorLayer *vl, SymbolSet &usedSymbols, SymbolSet &usedSymbolsRuleKey, QgsRenderContext &context );
92 
94  QgsMapSettings mSettings;
95 
97  HitTest mHitTest;
98 
100  HitTest mHitTestRuleKey;
101 
103  QgsMapHitTest::LayerFilterExpression mLayerFilterExpression;
104 
106  QgsGeometry mPolygon;
107 
109  bool mOnlyExpressions;
110 };
111 
112 #endif // QGSMAPHITTEST_H
QgsRenderContext
Contains information about the context of a rendering operation.
Definition: qgsrendercontext.h:59
QgsMapHitTest::LayerFilterExpression
QMap< QString, QString > LayerFilterExpression
Maps an expression string to a layer id.
Definition: qgsmaphittest.h:41
QgsSymbol
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:92
qgsmapsettings.h
QgsMapHitTest
Class that runs a hit test with given map settings. Based on the hit test it returns which symbols wi...
Definition: qgsmaphittest.h:37
qgis_sip.h
qgsgeometry.h
QgsGeometry
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:124
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
QgsExpression
Class for parsing and evaluation of expressions (formerly called "search strings")....
Definition: qgsexpression.h:102
QgsMapSettings
The QgsMapSettings class contains configuration for rendering of the map. The rendering itself is don...
Definition: qgsmapsettings.h:88