QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 #include "qgsfeaturerequest.h"
20 
22 {
23  filterFeatures.disableFilter();
24  for ( const QgsFeatureFilterProvider *provider : mProviders )
25  {
26  QgsFeatureRequest temp;
27  provider->filterFeatures( layer, temp );
28  if ( auto *lFilterExpression = temp.filterExpression() )
29  {
30  filterFeatures.combineFilterExpression( lFilterExpression->dump() );
31  }
32  }
33 }
34 
36 {
37  auto result = new QgsFeatureFilterProviderGroup();
38  result->mProviders = mProviders;
39  return result;
40 }
41 
43 {
44  if ( provider )
45  {
46  mProviders.append( provider );
47  }
48  return *this;
49 }
qgsfeaturerequest.h
QgsFeatureFilterProviderGroup::clone
QgsFeatureFilterProvider * clone() const override
Returns a clone of the object.
Definition: qgsfeaturefilterprovidergroup.cpp:35
QgsFeatureFilterProviderGroup
A filter filter provider grouping several filter providers.
Definition: qgsfeaturefilterprovidergroup.h:33
QgsFeatureFilterProviderGroup::QgsFeatureFilterProviderGroup
QgsFeatureFilterProviderGroup()=default
Constructor.
QgsFeatureFilterProviderGroup::filterFeatures
void filterFeatures(const QgsVectorLayer *layer, QgsFeatureRequest &filterFeatures) const override
Filter the features of the layer.
Definition: qgsfeaturefilterprovidergroup.cpp:21
qgsfeaturefilterprovidergroup.h
QgsFeatureRequest
This class wraps a request for features to a vector layer (or directly its vector data provider).
Definition: qgsfeaturerequest.h:76
QgsFeatureRequest::filterExpression
QgsExpression * filterExpression() const
Returns the filter expression if set.
Definition: qgsfeaturerequest.h:412
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:387
QgsFeatureFilterProvider
Abstract interface for use by classes that filter the features of a layer.
Definition: qgsfeaturefilterprovider.h:41
QgsFeatureFilterProviderGroup::addProvider
QgsFeatureFilterProviderGroup & addProvider(const QgsFeatureFilterProvider *provider)
Add another filter provider to the group.
Definition: qgsfeaturefilterprovidergroup.cpp:42