QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 
28 namespace 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 
97  QgsRectangle toRectangle() const;
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 
132  enum Format
133  {
138  XSD
139  };
140 
143  {
145  HITS
146  };
147 
152  QgsWfsParameters( const QgsServerParameters &parameters );
153 
158 
162  virtual ~QgsWfsParameters() = default;
163 
167  void dump() const;
168 
174 
179  QString outputFormatAsString() const;
180 
186  Format outputFormat() const;
187 
192  QString resultTypeAsString() const;
193 
199  ResultType resultType() const;
200 
205  QStringList propertyNames() const;
206 
211  QString maxFeatures() const;
212 
220  int maxFeaturesAsInt() const;
221 
226  QString startIndex() const;
227 
235  int startIndexAsInt() const;
236 
241  QString srsName() const;
242 
247  QStringList typeNames() const;
248 
253  QStringList featureIds() const;
254 
259  QStringList filters() const;
260 
265  QString bbox() const;
266 
274 
279  QStringList sortBy() const;
280 
285  QStringList expFilters() const;
286 
291  QString geometryNameAsString() const;
292 
293  private:
294  bool loadParameter( const QString &key, const QString &value ) override;
295  void save( const QgsWfsParameter &parameter );
296 
297  void log( const QString &msg ) const;
298 
299  QList<QgsProjectVersion> mVersions;
300  QMap<QgsWfsParameter::Name, QgsWfsParameter> mWfsParameters;
301  };
302 }
303 
304 #endif
QgsWfs::QgsWfsParameters::resultTypeAsString
QString resultTypeAsString() const
Returns RESULTTYPE parameter as a string.
Definition: qgswfsparameters.cpp:266
QgsWfs::QgsWfsParameter::RESULTTYPE
@ RESULTTYPE
Definition: qgswfsparameters.h:47
QgsWfs::QgsWfsParameter::raiseError
void raiseError() const
Raises an error in case of an invalid conversion.
Definition: qgswfsparameters.cpp:102
QgsWfs::QgsWfsParameters::featureIds
QStringList featureIds() const
Returns FEATUREID parameter as list.
Definition: qgswfsparameters.cpp:318
QgsWfs::QgsWfsParameter::FILTER
@ FILTER
Definition: qgswfsparameters.h:54
QgsWfs::QgsWfsParameters::maxFeaturesAsInt
int maxFeaturesAsInt() const
Returns MAXFEATURES parameter as an int or its default value if not defined.
Definition: qgswfsparameters.cpp:293
qgsrectangle.h
qgsserverparameters.h
QgsWfs::QgsWfsParameter
WFS parameter received from the client.
Definition: qgswfsparameters.h:38
QgsWfs::QgsWfsParameters::srsName
QString srsName() const
Returns SRSNAME parameter as a string.
Definition: qgswfsparameters.cpp:308
QgsWfs::QgsWfsParameters::outputFormatAsString
QString outputFormatAsString() const
Returns OUTPUTFORMAT parameter as a string.
Definition: qgswfsparameters.cpp:222
QgsWfs::QgsWfsParameters::resultType
ResultType resultType() const
Returns resultType.
Definition: qgswfsparameters.cpp:271
QgsWfs::QgsWfsParameters::dump
void dump() const
Dumps parameters.
Definition: qgswfsparameters.cpp:204
QgsWfs::QgsWfsParameters::startIndexAsInt
int startIndexAsInt() const
Returns STARTINDEX parameter as an int or its default value if not defined.
Definition: qgswfsparameters.cpp:303
QgsWfs::QgsWfsParameters::HITS
@ HITS
Definition: qgswfsparameters.h:145
QgsWfs::QgsWfsParameter::toRectangle
QgsRectangle toRectangle() const
Converts the parameter into a rectangle.
Definition: qgswfsparameters.cpp:47
QgsWfs::QgsWfsParameters::GML3
@ GML3
Definition: qgswfsparameters.h:136
QgsWfs::QgsWfsParameter::STARTINDEX
@ STARTINDEX
Definition: qgswfsparameters.h:50
QgsWfs::QgsWfsParameters::NONE
@ NONE
Definition: qgswfsparameters.h:134
QgsWfs::QgsWfsParameters::Format
Format
Output format for the response.
Definition: qgswfsparameters.h:133
QgsServerParameters::value
QString value(const QString &key) const
Returns the value of a parameter.
Definition: qgsserverparameters.cpp:532
QgsWfs::QgsWfsParameters::versionAsNumber
QgsProjectVersion versionAsNumber() const
Returns VERSION parameter if defined or its default value.
Definition: qgswfsparameters.cpp:353
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:42
QgsWfs::QgsWfsParameters::outputFormat
Format outputFormat() const
Returns format.
Definition: qgswfsparameters.cpp:227
QgsWfs::QgsWfsParameter::MAXFEATURES
@ MAXFEATURES
Definition: qgswfsparameters.h:49
QgsWfs::QgsWfsParameter::mName
QgsWfsParameter::Name mName
Definition: qgswfsparameters.h:116
QgsWfs::QgsWfsParameter::BBOX
@ BBOX
Definition: qgswfsparameters.h:55
QgsWfs::QgsWfsParameter::PROPERTYNAME
@ PROPERTYNAME
Definition: qgswfsparameters.h:48
QgsWfs::QgsWfsParameter::Name
Name
Available parameters for WFS requests.
Definition: qgswfsparameters.h:44
QgsWfs::QgsWfsParameters::typeNames
QStringList typeNames() const
Returns TYPENAME parameter as list.
Definition: qgswfsparameters.cpp:313
QgsWfs::QgsWfsParameters::filters
QStringList filters() const
Returns FILTER parameter as list.
Definition: qgswfsparameters.cpp:323
QgsWfs::QgsWfsParameter::toInt
int toInt() const
Converts the parameter into an integer.
Definition: qgswfsparameters.cpp:34
QgsWfs::QgsWfsParameter::GEOMETRYNAME
@ GEOMETRYNAME
Definition: qgswfsparameters.h:58
QgsWfs::QgsWfsParameters::bbox
QString bbox() const
Returns BBOX if defined or an empty string.
Definition: qgswfsparameters.cpp:328
QgsWfs::QgsWfsParameter::QgsWfsParameter
QgsWfsParameter(const QgsWfsParameter::Name name=QgsWfsParameter::UNKNOWN, const QVariant::Type type=QVariant::String, const QVariant defaultValue=QVariant(""))
Constructor for QgsWfsParameter.
Definition: qgswfsparameters.cpp:26
QgsWfs::QgsWfsParameter::SRSNAME
@ SRSNAME
Definition: qgswfsparameters.h:51
QgsServerParameterDefinition
Definition of a parameter with basic conversion methods.
Definition: qgsserverparameters.h:35
QgsWfs::QgsWfsParameter::OUTPUTFORMAT
@ OUTPUTFORMAT
Definition: qgswfsparameters.h:46
QgsWfs::QgsWfsParameters
Provides an interface to retrieve and manipulate WFS parameters received from the client.
Definition: qgswfsparameters.h:126
QgsWfs
WMS implementation.
Definition: qgswfs.cpp:36
QgsWfs::QgsWfsParameters::maxFeatures
QString maxFeatures() const
Returns MAXFEATURES parameter as a string.
Definition: qgswfsparameters.cpp:288
QgsWfs::QgsWfsParameters::~QgsWfsParameters
virtual ~QgsWfsParameters()=default
Default destructor for QgsWfsParameters.
QgsWfs::QgsWfsParameters::ResultType
ResultType
Type of results.
Definition: qgswfsparameters.h:143
QgsWfs::QgsWfsParameters::RESULTS
@ RESULTS
Definition: qgswfsparameters.h:144
QgsWfs::QgsWfsParameters::sortBy
QStringList sortBy() const
Returns SORTBY parameter as list.
Definition: qgswfsparameters.cpp:338
QgsWfs::QgsWfsParameters::GML2
@ GML2
Definition: qgswfsparameters.h:135
QgsWfs::QgsWfsParameter::EXP_FILTER
@ EXP_FILTER
Definition: qgswfsparameters.h:57
QgsWfs::QgsWfsParameter::FEATUREID
@ FEATUREID
Definition: qgswfsparameters.h:53
QgsWfs::QgsWfsParameters::startIndex
QString startIndex() const
Returns STARTINDEX parameter as a string.
Definition: qgswfsparameters.cpp:298
QgsWfs::QgsWfsParameters::propertyNames
QStringList propertyNames() const
Returns PROPERTYNAME parameter as list.
Definition: qgswfsparameters.cpp:283
QgsWfs::QgsWfsParameters::XSD
@ XSD
Definition: qgswfsparameters.h:138
QgsWfs::QgsWfsParameters::bboxAsRectangle
QgsRectangle bboxAsRectangle() const
Returns BBOX as a rectangle if defined and valid.
Definition: qgswfsparameters.cpp:333
QgsServerParameters
QgsServerParameters provides an interface to retrieve and manipulate global parameters received from ...
Definition: qgsserverparameters.h:229
QgsWfs::QgsWfsParameters::geometryNameAsString
QString geometryNameAsString() const
Returns GEOMETRYNAME parameter as a string.
Definition: qgswfsparameters.cpp:348
QgsWfs::QgsWfsParameter::name
static QString name(const QgsWfsParameter::Name)
Converts a parameter's name into its string representation.
Definition: qgswfsparameters.cpp:108
QgsWfs::QgsWfsParameter::~QgsWfsParameter
virtual ~QgsWfsParameter()=default
Default destructor for QgsWfsParameter.
QgsWfs::QgsWfsParameter::toStringListWithExp
QStringList toStringListWithExp(const QString &exp="\\‍(([^()]+)\\‍)") const
Converts the parameter into a list of string.
Definition: qgswfsparameters.cpp:71
qgsprojectversion.h
QgsWfs::QgsWfsParameter::SORTBY
@ SORTBY
Definition: qgswfsparameters.h:56
QgsWfs::QgsWfsParameters::QgsWfsParameters
QgsWfsParameters()
Constructor for WFS parameters with default values only.
Definition: qgswfsparameters.cpp:123
QgsWfs::QgsWfsParameters::GeoJSON
@ GeoJSON
Definition: qgswfsparameters.h:137
QgsWfs::QgsWfsParameter::UNKNOWN
@ UNKNOWN
Definition: qgswfsparameters.h:45
QgsProjectVersion
A class to describe the version of a project.
Definition: qgsprojectversion.h:32
QgsWfs::QgsWfsParameter::TYPENAME
@ TYPENAME
Definition: qgswfsparameters.h:52
QgsWfs::QgsWfsParameters::expFilters
QStringList expFilters() const
Returns EXP_FILTER parameter as list.
Definition: qgswfsparameters.cpp:343