QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsfeaturefilterprovidergroup.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsfeaturefilterprovidergroup.cpp
3 --------------------------------
4 begin : 26-10-2017
5 copyright : (C) 2017 by Patrick Valsecchi
6 email : patrick dot valsecchi at camptocamp dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
19
20#include "qgsfeaturerequest.h"
21
23{
24 for ( const QgsFeatureFilterProvider *provider : mProviders )
25 {
28 provider->filterFeatures( layer, temp );
30 if ( auto *lFilterExpression = temp.filterExpression() )
31 {
32 filterFeatures.combineFilterExpression( lFilterExpression->dump() );
33 }
34 }
35}
36
37QStringList QgsFeatureFilterProviderGroup::layerAttributes( const QgsVectorLayer *layer, const QStringList &attributes ) const
38{
39 QStringList allowedAttributes { attributes };
40 for ( const QgsFeatureFilterProvider *provider : mProviders )
41 {
42 const QgsFeatureRequest temp;
43 allowedAttributes = provider->layerAttributes( layer, allowedAttributes );
44 }
45 return allowedAttributes;
46}
47
49{
50 auto result = new QgsFeatureFilterProviderGroup();
51 result->mProviders = mProviders;
52 return result;
53}
54
56{
57 if ( provider )
58 {
59 mProviders.append( provider );
60 }
61 return *this;
62}
void filterFeatures(const QgsVectorLayer *layer, QgsFeatureRequest &filterFeatures) const override
Add additional filters to the feature request to further restrict the features returned by the reques...
QgsFeatureFilterProviderGroup & addProvider(const QgsFeatureFilterProvider *provider)
Add another filter provider to the group.
QgsFeatureFilterProviderGroup * clone() const override
Create a clone of the feature filter provider.
QStringList layerAttributes(const QgsVectorLayer *layer, const QStringList &attributes) const override
Returns the list of visible attribute names from a list of attributes names for the given layer.
QgsFeatureFilterProviderGroup()=default
Constructor.
QgsFeatureFilterProvider()=default
Wraps a request for features to a vector layer (or directly its vector data provider).
QgsExpression * filterExpression() const
Returns the filter expression (if set).
Represents a vector layer which manages a vector based dataset.
#define Q_NOWARN_DEPRECATED_POP
Definition qgis.h:7170
#define Q_NOWARN_DEPRECATED_PUSH
Definition qgis.h:7169