File: qgswfserver.sip

package info (click to toggle)
qgis 2.18.28%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,007,948 kB
  • sloc: cpp: 671,774; python: 158,539; xml: 35,690; ansic: 8,346; sh: 1,766; perl: 1,669; sql: 999; yacc: 836; lex: 461; makefile: 292
file content (128 lines) | stat: -rw-r--r-- 5,368 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/***************************************************************************
                              qgswfsserver.sip
                              -------------------
  begin                : May 2, 2015
  copyright            : (C) 2015 by Alessandro Pasotti
  email                : a dot pasotti at itopen dot it
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef QGSWFSSERVER_H
#define QGSWFSSERVER_H

#include <QDomDocument>
#include <QMap>
#include <QString>
#include <map>
#include "qgis.h"
#include "qgsowsserver.h"
#include "qgsvectorlayer.h"
#include "qgswfsprojectparser.h"

class QgsCoordinateReferenceSystem;
class QgsComposerLayerItem;
class QgsComposerLegendItem;
class QgsComposition;
class QgsFields;
class QgsMapLayer;
class QgsMapRenderer;
class QgsPoint;
class QgsRasterLayer;
class QgsConfigParser;
class QgsVectorLayer;
class QgsCoordinateReferenceSystem;
class QgsField;
class QgsFeature;
class QgsRectangle;
class QgsGeometry;
class QgsSymbol;
class QgsRequestHandler;
class QFile;
class QFont;
class QImage;
class QPaintDevice;
class QPainter;


/** This class handles all the wms server requests. The parameters and values have to be passed in the form of
a map<QString, QString>. This map is usually generated by a subclass of QgsWMSRequestHandler, which makes QgsWFSServer
independent from any server side technology*/

class QgsWFSServer: public QgsOWSServer
{
  public:
    /** Constructor. Takes parameter map and a pointer to a renderer object (does not take ownership)*/
    QgsWFSServer( const QString& configFilePath, QMap<QString, QString>& parameters, QgsWFSProjectParser* cp,
                  QgsRequestHandler* rh, const QgsAccessControl* accessControl );
    ~QgsWFSServer();

    void executeRequest() override;

    /** Returns an XML file with the capabilities description (as described in the WFS specs)*/
    QDomDocument getCapabilities();

    /** Returns an XML file with the describe feature type (as described in the WFS specs)*/
    QDomDocument describeFeatureType();

    /** Creates a document that describes the result of the getFeature request.
       @return 0 in case of success*/
    int getFeature( QgsRequestHandler& request, const QString& format );

    /** Read and apply the transaction
       @return 0 in case of success*/
    QDomDocument transaction( const QString& requestBody );

    /** Sets configuration parser for administration settings. Does not take ownership*/
    void setAdminConfigParser( QgsWFSProjectParser* parser ) { mConfigParser = parser; }

  private:
    /** Don't use the default constructor*/
    QgsWFSServer();

    /** Get service address from REQUEST_URI if not specified in the configuration*/
    QString serviceUrl() const;

    /* The Type of Feature created */
    QString mTypeName;
    /* The list of Feature's Type requested */
    QStringList mTypeNames;
    QString mPropertyName;
    bool mWithGeom;
    /* Error messages */
    QStringList mErrors;

    QgsWFSProjectParser* mConfigParser;

  protected:

    void startGetFeature( QgsRequestHandler& request, const QString& format, int prec, QgsCoordinateReferenceSystem& crs, QgsRectangle* rect );
    void setGetFeature( QgsRequestHandler& request, const QString& format, QgsFeature* feat, int featIdx, int prec, QgsCoordinateReferenceSystem& crs, const QgsAttributeList& attrIndexes, const QSet<QString>& excludedAttributes,
                        const QgsAttributeList& pkAttributes = QgsAttributeList());
    void endGetFeature( QgsRequestHandler& request, const QString& format );

    //method for transaction
    QgsFeatureIds getFeatureIdsFromFilter( const QDomElement& filter, QgsVectorLayer* layer );

    //methods to write GeoJSON
    QString createFeatureGeoJSON( QgsFeature* feat, int prec, QgsCoordinateReferenceSystem& crs, const QgsAttributeList& attrIndexes, const QSet<QString>& excludedAttributes ) /*const*/;

    //methods to write GML2
    QDomElement createFeatureGML2( QgsFeature* feat, QDomDocument& doc, int prec, QgsCoordinateReferenceSystem& crs, const QgsAttributeList& attrIndexes, const QSet<QString>& excludedAttributes,
                                   const QgsAttributeList& pkAttributes = QgsAttributeList()) /*const*/;

    //methods to write GML3
    QDomElement createFeatureGML3( QgsFeature* feat, QDomDocument& doc, int prec, QgsCoordinateReferenceSystem& crs, QgsAttributeList attrIndexes, QSet<QString> excludedAttributes,
                                   const QgsAttributeList& pkAttributes = QgsAttributeList() ) /*const*/;

    void addTransactionResult( QDomDocument& responseDoc, QDomElement& responseElem, const QString& status, const QString& locator, const QString& message );
};

#endif