1 /***************************************************************************
2                               qgswfsgetfeature.h
3                               -------------------------
4   begin                : December 20 , 2016
5   copyright            : (C) 2007 by Marco Hugentobler  (original code)
6                          (C) 2012 by René-Luc D'Hont    (original code)
7                          (C) 2014 by Alessandro Pasotti (original code)
8                          (C) 2017 by David Marteau
9   email                : marco dot hugentobler at karto dot baug dot ethz dot ch
10                          a dot pasotti at itopen dot it
11                          david dot marteau at 3liz dot com
12  ***************************************************************************/
13 
14 /***************************************************************************
15  *                                                                         *
16  *   This program is free software; you can redistribute it and/or modify  *
17  *   it under the terms of the GNU General Public License as published by  *
18  *   the Free Software Foundation; either version 2 of the License, or     *
19  *   (at your option) any later version.                                   *
20  *                                                                         *
21  ***************************************************************************/
22 #ifndef QGSWFSGETFEATURE_H
23 #define QGSWFSGETFEATURE_H
24 
25 #include "qgswfsparameters.h"
26 
27 namespace QgsWfs
28 {
29   struct getFeatureQuery
30   {
31     QString typeName;
32 
33     QString srsName;
34 
35     QgsFeatureRequest featureRequest;
36 
37     QStringList serverFids;
38 
39     QStringList propertyList;
40   };
41 
42   struct getFeatureRequest
43   {
44     long maxFeatures;
45 
46     long startIndex;
47 
48     QgsWfsParameters::Format outputFormat;
49 
50     QList< getFeatureQuery > queries;
51 
52     QString geometryName;
53   };
54 
55   /**
56    * Add SortBy element to featureRequest
57    */
58   void parseSortByElement( QDomElement &sortByElem, QgsFeatureRequest &featureRequest, const QString &typeName );
59 
60   /**
61    * Transform Query element to getFeatureQuery
62    */
63   getFeatureQuery parseQueryElement( QDomElement &queryElem, const QgsProject *project = nullptr );
64 
65   /**
66    * Transform RequestBody root element to getFeatureRequest
67    */
68   getFeatureRequest parseGetFeatureRequestBody( QDomElement &docElem, const QgsProject *project = nullptr );
69 
70   /**
71    * Transform parameters to getFeatureRequest
72    */
73   getFeatureRequest parseGetFeatureParameters( const QgsProject *project = nullptr );
74 
75   /**
76    * Output WFS  GetFeature response
77    */
78   void writeGetFeature( QgsServerInterface *serverIface, const QgsProject *project,
79                         const QString &version, const QgsServerRequest &request,
80                         QgsServerResponse &response );
81 
82 } // namespace QgsWfs
83 
84 #endif
85 
86