QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
qgsvectorlayerfeaturecounter.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectorlayerfeaturecounter.h
3  ---------------------
4  begin : May 2017
5  copyright : (C) 2017 by Matthias Kuhn
6  email : matthias at opengis dot ch
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 QGSVECTORLAYERFEATURECOUNTER_H
16 #define QGSVECTORLAYERFEATURECOUNTER_H
17 
19 #include "qgsrenderer.h"
20 #include "qgstaskmanager.h"
21 #include "qgsfeatureid.h"
22 
33 class CORE_EXPORT QgsVectorLayerFeatureCounter : public QgsTask
34 {
35  Q_OBJECT
36 
37  public:
38 
43 
44 
48  bool run() override;
49 
56  QHash<QString, long> symbolFeatureCountMap() const SIP_SKIP;
57 
62  long featureCount( const QString &legendKey ) const;
63 
72  QHash<QString, QgsFeatureIds> symbolFeatureIdMap() const SIP_SKIP;
73 
80  QgsFeatureIds featureIds( const QString &symbolkey ) const;
81 
82  signals:
83 
87  void symbolsCounted();
88 
89  private:
90  std::unique_ptr<QgsVectorLayerFeatureSource> mSource;
91  std::unique_ptr<QgsFeatureRenderer> mRenderer;
92  QgsExpressionContext mExpressionContext;
93  QHash<QString, long> mSymbolFeatureCountMap;
94  QHash<QString, QgsFeatureIds> mSymbolFeatureIdMap;
95  int mFeatureCount;
96 
97 };
98 
99 #endif // QGSVECTORLAYERFEATURECOUNTER_H
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeatureid.h:34
Counts the features in a QgsVectorLayer in task.
#define SIP_SKIP
Definition: qgis_sip.h:126
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Abstract base class for long running background tasks.
virtual bool run()=0
Performs the task&#39;s operation.
Represents a vector layer which manages a vector based data sets.