-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5561 from pvalsecc/wms_ogc_filters
[FEATURE][needs-docs] Add OGC filters to WMS
- Loading branch information
Showing
22 changed files
with
593 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/server/qgsfeaturefilter.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
|
||
class QgsFeatureFilter : QgsFeatureFilterProvider | ||
{ | ||
%Docstring | ||
A feature filter provider allowing to set filter expressions on a per-layer basis. | ||
.. versionadded:: 3.0 | ||
* | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsfeaturefilter.h" | ||
%End | ||
public: | ||
QgsFeatureFilter(); | ||
%Docstring | ||
Constructor | ||
%End | ||
|
||
void filterFeatures( const QgsVectorLayer *layer, QgsFeatureRequest &filterFeatures ) const; | ||
%Docstring | ||
Filter the features of the layer | ||
\param layer the layer to control | ||
\param filterFeatures the request to fill | ||
%End | ||
|
||
QgsFeatureFilterProvider *clone() const /Factory/; | ||
%Docstring | ||
Return a clone of the object | ||
:return: A clone | ||
:rtype: QgsFeatureFilterProvider | ||
%End | ||
|
||
void setFilter( const QgsVectorLayer *layer, const QgsExpression &expression ); | ||
%Docstring | ||
Set a filter for the given layer. | ||
\param layer the layer to filter | ||
\param expression the filter expression | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/server/qgsfeaturefilter.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/server/qgsfeaturefilterprovidergroup.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
class QgsFeatureFilterProviderGroup : QgsFeatureFilterProvider | ||
{ | ||
%Docstring | ||
A filter filter provider grouping several filter providers. | ||
.. versionadded:: 3.0 | ||
* | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsfeaturefilterprovidergroup.h" | ||
%End | ||
public: | ||
QgsFeatureFilterProviderGroup(); | ||
%Docstring | ||
Constructor | ||
%End | ||
|
||
void filterFeatures( const QgsVectorLayer *layer, QgsFeatureRequest &filterFeatures ) const; | ||
%Docstring | ||
Filter the features of the layer | ||
\param layer the layer to control | ||
\param filterFeatures the request to fill | ||
%End | ||
|
||
QgsFeatureFilterProvider *clone() const /Factory/; | ||
%Docstring | ||
Return a clone of the object | ||
:return: A clone | ||
:rtype: QgsFeatureFilterProvider | ||
%End | ||
|
||
QgsFeatureFilterProviderGroup &addProvider( const QgsFeatureFilterProvider *provider ); | ||
%Docstring | ||
Add another filter provider to the group | ||
\param provider The provider to add | ||
:return: itself | ||
:rtype: QgsFeatureFilterProviderGroup | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/server/qgsfeaturefilterprovidergroup.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/*************************************************************************** | ||
qgsfeaturefilter.cpp | ||
-------------------- | ||
begin : 26-10-2017 | ||
copyright : (C) 2017 by Patrick Valsecchi | ||
email : patrick dot valsecchi at camptocamp dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsfeaturefilter.h" | ||
#include "qgsfeaturerequest.h" | ||
#include "qgsvectorlayer.h" | ||
#include "qgsexpression.h" | ||
|
||
void QgsFeatureFilter::filterFeatures( const QgsVectorLayer *layer, QgsFeatureRequest &filterFeatures ) const | ||
{ | ||
const QString expr = mFilters[layer->id()]; | ||
if ( !expr.isEmpty() ) | ||
{ | ||
filterFeatures.setFilterExpression( expr ); | ||
} | ||
} | ||
|
||
QgsFeatureFilterProvider *QgsFeatureFilter::clone() const | ||
{ | ||
auto result = new QgsFeatureFilter(); | ||
result->mFilters = mFilters; | ||
return result; | ||
} | ||
|
||
void QgsFeatureFilter::setFilter( const QgsVectorLayer *layer, const QgsExpression &filter ) | ||
{ | ||
mFilters[layer->id()] = filter.dump(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/*************************************************************************** | ||
qgsfeaturefilter.h | ||
------------------ | ||
begin : 26-10-2017 | ||
copyright : (C) 2017 by Patrick Valsecchi | ||
email : patrick dot valsecchi at camptocamp dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSFEATUREFILTER_H | ||
#define QGSFEATUREFILTER_H | ||
|
||
#include "qgsfeaturefilterprovider.h" | ||
#include "qgis_server.h" | ||
|
||
#include <QMap> | ||
|
||
class QgsExpression; | ||
|
||
/** | ||
* \ingroup server | ||
* \class QgsFeatureFilter | ||
* \brief A feature filter provider allowing to set filter expressions on a per-layer basis. | ||
* \since QGIS 3.0 | ||
**/ | ||
class SERVER_EXPORT QgsFeatureFilter : public QgsFeatureFilterProvider | ||
{ | ||
public: | ||
//! Constructor | ||
QgsFeatureFilter() {} | ||
|
||
/** | ||
* Filter the features of the layer | ||
* \param layer the layer to control | ||
* \param filterFeatures the request to fill | ||
*/ | ||
void filterFeatures( const QgsVectorLayer *layer, QgsFeatureRequest &filterFeatures ) const; | ||
|
||
/** | ||
* Return a clone of the object | ||
* \returns A clone | ||
*/ | ||
QgsFeatureFilterProvider *clone() const SIP_FACTORY; | ||
|
||
/** | ||
* Set a filter for the given layer. | ||
* \param layer the layer to filter | ||
* \param expression the filter expression | ||
*/ | ||
void setFilter( const QgsVectorLayer *layer, const QgsExpression &expression ); | ||
|
||
private: | ||
QMap<QString, QString> mFilters; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/*************************************************************************** | ||
qgsfeaturefilterprovidergroup.cpp | ||
-------------------------------- | ||
begin : 26-10-2017 | ||
copyright : (C) 2017 by Patrick Valsecchi | ||
email : patrick dot valsecchi at camptocamp dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsfeaturefilterprovidergroup.h" | ||
#include "qgsfeaturerequest.h" | ||
|
||
void QgsFeatureFilterProviderGroup::filterFeatures( const QgsVectorLayer *layer, QgsFeatureRequest &filterFeatures ) const | ||
{ | ||
filterFeatures.disableFilter(); | ||
for ( const QgsFeatureFilterProvider *provider : mProviders ) | ||
{ | ||
QgsFeatureRequest temp; | ||
provider->filterFeatures( layer, temp ); | ||
if ( temp.filterExpression() ) | ||
{ | ||
filterFeatures.combineFilterExpression( temp.filterExpression()->dump() ); | ||
} | ||
} | ||
} | ||
|
||
QgsFeatureFilterProvider *QgsFeatureFilterProviderGroup::clone() const | ||
{ | ||
auto result = new QgsFeatureFilterProviderGroup(); | ||
result->mProviders = mProviders; | ||
return result; | ||
} | ||
|
||
QgsFeatureFilterProviderGroup &QgsFeatureFilterProviderGroup::addProvider( const QgsFeatureFilterProvider *provider ) | ||
{ | ||
if ( provider ) | ||
{ | ||
mProviders.append( provider ); | ||
} | ||
return *this; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/*************************************************************************** | ||
qgsfeaturefilterprovidergroup.h | ||
------------------------------- | ||
begin : 26-10-2017 | ||
copyright : (C) 2017 by Patrick Valsecchi | ||
email : patrick dot valsecchi at camptocamp dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSFEATUREFILTERPROVIDERGROUP_H | ||
#define QGSFEATUREFILTERPROVIDERGROUP_H | ||
|
||
#include "qgsfeaturefilterprovider.h" | ||
#include "qgis_server.h" | ||
|
||
#include <QList> | ||
|
||
/** | ||
* \ingroup server | ||
* \class QgsFeatureFilterProviderGroup | ||
* \brief A filter filter provider grouping several filter providers. | ||
* \since QGIS 3.0 | ||
**/ | ||
class SERVER_EXPORT QgsFeatureFilterProviderGroup : public QgsFeatureFilterProvider | ||
{ | ||
public: | ||
//! Constructor | ||
QgsFeatureFilterProviderGroup() {} | ||
|
||
/** | ||
* Filter the features of the layer | ||
* \param layer the layer to control | ||
* \param filterFeatures the request to fill | ||
*/ | ||
void filterFeatures( const QgsVectorLayer *layer, QgsFeatureRequest &filterFeatures ) const; | ||
|
||
/** | ||
* Return a clone of the object | ||
* \returns A clone | ||
*/ | ||
QgsFeatureFilterProvider *clone() const SIP_FACTORY; | ||
|
||
/** | ||
* Add another filter provider to the group | ||
* \param provider The provider to add | ||
* \return itself | ||
*/ | ||
QgsFeatureFilterProviderGroup &addProvider( const QgsFeatureFilterProvider *provider ); | ||
|
||
private: | ||
QList<const QgsFeatureFilterProvider *> mProviders; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.