Skip to content
Permalink
Browse files

Cleaning GetCapabilities response

Fixes #18197
  • Loading branch information
pblottiere committed Apr 13, 2018
1 parent 91a229b commit 0edb0d9858fd05491b5dd6ece9a9859e8d4730d5
Showing with 22 additions and 23 deletions.
  1. +22 −23 src/server/services/wms/qgswmsgetcapabilities.cpp
@@ -756,40 +756,39 @@ namespace QgsWms

QDomElement layerParentElem = doc.createElement( QStringLiteral( "Layer" ) );

// Root Layer title
QDomElement layerParentTitleElem = doc.createElement( QStringLiteral( "Title" ) );
QDomText layerParentTitleText = doc.createTextNode( project->title() );
layerParentTitleElem.appendChild( layerParentTitleText );
layerParentElem.appendChild( layerParentTitleElem );

// Root Layer abstract
QDomElement layerParentAbstElem = doc.createElement( QStringLiteral( "Abstract" ) );
QDomText layerParentAbstText = doc.createTextNode( project->title() );
layerParentAbstElem.appendChild( layerParentAbstText );
layerParentElem.appendChild( layerParentAbstElem );
if ( !project->title().isEmpty() )
{
// Root Layer title
QDomElement layerParentTitleElem = doc.createElement( QStringLiteral( "Title" ) );
QDomText layerParentTitleText = doc.createTextNode( project->title() );
layerParentTitleElem.appendChild( layerParentTitleText );
layerParentElem.appendChild( layerParentTitleElem );

// Root Layer abstract
QDomElement layerParentAbstElem = doc.createElement( QStringLiteral( "Abstract" ) );
QDomText layerParentAbstText = doc.createTextNode( project->title() );
layerParentAbstElem.appendChild( layerParentAbstText );
layerParentElem.appendChild( layerParentAbstElem );
}

// Root Layer name
QDomElement layerParentNameElem = doc.createElement( QStringLiteral( "Name" ) );
QString rootName = QgsServerProjectUtils::wmsRootName( *project );
if ( rootName.isEmpty() )
QString rootLayerName = QgsServerProjectUtils::wmsRootName( *project );
if ( rootLayerName.isEmpty() && !project->title().isEmpty() )
{
QDomText layerParentNameText = doc.createTextNode( project->title() );
layerParentNameElem.appendChild( layerParentNameText );
rootLayerName = project->title();
}
else

if ( !rootLayerName.isEmpty() )
{
QDomText layerParentNameText = doc.createTextNode( rootName );
QDomElement layerParentNameElem = doc.createElement( QStringLiteral( "Name" ) );
QDomText layerParentNameText = doc.createTextNode( rootLayerName );
layerParentNameElem.appendChild( layerParentNameText );
layerParentElem.appendChild( layerParentNameElem );
}
layerParentElem.appendChild( layerParentNameElem );

// Keyword list
addKeywordListElement( project, doc, layerParentElem );

// Metadata (empty but needed for OGC tests RECOMMENDATIONS)
QDomElement metaUrlElem = doc.createElement( QStringLiteral( "MetadataURL" ) );
layerParentElem.appendChild( metaUrlElem );

// Root Layer tree name
if ( projectSettings )
{

0 comments on commit 0edb0d9

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