QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 
37  class QgsWfsParameter : public QgsServerParameterDefinition
38  {
39  Q_GADGET
40 
41  public:
43  enum Name
44  {
45  UNKNOWN,
47  RESULTTYPE,
51  SRSNAME,
52  TYPENAME,
53  FEATUREID,
54  FILTER,
55  BBOX,
57  EXP_FILTER,
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  {
134  NONE,
135  GML2,
136  GML3,
137  GeoJSON
138  };
139 
141  enum ResultType
142  {
143  RESULTS,
144  HITS
145  };
146 
151  QgsWfsParameters( const QgsServerParameters &parameters );
152 
157 
161  virtual ~QgsWfsParameters() = default;
162 
166  void dump() const;
167 
172  QgsProjectVersion versionAsNumber() const;
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 
272  QgsRectangle bboxAsRectangle() const;
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
QgsWfs::QgsWfsParameter::RESULTTYPE
@ RESULTTYPE
Definition: qgswfsparameters.h:60
QgsWfs::QgsWfsParameter::raiseError
void raiseError() const
Raises an error in case of an invalid conversion.
Definition: qgswfsparameters.cpp:115
QgsWfs::QgsWfsParameter::FILTER
@ FILTER
Definition: qgswfsparameters.h:67
qgsrectangle.h
qgsserverparameters.h
QgsWfs::QgsWfsParameter
WFS parameter received from the client.
Definition: qgswfsparameters.h:50
QgsWfs::QgsWfsParameter::toRectangle
QgsRectangle toRectangle() const
Converts the parameter into a rectangle.
Definition: qgswfsparameters.cpp:60
QgsWfs::QgsWfsParameter::STARTINDEX
@ STARTINDEX
Definition: qgswfsparameters.h:63
QgsWfs::QgsWfsParameters::Format
Format
Output format for the response.
Definition: qgswfsparameters.h:145
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:41
QgsWfs::QgsWfsParameter::MAXFEATURES
@ MAXFEATURES
Definition: qgswfsparameters.h:62
QgsWfs::QgsWfsParameter::mName
QgsWfsParameter::Name mName
Definition: qgswfsparameters.h:129
QgsWfs::QgsWfsParameter::BBOX
@ BBOX
Definition: qgswfsparameters.h:68
QgsWfs::QgsWfsParameter::PROPERTYNAME
@ PROPERTYNAME
Definition: qgswfsparameters.h:61
QgsWfs::QgsWfsParameter::Name
Name
Available parameters for WFS requests.
Definition: qgswfsparameters.h:56
QgsWfs::QgsWfsParameter::toInt
int toInt() const
Converts the parameter into an integer.
Definition: qgswfsparameters.cpp:47
QgsWfs::QgsWfsParameter::GEOMETRYNAME
@ GEOMETRYNAME
Definition: qgswfsparameters.h:71
QgsWfs::QgsWfsParameter::SRSNAME
@ SRSNAME
Definition: qgswfsparameters.h:64
QgsServerParameterDefinition
Definition of a parameter with basic conversion methods.
Definition: qgsserverparameters.h:34
QgsWfs::QgsWfsParameter::OUTPUTFORMAT
@ OUTPUTFORMAT
Definition: qgswfsparameters.h:59
QgsWfs::QgsWfsParameters
Provides an interface to retrieve and manipulate WFS parameters received from the client.
Definition: qgswfsparameters.h:138
QgsWfs
WMS implementation.
Definition: qgswfs.cpp:35
QgsWfs::QgsWfsParameters::ResultType
ResultType
Type of results.
Definition: qgswfsparameters.h:154
srsName
const QString & srsName
Definition: qgswfsgetfeature.cpp:119
QgsWfs::QgsWfsParameter::EXP_FILTER
@ EXP_FILTER
Definition: qgswfsparameters.h:70
QgsWfs::QgsWfsParameter::FEATUREID
@ FEATUREID
Definition: qgswfsparameters.h:66
QgsServerParameters
QgsServerParameters provides an interface to retrieve and manipulate global parameters received from ...
Definition: qgsserverparameters.h:242
QgsWfs::QgsWfsParameter::name
static QString name(const QgsWfsParameter::Name)
Converts a parameter's name into its string representation.
Definition: qgswfsparameters.cpp:121
QgsWfs::QgsWfsParameter::toStringListWithExp
QStringList toStringListWithExp(const QString &exp="\\(([^()]+)\\)") const
Converts the parameter into a list of string.
Definition: qgswfsparameters.cpp:84
qgsprojectversion.h
QgsWfs::QgsWfsParameter::SORTBY
@ SORTBY
Definition: qgswfsparameters.h:69
QgsWfs::QgsWfsParameter::UNKNOWN
@ UNKNOWN
Definition: qgswfsparameters.h:58
QgsProjectVersion
A class to describe the version of a project.
Definition: qgsprojectversion.h:32
QgsWfs::QgsWfsParameter::TYPENAME
@ TYPENAME
Definition: qgswfsparameters.h:65