QGIS API Documentation  3.6.0-Noosa (5873452)
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
Class for parsing and evaluation of expressions (formerly called "search strings").
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:61
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:106
The QgsMapSettings class contains configuration for rendering of the map.
Class that runs a hit test with given map settings.
Definition: qgsmaphittest.h:37
Contains information about the context of a rendering operation.
QMap< QString, QString > LayerFilterExpression
Maps an expression string to a layer id.
Definition: qgsmaphittest.h:41
Represents a vector layer which manages a vector based data sets.