QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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 <QObject>
23 #include <QMetaEnum>
24 
25 #include "qgsrectangle.h"
26 #include "qgswfsserviceexception.h"
27 #include "qgsserverrequest.h"
28 #include "qgsprojectversion.h"
29 #include "qgsserverparameters.h"
30 
31 namespace QgsWfs
32 {
33 
41  {
42  Q_GADGET
43 
44  public:
46  enum Name
47  {
62  };
63  Q_ENUM( Name )
64 
65 
72  const QVariant::Type type = QVariant::String,
73  const QVariant defaultValue = QVariant( "" ) );
74 
78  virtual ~QgsWfsParameter() = default;
79 
85  int toInt() const;
86 
93  QStringList toStringListWithExp( const QString &exp = "\\(([^()]+)\\)" ) const;
94 
100  QgsRectangle toRectangle() const;
101 
106  void raiseError() const;
107 
111  static QString name( const QgsWfsParameter::Name );
112 
117  static QgsWfsParameter::Name name( const QString &name );
118 
120  };
121 
129  {
130  Q_GADGET
131 
132  public:
133 
135  enum Format
136  {
141  XSD
142  };
143 
146  {
148  HITS
149  };
150 
155  QgsWfsParameters( const QgsServerParameters &parameters );
156 
161 
165  virtual ~QgsWfsParameters() = default;
166 
170  void dump() const;
171 
176  QgsProjectVersion versionAsNumber() const;
177 
182  QString outputFormatAsString() const;
183 
189  Format outputFormat() const;
190 
195  QString resultTypeAsString() const;
196 
202  ResultType resultType() const;
203 
208  QStringList propertyNames() const;
209 
214  QString maxFeatures() const;
215 
223  int maxFeaturesAsInt() const;
224 
229  QString startIndex() const;
230 
238  int startIndexAsInt() const;
239 
244  QString srsName() const;
245 
250  QStringList typeNames() const;
251 
256  QStringList featureIds() const;
257 
262  QStringList filters() const;
263 
268  QString bbox() const;
269 
276  QgsRectangle bboxAsRectangle() const;
277 
282  QStringList sortBy() const;
283 
288  QStringList expFilters() const;
289 
294  QString geometryNameAsString() const;
295 
296  private:
297  bool loadParameter( const QString &name, const QString &key ) override;
298  void save( const QgsWfsParameter &parameter );
299 
300  void log( const QString &msg ) const;
301 
302  QList<QgsProjectVersion> mVersions;
303  QMap<QgsWfsParameter::Name, QgsWfsParameter> mWfsParameters;
304  };
305 }
306 
307 #endif
A rectangle specified with double values.
Definition: qgsrectangle.h:40
QgsRectangle toRectangle() const
Converts the parameter into a rectangle.
WFS parameter received from the client.
int toInt() const
Converts the parameter into an integer.
void raiseError() const
Raises an error in case of an invalid conversion.
WMS implementation.
Definition: qgswfs.cpp:35
A class to describe the version of a project.
Format
Output format for the response.
QStringList toStringListWithExp(const QString &exp="\\(([^()]+)\\)") const
Converts the parameter into a list of string.
QgsWfsParameter::Name mName
QgsServerParameters provides an interface to retrieve and manipulate global parameters received from ...
ResultType
Type of results.
Name
Available parameters for WFS requests.
Provides an interface to retrieve and manipulate WFS parameters received from the client...
static QString name(const QgsWfsParameter::Name)
Converts a parameter&#39;s name into its string representation.
Definition of a parameter with basic conversion methods.