Skip to content
Permalink
Browse files

Operations element has to be before OutputFormats

  • Loading branch information
pblottiere committed Sep 18, 2018
1 parent dea3b75 commit e295eb66a71e7509b5ad9852b4782ac04951296b
Showing with 40 additions and 39 deletions.
  1. +40 −39 src/server/services/wfs/qgswfsgetcapabilities.cpp
@@ -525,6 +525,45 @@ namespace QgsWfs
layerElem.appendChild( otherSrsElem );
}

//wfs:Operations element
QDomElement operationsElement = doc.createElement( QStringLiteral( "Operations" )/*wfs:Operations*/ );
//wfs:Query element
// QDomElement queryElement = doc.createElement( QStringLiteral( "Query" )/*wfs:Query*/ );
// operationsElement.appendChild( queryElement );
QDomElement operationElement = doc.createElement( QStringLiteral( "Operation" ) );
QDomText queryText = doc.createTextNode( "Query" );
operationElement.appendChild( queryText );
operationsElement.appendChild( operationElement );
if ( wfstUpdateLayersId.contains( layer->id() ) ||
wfstInsertLayersId.contains( layer->id() ) ||
wfstDeleteLayersId.contains( layer->id() ) )
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
QgsVectorDataProvider *provider = vlayer->dataProvider();
if ( ( provider->capabilities() & QgsVectorDataProvider::AddFeatures ) && wfstInsertLayersId.contains( layer->id() ) )
{
//wfs:Insert element
QDomElement insertElement = doc.createElement( QStringLiteral( "Insert" )/*wfs:Insert*/ );
operationsElement.appendChild( insertElement );
}
if ( ( provider->capabilities() & QgsVectorDataProvider::ChangeAttributeValues ) &&
( provider->capabilities() & QgsVectorDataProvider::ChangeGeometries ) &&
wfstUpdateLayersId.contains( layer->id() ) )
{
//wfs:Update element
QDomElement updateElement = doc.createElement( QStringLiteral( "Update" )/*wfs:Update*/ );
operationsElement.appendChild( updateElement );
}
if ( ( provider->capabilities() & QgsVectorDataProvider::DeleteFeatures ) && wfstDeleteLayersId.contains( layer->id() ) )
{
//wfs:Delete element
QDomElement deleteElement = doc.createElement( QStringLiteral( "Delete" )/*wfs:Delete*/ );
operationsElement.appendChild( deleteElement );
}
}

layerElem.appendChild( operationsElement );

//create OutputFormats element
QDomElement outputFormatsElem = doc.createElement( QStringLiteral( "OutputFormats" ) );
QDomElement outputFormatElem = doc.createElement( QStringLiteral( "Format" ) );
@@ -550,6 +589,7 @@ namespace QgsWfs
wgs84BoundingRect = QgsRectangle();
}
}

//create WGS84BoundingBox element
QDomElement bBoxElement = doc.createElement( QStringLiteral( "ows:WGS84BoundingBox" ) );
bBoxElement.setAttribute( QStringLiteral( "dimensions" ), QStringLiteral( "2" ) );
@@ -577,45 +617,6 @@ namespace QgsWfs
layerElem.appendChild( metaUrlElem );
}

//wfs:Operations element
QDomElement operationsElement = doc.createElement( QStringLiteral( "Operations" )/*wfs:Operations*/ );
//wfs:Query element
// QDomElement queryElement = doc.createElement( QStringLiteral( "Query" )/*wfs:Query*/ );
// operationsElement.appendChild( queryElement );
QDomElement operationElement = doc.createElement( QStringLiteral( "Operation" ) );
QDomText queryText = doc.createTextNode( "Query" );
operationElement.appendChild( queryText );
operationsElement.appendChild( operationElement );
if ( wfstUpdateLayersId.contains( layer->id() ) ||
wfstInsertLayersId.contains( layer->id() ) ||
wfstDeleteLayersId.contains( layer->id() ) )
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
QgsVectorDataProvider *provider = vlayer->dataProvider();
if ( ( provider->capabilities() & QgsVectorDataProvider::AddFeatures ) && wfstInsertLayersId.contains( layer->id() ) )
{
//wfs:Insert element
QDomElement insertElement = doc.createElement( QStringLiteral( "Insert" )/*wfs:Insert*/ );
operationsElement.appendChild( insertElement );
}
if ( ( provider->capabilities() & QgsVectorDataProvider::ChangeAttributeValues ) &&
( provider->capabilities() & QgsVectorDataProvider::ChangeGeometries ) &&
wfstUpdateLayersId.contains( layer->id() ) )
{
//wfs:Update element
QDomElement updateElement = doc.createElement( QStringLiteral( "Update" )/*wfs:Update*/ );
operationsElement.appendChild( updateElement );
}
if ( ( provider->capabilities() & QgsVectorDataProvider::DeleteFeatures ) && wfstDeleteLayersId.contains( layer->id() ) )
{
//wfs:Delete element
QDomElement deleteElement = doc.createElement( QStringLiteral( "Delete" )/*wfs:Delete*/ );
operationsElement.appendChild( deleteElement );
}
}

layerElem.appendChild( operationsElement );

featureTypeListElement.appendChild( layerElem );
}

0 comments on commit e295eb6

Please sign in to comment.
You can’t perform that action at this time.