@@ -68,79 +68,17 @@ namespace QgsWfs
68
68
wfsCapabilitiesElement.setAttribute ( QStringLiteral ( " updateSequence" ), QStringLiteral ( " 0" ) );
69
69
doc.appendChild ( wfsCapabilitiesElement );
70
70
71
- // configParser->serviceCapabilities( wfsCapabilitiesElement, doc );
72
- // INSERT Service
71
+ // wfs:Service
73
72
wfsCapabilitiesElement.appendChild ( getServiceElement ( doc, project ) );
74
73
75
- // wfs:Capability element
76
- QDomElement capabilityElement = doc.createElement ( QStringLiteral ( " Capability" )/* wfs:Capability*/ );
77
- wfsCapabilitiesElement.appendChild ( capabilityElement );
78
-
79
- // wfs:Request element
80
- QDomElement requestElement = doc.createElement ( QStringLiteral ( " Request" )/* wfs:Request*/ );
81
- capabilityElement.appendChild ( requestElement );
82
- // wfs:GetCapabilities
83
- QDomElement getCapabilitiesElement = doc.createElement ( QStringLiteral ( " GetCapabilities" )/* wfs:GetCapabilities*/ );
84
- requestElement.appendChild ( getCapabilitiesElement );
85
-
86
- QDomElement dcpTypeElement = doc.createElement ( QStringLiteral ( " DCPType" )/* wfs:DCPType*/ );
87
- getCapabilitiesElement.appendChild ( dcpTypeElement );
88
- QDomElement httpElement = doc.createElement ( QStringLiteral ( " HTTP" )/* wfs:HTTP*/ );
89
- dcpTypeElement.appendChild ( httpElement );
90
-
91
- // Prepare url
92
- QString hrefString = serviceUrl ( request, project );
93
-
94
- // only Get supported for the moment
95
- QDomElement getElement = doc.createElement ( QStringLiteral ( " Get" )/* wfs:Get*/ );
96
- httpElement.appendChild ( getElement );
97
- getElement.setAttribute ( QStringLiteral ( " onlineResource" ), hrefString );
98
- QDomElement getCapabilitiesDhcTypePostElement = dcpTypeElement.cloneNode ().toElement ();// this is the same as for 'GetCapabilities'
99
- getCapabilitiesDhcTypePostElement.firstChild ().firstChild ().toElement ().setTagName ( QStringLiteral ( " Post" ) );
100
- getCapabilitiesElement.appendChild ( getCapabilitiesDhcTypePostElement );
101
-
102
- // wfs:DescribeFeatureType
103
- QDomElement describeFeatureTypeElement = doc.createElement ( QStringLiteral ( " DescribeFeatureType" )/* wfs:DescribeFeatureType*/ );
104
- requestElement.appendChild ( describeFeatureTypeElement );
105
- QDomElement schemaDescriptionLanguageElement = doc.createElement ( QStringLiteral ( " SchemaDescriptionLanguage" )/* wfs:SchemaDescriptionLanguage*/ );
106
- describeFeatureTypeElement.appendChild ( schemaDescriptionLanguageElement );
107
- QDomElement xmlSchemaElement = doc.createElement ( QStringLiteral ( " XMLSCHEMA" )/* wfs:XMLSCHEMA*/ );
108
- schemaDescriptionLanguageElement.appendChild ( xmlSchemaElement );
109
- QDomElement describeFeatureTypeDhcTypeElement = dcpTypeElement.cloneNode ().toElement ();// this is the same as for 'GetCapabilities'
110
- describeFeatureTypeElement.appendChild ( describeFeatureTypeDhcTypeElement );
111
- QDomElement describeFeatureTypeDhcTypePostElement = dcpTypeElement.cloneNode ().toElement ();// this is the same as for 'GetCapabilities'
112
- describeFeatureTypeDhcTypePostElement.firstChild ().firstChild ().toElement ().setTagName ( QStringLiteral ( " Post" ) );
113
- describeFeatureTypeElement.appendChild ( describeFeatureTypeDhcTypePostElement );
114
-
115
- // wfs:GetFeature
116
- QDomElement getFeatureElement = doc.createElement ( QStringLiteral ( " GetFeature" )/* wfs:GetFeature*/ );
117
- requestElement.appendChild ( getFeatureElement );
118
- QDomElement getFeatureFormatElement = doc.createElement ( QStringLiteral ( " ResultFormat" ) );/* wfs:ResultFormat*/
119
- getFeatureElement.appendChild ( getFeatureFormatElement );
120
- QDomElement gmlFormatElement = doc.createElement ( QStringLiteral ( " GML2" ) );/* wfs:GML2*/
121
- getFeatureFormatElement.appendChild ( gmlFormatElement );
122
- QDomElement gml3FormatElement = doc.createElement ( QStringLiteral ( " GML3" ) );/* wfs:GML3*/
123
- getFeatureFormatElement.appendChild ( gml3FormatElement );
124
- QDomElement geojsonFormatElement = doc.createElement ( QStringLiteral ( " GeoJSON" ) );/* wfs:GeoJSON*/
125
- getFeatureFormatElement.appendChild ( geojsonFormatElement );
126
- QDomElement getFeatureDhcTypeGetElement = dcpTypeElement.cloneNode ().toElement ();// this is the same as for 'GetCapabilities'
127
- getFeatureElement.appendChild ( getFeatureDhcTypeGetElement );
128
- QDomElement getFeatureDhcTypePostElement = dcpTypeElement.cloneNode ().toElement ();// this is the same as for 'GetCapabilities'
129
- getFeatureDhcTypePostElement.firstChild ().firstChild ().toElement ().setTagName ( QStringLiteral ( " Post" ) );
130
- getFeatureElement.appendChild ( getFeatureDhcTypePostElement );
131
-
132
- // wfs:Transaction
133
- QDomElement transactionElement = doc.createElement ( QStringLiteral ( " Transaction" )/* wfs:Transaction*/ );
134
- requestElement.appendChild ( transactionElement );
135
- QDomElement transactionDhcTypeElement = dcpTypeElement.cloneNode ().toElement ();// this is the same as for 'GetCapabilities'
136
- transactionDhcTypeElement.firstChild ().firstChild ().toElement ().setTagName ( QStringLiteral ( " Post" ) );
137
- transactionElement.appendChild ( transactionDhcTypeElement );
74
+ // wfs:Capability
75
+ wfsCapabilitiesElement.appendChild ( getCapabilityElement ( doc, project, request ) );
138
76
139
77
// wfs:FeatureTypeList
140
78
wfsCapabilitiesElement.appendChild ( getFeatureTypeListElement ( doc, serverIface, project ) );
141
79
142
80
/*
143
- * Adding ogc:Filter_Capabilities in capabilityElement
81
+ * Adding ogc:Filter_Capabilities in wfsCapabilitiesElement
144
82
*/
145
83
// ogc:Filter_Capabilities element
146
84
QDomElement filterCapabilitiesElement = doc.createElement ( QStringLiteral ( " ogc:Filter_Capabilities" )/* ogc:Filter_Capabilities*/ );
@@ -238,6 +176,74 @@ namespace QgsWfs
238
176
239
177
}
240
178
179
+ QDomElement getCapabilityElement ( QDomDocument &doc, const QgsProject *project, const QgsServerRequest &request )
180
+ {
181
+ // wfs:Capability element
182
+ QDomElement capabilityElement = doc.createElement ( QStringLiteral ( " Capability" )/* wfs:Capability*/ );
183
+
184
+ // wfs:Request element
185
+ QDomElement requestElement = doc.createElement ( QStringLiteral ( " Request" )/* wfs:Request*/ );
186
+ capabilityElement.appendChild ( requestElement );
187
+ // wfs:GetCapabilities
188
+ QDomElement getCapabilitiesElement = doc.createElement ( QStringLiteral ( " GetCapabilities" )/* wfs:GetCapabilities*/ );
189
+ requestElement.appendChild ( getCapabilitiesElement );
190
+
191
+ QDomElement dcpTypeElement = doc.createElement ( QStringLiteral ( " DCPType" )/* wfs:DCPType*/ );
192
+ getCapabilitiesElement.appendChild ( dcpTypeElement );
193
+ QDomElement httpElement = doc.createElement ( QStringLiteral ( " HTTP" )/* wfs:HTTP*/ );
194
+ dcpTypeElement.appendChild ( httpElement );
195
+
196
+ // Prepare url
197
+ QString hrefString = serviceUrl ( request, project );
198
+
199
+ // only Get supported for the moment
200
+ QDomElement getElement = doc.createElement ( QStringLiteral ( " Get" )/* wfs:Get*/ );
201
+ httpElement.appendChild ( getElement );
202
+ getElement.setAttribute ( QStringLiteral ( " onlineResource" ), hrefString );
203
+ QDomElement getCapabilitiesDhcTypePostElement = dcpTypeElement.cloneNode ().toElement ();// this is the same as for 'GetCapabilities'
204
+ getCapabilitiesDhcTypePostElement.firstChild ().firstChild ().toElement ().setTagName ( QStringLiteral ( " Post" ) );
205
+ getCapabilitiesElement.appendChild ( getCapabilitiesDhcTypePostElement );
206
+
207
+ // wfs:DescribeFeatureType
208
+ QDomElement describeFeatureTypeElement = doc.createElement ( QStringLiteral ( " DescribeFeatureType" )/* wfs:DescribeFeatureType*/ );
209
+ requestElement.appendChild ( describeFeatureTypeElement );
210
+ QDomElement schemaDescriptionLanguageElement = doc.createElement ( QStringLiteral ( " SchemaDescriptionLanguage" )/* wfs:SchemaDescriptionLanguage*/ );
211
+ describeFeatureTypeElement.appendChild ( schemaDescriptionLanguageElement );
212
+ QDomElement xmlSchemaElement = doc.createElement ( QStringLiteral ( " XMLSCHEMA" )/* wfs:XMLSCHEMA*/ );
213
+ schemaDescriptionLanguageElement.appendChild ( xmlSchemaElement );
214
+ QDomElement describeFeatureTypeDhcTypeElement = dcpTypeElement.cloneNode ().toElement ();// this is the same as for 'GetCapabilities'
215
+ describeFeatureTypeElement.appendChild ( describeFeatureTypeDhcTypeElement );
216
+ QDomElement describeFeatureTypeDhcTypePostElement = dcpTypeElement.cloneNode ().toElement ();// this is the same as for 'GetCapabilities'
217
+ describeFeatureTypeDhcTypePostElement.firstChild ().firstChild ().toElement ().setTagName ( QStringLiteral ( " Post" ) );
218
+ describeFeatureTypeElement.appendChild ( describeFeatureTypeDhcTypePostElement );
219
+
220
+ // wfs:GetFeature
221
+ QDomElement getFeatureElement = doc.createElement ( QStringLiteral ( " GetFeature" )/* wfs:GetFeature*/ );
222
+ requestElement.appendChild ( getFeatureElement );
223
+ QDomElement getFeatureFormatElement = doc.createElement ( QStringLiteral ( " ResultFormat" ) );/* wfs:ResultFormat*/
224
+ getFeatureElement.appendChild ( getFeatureFormatElement );
225
+ QDomElement gmlFormatElement = doc.createElement ( QStringLiteral ( " GML2" ) );/* wfs:GML2*/
226
+ getFeatureFormatElement.appendChild ( gmlFormatElement );
227
+ QDomElement gml3FormatElement = doc.createElement ( QStringLiteral ( " GML3" ) );/* wfs:GML3*/
228
+ getFeatureFormatElement.appendChild ( gml3FormatElement );
229
+ QDomElement geojsonFormatElement = doc.createElement ( QStringLiteral ( " GeoJSON" ) );/* wfs:GeoJSON*/
230
+ getFeatureFormatElement.appendChild ( geojsonFormatElement );
231
+ QDomElement getFeatureDhcTypeGetElement = dcpTypeElement.cloneNode ().toElement ();// this is the same as for 'GetCapabilities'
232
+ getFeatureElement.appendChild ( getFeatureDhcTypeGetElement );
233
+ QDomElement getFeatureDhcTypePostElement = dcpTypeElement.cloneNode ().toElement ();// this is the same as for 'GetCapabilities'
234
+ getFeatureDhcTypePostElement.firstChild ().firstChild ().toElement ().setTagName ( QStringLiteral ( " Post" ) );
235
+ getFeatureElement.appendChild ( getFeatureDhcTypePostElement );
236
+
237
+ // wfs:Transaction
238
+ QDomElement transactionElement = doc.createElement ( QStringLiteral ( " Transaction" )/* wfs:Transaction*/ );
239
+ requestElement.appendChild ( transactionElement );
240
+ QDomElement transactionDhcTypeElement = dcpTypeElement.cloneNode ().toElement ();// this is the same as for 'GetCapabilities'
241
+ transactionDhcTypeElement.firstChild ().firstChild ().toElement ().setTagName ( QStringLiteral ( " Post" ) );
242
+ transactionElement.appendChild ( transactionDhcTypeElement );
243
+
244
+ return capabilityElement;
245
+ }
246
+
241
247
QDomElement getFeatureTypeListElement ( QDomDocument &doc, QgsServerInterface *serverIface, const QgsProject *project )
242
248
{
243
249
QgsAccessControl *accessControl = serverIface->accessControls ();
0 commit comments