QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
qgsdimensionfilter.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsdimensionfilter.cpp
3 -------------------
4 begin : September 2021
5 copyright : (C) 2021 Matthias Kuhn
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#include "qgsfeaturerequest.h"
20
21QgsDimensionFilter::QgsDimensionFilter( const QHash<const QgsVectorLayer *, QStringList> dimensionFilter )
22 : mDimensionFilter( dimensionFilter )
23{
24
25}
26
27void QgsDimensionFilter::filterFeatures( const QgsVectorLayer *layer, QgsFeatureRequest &featureRequest ) const
28{
29 const QStringList dimFilters = mDimensionFilter.value( layer );
30
31 for ( const QString &flt : dimFilters )
32 featureRequest.combineFilterExpression( flt );
33}
34
35QStringList QgsDimensionFilter::layerAttributes( const QgsVectorLayer *layer, const QStringList &attributes ) const
36{
37 Q_UNUSED( layer )
38 return attributes;
39}
40
42{
43 return new QgsDimensionFilter( mDimensionFilter );
44}
A server filter to apply a dimension filter to a request.
QgsDimensionFilter(const QHash< const QgsVectorLayer *, QStringList > dimensionFilter)
Creates a new dimension filter object with a list of filters to be applied to vector layers.
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 * 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.