QGIS API Documentation 3.41.0-Master (cea29feecf2)
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
26void 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
34QStringList 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.
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.