Skip to content

Commit

Permalink
Cleaning GetCapabilities response
Browse files Browse the repository at this point in the history
Fixes #18197
  • Loading branch information
pblottiere committed Apr 13, 2018
1 parent 91a229b commit 0edb0d9
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions src/server/services/wms/qgswmsgetcapabilities.cpp
Expand Up @@ -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 )
{
Expand Down

0 comments on commit 0edb0d9

Please sign in to comment.