Skip to content

Commit 1b9d8ee

Browse files
committedOct 12, 2017
[Server][WFS,1.1.0] Add layout for WFS supports
1 parent d97a51b commit 1b9d8ee

File tree

5 files changed

+479
-2
lines changed

5 files changed

+479
-2
lines changed
 

‎src/server/services/wfs/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ SET (wfs_SRCS
66
qgswfs.cpp
77
qgswfsutils.cpp
88
qgswfsgetcapabilities.cpp
9+
qgswfsgetcapabilities_1_0_0.cpp
910
qgswfsdescribefeaturetype.cpp
1011
qgswfsgetfeature.cpp
1112
qgswfstransaction.cpp

‎src/server/services/wfs/qgswfs.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "qgsmodule.h"
2424
#include "qgswfsutils.h"
2525
#include "qgswfsgetcapabilities.h"
26+
#include "qgswfsgetcapabilities_1_0_0.h"
2627
#include "qgswfsgetfeature.h"
2728
#include "qgswfsdescribefeaturetype.h"
2829
#include "qgswfstransaction.h"
@@ -71,7 +72,15 @@ namespace QgsWfs
7172

7273
if ( QSTR_COMPARE( req, "GetCapabilities" ) )
7374
{
74-
writeGetCapabilities( mServerIface, project, versionString, request, response );
75+
// Supports WFS 1.0.0
76+
if ( QSTR_COMPARE( versionString, "1.0.0" ) )
77+
{
78+
v1_0_0::writeGetCapabilities( mServerIface, project, versionString, request, response );
79+
}
80+
else
81+
{
82+
writeGetCapabilities( mServerIface, project, versionString, request, response );
83+
}
7584
}
7685
else if ( QSTR_COMPARE( req, "GetFeature" ) )
7786
{
Lines changed: 402 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,402 @@
1+
/***************************************************************************
2+
qgswfsgecapabilities_1_0_0.cpp
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+
#include "qgswfsutils.h"
23+
#include "qgsserverprojectutils.h"
24+
#include "qgswfsgetcapabilities_1_0_0.h"
25+
26+
#include "qgsproject.h"
27+
#include "qgsexception.h"
28+
#include "qgsvectorlayer.h"
29+
#include "qgsvectordataprovider.h"
30+
#include "qgsmapserviceexception.h"
31+
#include "qgscoordinatereferencesystem.h"
32+
33+
#include <QStringList>
34+
35+
namespace QgsWfs
36+
{
37+
namespace v1_0_0
38+
{
39+
40+
/**
41+
* Output WFS GetCapabilities response
42+
*/
43+
void writeGetCapabilities( QgsServerInterface *serverIface, const QgsProject *project, const QString &version,
44+
const QgsServerRequest &request, QgsServerResponse &response )
45+
{
46+
QDomDocument doc = createGetCapabilitiesDocument( serverIface, project, version, request );
47+
48+
response.setHeader( "Content-Type", "text/xml; charset=utf-8" );
49+
response.write( doc.toByteArray() );
50+
}
51+
52+
53+
QDomDocument createGetCapabilitiesDocument( QgsServerInterface *serverIface, const QgsProject *project, const QString &version,
54+
const QgsServerRequest &request )
55+
{
56+
Q_UNUSED( version );
57+
58+
QDomDocument doc;
59+
60+
//wfs:WFS_Capabilities element
61+
QDomElement wfsCapabilitiesElement = doc.createElement( QStringLiteral( "WFS_Capabilities" )/*wms:WFS_Capabilities*/ );
62+
wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns" ), WFS_NAMESPACE );
63+
wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:xsi" ), QStringLiteral( "http://www.w3.org/2001/XMLSchema-instance" ) );
64+
wfsCapabilitiesElement.setAttribute( QStringLiteral( "xsi:schemaLocation" ), WFS_NAMESPACE + " http://schemas.opengis.net/wfs/1.0.0/WFS-capabilities.xsd" );
65+
wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:ogc" ), OGC_NAMESPACE );
66+
wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:gml" ), GML_NAMESPACE );
67+
wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:ows" ), QStringLiteral( "http://www.opengis.net/ows" ) );
68+
wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:xlink" ), QStringLiteral( "http://www.w3.org/1999/xlink" ) );
69+
wfsCapabilitiesElement.setAttribute( QStringLiteral( "version" ), implementationVersion() );
70+
wfsCapabilitiesElement.setAttribute( QStringLiteral( "updateSequence" ), QStringLiteral( "0" ) );
71+
doc.appendChild( wfsCapabilitiesElement );
72+
73+
//wfs:Service
74+
wfsCapabilitiesElement.appendChild( getServiceElement( doc, project ) );
75+
76+
//wfs:Capability
77+
wfsCapabilitiesElement.appendChild( getCapabilityElement( doc, project, request ) );
78+
79+
//wfs:FeatureTypeList
80+
wfsCapabilitiesElement.appendChild( getFeatureTypeListElement( doc, serverIface, project ) );
81+
82+
/*
83+
* Adding ogc:Filter_Capabilities in wfsCapabilitiesElement
84+
*/
85+
//ogc:Filter_Capabilities element
86+
QDomElement filterCapabilitiesElement = doc.createElement( QStringLiteral( "ogc:Filter_Capabilities" )/*ogc:Filter_Capabilities*/ );
87+
wfsCapabilitiesElement.appendChild( filterCapabilitiesElement );
88+
QDomElement spatialCapabilitiesElement = doc.createElement( QStringLiteral( "ogc:Spatial_Capabilities" )/*ogc:Spatial_Capabilities*/ );
89+
filterCapabilitiesElement.appendChild( spatialCapabilitiesElement );
90+
QDomElement spatialOperatorsElement = doc.createElement( QStringLiteral( "ogc:Spatial_Operators" )/*ogc:Spatial_Operators*/ );
91+
spatialCapabilitiesElement.appendChild( spatialOperatorsElement );
92+
spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:BBOX" )/*ogc:BBOX*/ ) );
93+
spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Disjoint" )/*ogc:Disjoint*/ ) );
94+
spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Intersect" )/*ogc:Intersects*/ ) );
95+
spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Touches" )/*ogc:Touches*/ ) );
96+
spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Crosses" )/*ogc:Crosses*/ ) );
97+
spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Contains" )/*ogc:Contains*/ ) );
98+
spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Overlaps" )/*ogc:Overlaps*/ ) );
99+
spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Within" )/*ogc:Within*/ ) );
100+
QDomElement scalarCapabilitiesElement = doc.createElement( QStringLiteral( "ogc:Scalar_Capabilities" )/*ogc:Scalar_Capabilities*/ );
101+
filterCapabilitiesElement.appendChild( scalarCapabilitiesElement );
102+
QDomElement comparisonOperatorsElement = doc.createElement( QStringLiteral( "ogc:Comparison_Operators" )/*ogc:Comparison_Operators*/ );
103+
scalarCapabilitiesElement.appendChild( comparisonOperatorsElement );
104+
comparisonOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Simple_Comparisons" )/*ogc:Simple_Comparisons*/ ) );
105+
comparisonOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Between" )/*ogc:Between*/ ) );
106+
comparisonOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Like" )/*ogc:Like*/ ) );
107+
108+
return doc;
109+
110+
}
111+
112+
QDomElement getServiceElement( QDomDocument &doc, const QgsProject *project )
113+
{
114+
//Service element
115+
QDomElement serviceElem = doc.createElement( QStringLiteral( "Service" ) );
116+
117+
//Service name
118+
QDomElement nameElem = doc.createElement( QStringLiteral( "Name" ) );
119+
QDomText nameText = doc.createTextNode( "WFS" );
120+
nameElem.appendChild( nameText );
121+
serviceElem.appendChild( nameElem );
122+
123+
QString title = QgsServerProjectUtils::owsServiceTitle( *project );
124+
if ( !title.isEmpty() )
125+
{
126+
QDomElement titleElem = doc.createElement( QStringLiteral( "Title" ) );
127+
QDomText titleText = doc.createTextNode( title );
128+
titleElem.appendChild( titleText );
129+
serviceElem.appendChild( titleElem );
130+
}
131+
132+
QString abstract = QgsServerProjectUtils::owsServiceAbstract( *project );
133+
if ( !abstract.isEmpty() )
134+
{
135+
QDomElement abstractElem = doc.createElement( QStringLiteral( "Abstract" ) );
136+
QDomText abstractText = doc.createCDATASection( abstract );
137+
abstractElem.appendChild( abstractText );
138+
serviceElem.appendChild( abstractElem );
139+
}
140+
141+
QStringList keywords = QgsServerProjectUtils::owsServiceKeywords( *project );
142+
if ( !keywords.isEmpty() && !keywords.join( QStringLiteral( ", " ) ).isEmpty() )
143+
{
144+
QDomElement keywordsElem = doc.createElement( QStringLiteral( "Keywords" ) );
145+
QDomText keywordsText = doc.createTextNode( keywords.join( QStringLiteral( ", " ) ) );
146+
keywordsElem.appendChild( keywordsText );
147+
serviceElem.appendChild( keywordsElem );
148+
}
149+
150+
QDomElement onlineResourceElem = doc.createElement( QStringLiteral( "OnlineResource" ) );
151+
QString onlineResource = QgsServerProjectUtils::owsServiceOnlineResource( *project );
152+
if ( !onlineResource.isEmpty() )
153+
{
154+
QDomText onlineResourceText = doc.createTextNode( onlineResource );
155+
onlineResourceElem.appendChild( onlineResourceText );
156+
}
157+
serviceElem.appendChild( onlineResourceElem );
158+
159+
QString fees = QgsServerProjectUtils::owsServiceFees( *project );
160+
if ( !fees.isEmpty() )
161+
{
162+
QDomElement feesElem = doc.createElement( QStringLiteral( "Fees" ) );
163+
QDomText feesText = doc.createTextNode( fees );
164+
feesElem.appendChild( feesText );
165+
serviceElem.appendChild( feesElem );
166+
}
167+
168+
QString accessConstraints = QgsServerProjectUtils::owsServiceAccessConstraints( *project );
169+
if ( !accessConstraints.isEmpty() )
170+
{
171+
QDomElement accessConstraintsElem = doc.createElement( QStringLiteral( "AccessConstraints" ) );
172+
QDomText accessConstraintsText = doc.createTextNode( accessConstraints );
173+
accessConstraintsElem.appendChild( accessConstraintsText );
174+
serviceElem.appendChild( accessConstraintsElem );
175+
}
176+
177+
return serviceElem;
178+
179+
}
180+
181+
QDomElement getCapabilityElement( QDomDocument &doc, const QgsProject *project, const QgsServerRequest &request )
182+
{
183+
//wfs:Capability element
184+
QDomElement capabilityElement = doc.createElement( QStringLiteral( "Capability" )/*wfs:Capability*/ );
185+
186+
//wfs:Request element
187+
QDomElement requestElement = doc.createElement( QStringLiteral( "Request" )/*wfs:Request*/ );
188+
capabilityElement.appendChild( requestElement );
189+
//wfs:GetCapabilities
190+
QDomElement getCapabilitiesElement = doc.createElement( QStringLiteral( "GetCapabilities" )/*wfs:GetCapabilities*/ );
191+
requestElement.appendChild( getCapabilitiesElement );
192+
193+
QDomElement dcpTypeElement = doc.createElement( QStringLiteral( "DCPType" )/*wfs:DCPType*/ );
194+
getCapabilitiesElement.appendChild( dcpTypeElement );
195+
QDomElement httpElement = doc.createElement( QStringLiteral( "HTTP" )/*wfs:HTTP*/ );
196+
dcpTypeElement.appendChild( httpElement );
197+
198+
//Prepare url
199+
QString hrefString = serviceUrl( request, project );
200+
201+
//only Get supported for the moment
202+
QDomElement getElement = doc.createElement( QStringLiteral( "Get" )/*wfs:Get*/ );
203+
httpElement.appendChild( getElement );
204+
getElement.setAttribute( QStringLiteral( "onlineResource" ), hrefString );
205+
QDomElement getCapabilitiesDhcTypePostElement = dcpTypeElement.cloneNode().toElement();//this is the same as for 'GetCapabilities'
206+
getCapabilitiesDhcTypePostElement.firstChild().firstChild().toElement().setTagName( QStringLiteral( "Post" ) );
207+
getCapabilitiesElement.appendChild( getCapabilitiesDhcTypePostElement );
208+
209+
//wfs:DescribeFeatureType
210+
QDomElement describeFeatureTypeElement = doc.createElement( QStringLiteral( "DescribeFeatureType" )/*wfs:DescribeFeatureType*/ );
211+
requestElement.appendChild( describeFeatureTypeElement );
212+
QDomElement schemaDescriptionLanguageElement = doc.createElement( QStringLiteral( "SchemaDescriptionLanguage" )/*wfs:SchemaDescriptionLanguage*/ );
213+
describeFeatureTypeElement.appendChild( schemaDescriptionLanguageElement );
214+
QDomElement xmlSchemaElement = doc.createElement( QStringLiteral( "XMLSCHEMA" )/*wfs:XMLSCHEMA*/ );
215+
schemaDescriptionLanguageElement.appendChild( xmlSchemaElement );
216+
QDomElement describeFeatureTypeDhcTypeElement = dcpTypeElement.cloneNode().toElement();//this is the same as for 'GetCapabilities'
217+
describeFeatureTypeElement.appendChild( describeFeatureTypeDhcTypeElement );
218+
QDomElement describeFeatureTypeDhcTypePostElement = dcpTypeElement.cloneNode().toElement();//this is the same as for 'GetCapabilities'
219+
describeFeatureTypeDhcTypePostElement.firstChild().firstChild().toElement().setTagName( QStringLiteral( "Post" ) );
220+
describeFeatureTypeElement.appendChild( describeFeatureTypeDhcTypePostElement );
221+
222+
//wfs:GetFeature
223+
QDomElement getFeatureElement = doc.createElement( QStringLiteral( "GetFeature" )/*wfs:GetFeature*/ );
224+
requestElement.appendChild( getFeatureElement );
225+
QDomElement getFeatureFormatElement = doc.createElement( QStringLiteral( "ResultFormat" ) );/*wfs:ResultFormat*/
226+
getFeatureElement.appendChild( getFeatureFormatElement );
227+
QDomElement gmlFormatElement = doc.createElement( QStringLiteral( "GML2" ) );/*wfs:GML2*/
228+
getFeatureFormatElement.appendChild( gmlFormatElement );
229+
QDomElement gml3FormatElement = doc.createElement( QStringLiteral( "GML3" ) );/*wfs:GML3*/
230+
getFeatureFormatElement.appendChild( gml3FormatElement );
231+
QDomElement geojsonFormatElement = doc.createElement( QStringLiteral( "GeoJSON" ) );/*wfs:GeoJSON*/
232+
getFeatureFormatElement.appendChild( geojsonFormatElement );
233+
QDomElement getFeatureDhcTypeGetElement = dcpTypeElement.cloneNode().toElement();//this is the same as for 'GetCapabilities'
234+
getFeatureElement.appendChild( getFeatureDhcTypeGetElement );
235+
QDomElement getFeatureDhcTypePostElement = dcpTypeElement.cloneNode().toElement();//this is the same as for 'GetCapabilities'
236+
getFeatureDhcTypePostElement.firstChild().firstChild().toElement().setTagName( QStringLiteral( "Post" ) );
237+
getFeatureElement.appendChild( getFeatureDhcTypePostElement );
238+
239+
//wfs:Transaction
240+
QDomElement transactionElement = doc.createElement( QStringLiteral( "Transaction" )/*wfs:Transaction*/ );
241+
requestElement.appendChild( transactionElement );
242+
QDomElement transactionDhcTypeElement = dcpTypeElement.cloneNode().toElement();//this is the same as for 'GetCapabilities'
243+
transactionDhcTypeElement.firstChild().firstChild().toElement().setTagName( QStringLiteral( "Post" ) );
244+
transactionElement.appendChild( transactionDhcTypeElement );
245+
246+
return capabilityElement;
247+
}
248+
249+
QDomElement getFeatureTypeListElement( QDomDocument &doc, QgsServerInterface *serverIface, const QgsProject *project )
250+
{
251+
QgsAccessControl *accessControl = serverIface->accessControls();
252+
253+
//wfs:FeatureTypeList element
254+
QDomElement featureTypeListElement = doc.createElement( QStringLiteral( "FeatureTypeList" )/*wfs:FeatureTypeList*/ );
255+
//wfs:Operations element
256+
QDomElement operationsElement = doc.createElement( QStringLiteral( "Operations" )/*wfs:Operations*/ );
257+
featureTypeListElement.appendChild( operationsElement );
258+
//wfs:Query element
259+
QDomElement queryElement = doc.createElement( QStringLiteral( "Query" )/*wfs:Query*/ );
260+
operationsElement.appendChild( queryElement );
261+
262+
QStringList wfsLayerIds = QgsServerProjectUtils::wfsLayerIds( *project );
263+
QStringList wfstUpdateLayersId = QgsServerProjectUtils::wfstUpdateLayerIds( *project );
264+
QStringList wfstInsertLayersId = QgsServerProjectUtils::wfstInsertLayerIds( *project );
265+
QStringList wfstDeleteLayersId = QgsServerProjectUtils::wfstDeleteLayerIds( *project );
266+
for ( int i = 0; i < wfsLayerIds.size(); ++i )
267+
{
268+
QgsMapLayer *layer = project->mapLayer( wfsLayerIds.at( i ) );
269+
if ( layer->type() != QgsMapLayer::LayerType::VectorLayer )
270+
{
271+
continue;
272+
}
273+
if ( accessControl && !accessControl->layerReadPermission( layer ) )
274+
{
275+
continue;
276+
}
277+
278+
QDomElement layerElem = doc.createElement( QStringLiteral( "FeatureType" ) );
279+
280+
//create Name
281+
QDomElement nameElem = doc.createElement( QStringLiteral( "Name" ) );
282+
QString typeName = layer->name();
283+
if ( !layer->shortName().isEmpty() )
284+
typeName = layer->shortName();
285+
typeName = typeName.replace( QLatin1String( " " ), QLatin1String( "_" ) );
286+
QDomText nameText = doc.createTextNode( typeName );
287+
nameElem.appendChild( nameText );
288+
layerElem.appendChild( nameElem );
289+
290+
//create Title
291+
QDomElement titleElem = doc.createElement( QStringLiteral( "Title" ) );
292+
QString title = layer->title();
293+
if ( title.isEmpty() )
294+
{
295+
title = layer->name();
296+
}
297+
QDomText titleText = doc.createTextNode( title );
298+
titleElem.appendChild( titleText );
299+
layerElem.appendChild( titleElem );
300+
301+
//create Abstract
302+
QString abstract = layer->abstract();
303+
if ( !abstract.isEmpty() )
304+
{
305+
QDomElement abstractElem = doc.createElement( QStringLiteral( "Abstract" ) );
306+
QDomText abstractText = doc.createTextNode( abstract );
307+
abstractElem.appendChild( abstractText );
308+
layerElem.appendChild( abstractElem );
309+
}
310+
311+
//create keywords
312+
QString keywords = layer->keywordList();
313+
if ( !keywords.isEmpty() )
314+
{
315+
QDomElement keywordsElem = doc.createElement( QStringLiteral( "Keywords" ) );
316+
QDomText keywordsText = doc.createTextNode( keywords );
317+
keywordsElem.appendChild( keywordsText );
318+
layerElem.appendChild( keywordsElem );
319+
}
320+
321+
//create SRS
322+
QDomElement srsElem = doc.createElement( QStringLiteral( "SRS" ) );
323+
QDomText srsText = doc.createTextNode( layer->crs().authid() );
324+
srsElem.appendChild( srsText );
325+
layerElem.appendChild( srsElem );
326+
327+
//create LatLongBoundingBox
328+
QgsRectangle layerExtent = layer->extent();
329+
QDomElement bBoxElement = doc.createElement( QStringLiteral( "LatLongBoundingBox" ) );
330+
bBoxElement.setAttribute( QStringLiteral( "minx" ), QString::number( layerExtent.xMinimum() ) );
331+
bBoxElement.setAttribute( QStringLiteral( "miny" ), QString::number( layerExtent.yMinimum() ) );
332+
bBoxElement.setAttribute( QStringLiteral( "maxx" ), QString::number( layerExtent.xMaximum() ) );
333+
bBoxElement.setAttribute( QStringLiteral( "maxy" ), QString::number( layerExtent.yMaximum() ) );
334+
layerElem.appendChild( bBoxElement );
335+
336+
// layer metadata URL
337+
QString metadataUrl = layer->metadataUrl();
338+
if ( !metadataUrl.isEmpty() )
339+
{
340+
QDomElement metaUrlElem = doc.createElement( QStringLiteral( "MetadataURL" ) );
341+
QString metadataUrlType = layer->metadataUrlType();
342+
metaUrlElem.setAttribute( QStringLiteral( "type" ), metadataUrlType );
343+
QString metadataUrlFormat = layer->metadataUrlFormat();
344+
if ( metadataUrlFormat == QLatin1String( "text/xml" ) )
345+
{
346+
metaUrlElem.setAttribute( QStringLiteral( "format" ), QStringLiteral( "XML" ) );
347+
}
348+
else
349+
{
350+
metaUrlElem.setAttribute( QStringLiteral( "format" ), QStringLiteral( "TXT" ) );
351+
}
352+
QDomText metaUrlText = doc.createTextNode( metadataUrl );
353+
metaUrlElem.appendChild( metaUrlText );
354+
layerElem.appendChild( metaUrlElem );
355+
}
356+
357+
//wfs:Operations element
358+
QDomElement operationsElement = doc.createElement( QStringLiteral( "Operations" )/*wfs:Operations*/ );
359+
//wfs:Query element
360+
QDomElement queryElement = doc.createElement( QStringLiteral( "Query" )/*wfs:Query*/ );
361+
operationsElement.appendChild( queryElement );
362+
if ( wfstUpdateLayersId.contains( layer->id() ) ||
363+
wfstInsertLayersId.contains( layer->id() ) ||
364+
wfstDeleteLayersId.contains( layer->id() ) )
365+
{
366+
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
367+
QgsVectorDataProvider *provider = vlayer->dataProvider();
368+
if ( ( provider->capabilities() & QgsVectorDataProvider::AddFeatures ) && wfstInsertLayersId.contains( layer->id() ) )
369+
{
370+
//wfs:Insert element
371+
QDomElement insertElement = doc.createElement( QStringLiteral( "Insert" )/*wfs:Insert*/ );
372+
operationsElement.appendChild( insertElement );
373+
}
374+
if ( ( provider->capabilities() & QgsVectorDataProvider::ChangeAttributeValues ) &&
375+
( provider->capabilities() & QgsVectorDataProvider::ChangeGeometries ) &&
376+
wfstUpdateLayersId.contains( layer->id() ) )
377+
{
378+
//wfs:Update element
379+
QDomElement updateElement = doc.createElement( QStringLiteral( "Update" )/*wfs:Update*/ );
380+
operationsElement.appendChild( updateElement );
381+
}
382+
if ( ( provider->capabilities() & QgsVectorDataProvider::DeleteFeatures ) && wfstDeleteLayersId.contains( layer->id() ) )
383+
{
384+
//wfs:Delete element
385+
QDomElement deleteElement = doc.createElement( QStringLiteral( "Delete" )/*wfs:Delete*/ );
386+
operationsElement.appendChild( deleteElement );
387+
}
388+
}
389+
390+
layerElem.appendChild( operationsElement );
391+
392+
featureTypeListElement.appendChild( layerElem );
393+
}
394+
395+
return featureTypeListElement;
396+
}
397+
398+
} // namespace v1_0_0
399+
} // namespace QgsWfs
400+
401+
402+
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/***************************************************************************
2+
qgswfsgecapabilities_1_0_0.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 QGSWFSGETCAPABILITIES_1_0_0_H
23+
#define QGSWFSGETCAPABILITIES_1_0_0_H
24+
25+
#include <QDomDocument>
26+
27+
namespace QgsWfs
28+
{
29+
namespace v1_0_0
30+
{
31+
32+
/**
33+
* Create FeatureTypeList element for get capabilities document
34+
*/
35+
QDomElement getFeatureTypeListElement( QDomDocument &doc, QgsServerInterface *serverIface, const QgsProject *project );
36+
37+
/**
38+
* Create Capability element for get capabilities document
39+
*/
40+
QDomElement getCapabilityElement( QDomDocument &doc, const QgsProject *project, const QgsServerRequest &request );
41+
42+
/**
43+
* Create Service element for get capabilities document
44+
*/
45+
QDomElement getServiceElement( QDomDocument &doc, const QgsProject *project );
46+
47+
/**
48+
* Create get capabilities document
49+
*/
50+
QDomDocument createGetCapabilitiesDocument( QgsServerInterface *serverIface,
51+
const QgsProject *project, const QString &version,
52+
const QgsServerRequest &request );
53+
54+
/**
55+
* Output WFS GetCapabilities response
56+
*/
57+
void writeGetCapabilities( QgsServerInterface *serverIface, const QgsProject *project,
58+
const QString &version, const QgsServerRequest &request,
59+
QgsServerResponse &response );
60+
61+
} // namespace v1_0_0
62+
} // namespace QgsWfs
63+
64+
#endif
65+

‎src/server/services/wfs/qgswfsutils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace QgsWfs
2929
{
3030
QString implementationVersion()
3131
{
32-
return QStringLiteral( "1.0.0" );
32+
return QStringLiteral( "1.1.0" );
3333
}
3434

3535
QString serviceUrl( const QgsServerRequest &request, const QgsProject *project )

0 commit comments

Comments
 (0)
Please sign in to comment.