QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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 ( temp.filterExpression() )
29  {
30  filterFeatures.combineFilterExpression( temp.filterExpression()->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 }
QString dump() const
Returns an expression string, constructed from the internal abstract syntax tree. ...
QgsExpression * filterExpression() const
Returns the filter expression if set.
QgsFeatureFilterProvider * clone() const override
Returns a clone of the object.
QgsFeatureRequest & combineFilterExpression(const QString &expression)
Modifies the existing filter expression to add an additional expression filter.
QgsFeatureFilterProviderGroup()=default
Constructor.
QgsFeatureRequest & disableFilter()
Disables filter conditions.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
Abstract interface for use by classes that filter the features of a layer.
QgsFeatureFilterProviderGroup & addProvider(const QgsFeatureFilterProvider *provider)
Add another filter provider to the group.
void filterFeatures(const QgsVectorLayer *layer, QgsFeatureRequest &filterFeatures) const override
Filter the features of the layer.
Represents a vector layer which manages a vector based data sets.
A filter filter provider grouping several filter providers.