QGIS API Documentation 3.29.0-Master (da8bb1db43)
qgswfsparameters.h
Go to the documentation of this file.
1/***************************************************************************
2 qgswfsparameters.h
3 ------------------
4 begin : Sept 14, 2017
5 copyright : (C) 2017 by René-Luc Dhont
6 email : rldhont at 3liz 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
18#ifndef QGSWFSPARAMETERS_H
19#define QGSWFSPARAMETERS_H
20
21#include <QMap>
22#include <QMetaEnum>
23
24#include "qgsrectangle.h"
25#include "qgsprojectversion.h"
26#include "qgsserverparameters.h"
27
28namespace QgsWfs
29{
30
38 {
39 Q_GADGET
40
41 public:
43 enum Name
44 {
59 };
60 Q_ENUM( Name )
61
62
69 const QVariant::Type type = QVariant::String,
70 const QVariant defaultValue = QVariant( "" ) );
71
75 virtual ~QgsWfsParameter() = default;
76
82 int toInt() const;
83
90 QStringList toStringListWithExp( const QString &exp = "\\(([^()]+)\\)" ) const;
91
98
103 void raiseError() const;
104
108 static QString name( const QgsWfsParameter::Name );
109
114 static QgsWfsParameter::Name name( const QString &name );
115
117 };
118
126 {
127 Q_GADGET
128
129 public:
130
133 {
137 GeoJSON
138 };
139
142 {
144 HITS
145 };
146
151 QgsWfsParameters( const QgsServerParameters &parameters );
152
157
161 virtual ~QgsWfsParameters() = default;
162
166 void dump() const;
167
173
178 QString outputFormatAsString() const;
179
185 Format outputFormat() const;
186
191 QString resultTypeAsString() const;
192
198 ResultType resultType() const;
199
204 QStringList propertyNames() const;
205
210 QString maxFeatures() const;
211
219 int maxFeaturesAsInt() const;
220
225 QString startIndex() const;
226
234 int startIndexAsInt() const;
235
240 QString srsName() const;
241
246 QStringList typeNames() const;
247
252 QStringList featureIds() const;
253
258 QStringList filters() const;
259
264 QString bbox() const;
265
273
278 QStringList sortBy() const;
279
284 QStringList expFilters() const;
285
290 QString geometryNameAsString() const;
291
292 private:
293 bool loadParameter( const QString &key, const QString &value ) override;
294 void save( const QgsWfsParameter &parameter );
295
296 void log( const QString &msg ) const;
297
298 QList<QgsProjectVersion> mVersions;
299 QMap<QgsWfsParameter::Name, QgsWfsParameter> mWfsParameters;
300 };
301}
302
303#endif
A class to describe the version of a project.
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Definition of a parameter with basic conversion methods.
QgsServerParameters provides an interface to retrieve and manipulate global parameters received from ...
QString value(const QString &key) const
Returns the value of a parameter.
WFS parameter received from the client.
virtual ~QgsWfsParameter()=default
Default destructor for QgsWfsParameter.
QgsWfsParameter::Name mName
Name
Available parameters for WFS requests.
QgsWfsParameter(const QgsWfsParameter::Name name=QgsWfsParameter::UNKNOWN, const QVariant::Type type=QVariant::String, const QVariant defaultValue=QVariant(""))
Constructor for QgsWfsParameter.
int toInt() const
Converts the parameter into an integer.
QStringList toStringListWithExp(const QString &exp="\\‍(([^()]+)\\‍)") const
Converts the parameter into a list of string.
void raiseError() const
Raises an error in case of an invalid conversion.
QgsRectangle toRectangle() const
Converts the parameter into a rectangle.
static QString name(const QgsWfsParameter::Name)
Converts a parameter's name into its string representation.
Provides an interface to retrieve and manipulate WFS parameters received from the client.
QgsWfsParameters()
Constructor for WFS parameters with default values only.
int startIndexAsInt() const
Returns STARTINDEX parameter as an int or its default value if not defined.
QString geometryNameAsString() const
Returns GEOMETRYNAME parameter as a string.
QStringList sortBy() const
Returns SORTBY parameter as list.
QStringList typeNames() const
Returns TYPENAME parameter as list.
QStringList expFilters() const
Returns EXP_FILTER parameter as list.
QString maxFeatures() const
Returns MAXFEATURES parameter as a string.
QStringList filters() const
Returns FILTER parameter as list.
QString srsName() const
Returns SRSNAME parameter as a string.
QString resultTypeAsString() const
Returns RESULTTYPE parameter as a string.
int maxFeaturesAsInt() const
Returns MAXFEATURES parameter as an int or its default value if not defined.
QString bbox() const
Returns BBOX if defined or an empty string.
void dump() const
Dumps parameters.
virtual ~QgsWfsParameters()=default
Default destructor for QgsWfsParameters.
QString outputFormatAsString() const
Returns OUTPUTFORMAT parameter as a string.
ResultType resultType() const
Returns resultType.
QgsProjectVersion versionAsNumber() const
Returns VERSION parameter if defined or its default value.
QStringList featureIds() const
Returns FEATUREID parameter as list.
QString startIndex() const
Returns STARTINDEX parameter as a string.
Format
Output format for the response.
QgsRectangle bboxAsRectangle() const
Returns BBOX as a rectangle if defined and valid.
QStringList propertyNames() const
Returns PROPERTYNAME parameter as list.
Format outputFormat() const
Returns format.
WMS implementation.
Definition: qgswfs.cpp:36