QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
qgsdimensionfilter.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdimensionfilter.cpp
3  -------------------
4  begin : September 2021
5  copyright : (C) 2021 Matthias Kuhn
6  email : [email protected]
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 
18 #include "qgsdimensionfilter.h"
19 
20 QgsDimensionFilter::QgsDimensionFilter( const QMap<const QgsVectorLayer *, QStringList> dimensionFilter )
21  : mDimensionFilter( dimensionFilter )
22 {
23 
24 }
25 
26 void QgsDimensionFilter::filterFeatures( const QgsVectorLayer *layer, QgsFeatureRequest &featureRequest ) const
27 {
28  const QStringList dimFilters = mDimensionFilter.value( layer );
29 
30  for ( const QString &flt : dimFilters )
31  featureRequest.combineFilterExpression( flt );
32 }
33 
34 QStringList QgsDimensionFilter::layerAttributes( const QgsVectorLayer *layer, const QStringList &attributes ) const
35 {
36  Q_UNUSED( layer )
37  return attributes;
38 }
39 
41 {
42  return new QgsDimensionFilter( mDimensionFilter );
43 }
A server filter to apply a dimension filter to a request.
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.
QgsDimensionFilter(const QMap< const QgsVectorLayer *, QStringList > dimensionFilter)
Creates a new dimension filter object with a list of filters to be applied to vector layers.
QgsDimensionFilter * clone() const override
Create a clone of the feature filter provider.
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...
This class wraps a request for features to a vector layer (or directly its vector data provider).
QgsFeatureRequest & combineFilterExpression(const QString &expression)
Modifies the existing filter expression to add an additional expression filter.
Represents a vector layer which manages a vector based data sets.