Skip to content

Commit

Permalink
Fix tag order for root layer tag
Browse files Browse the repository at this point in the history
  • Loading branch information
jgrocha committed Apr 13, 2020
1 parent 1c5b0f7 commit 9a15a3f
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 27 deletions.
45 changes: 18 additions & 27 deletions src/server/services/wms/qgswmsgetcapabilities.cpp
Expand Up @@ -829,22 +829,6 @@ namespace QgsWms

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

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
QString rootLayerName = QgsServerProjectUtils::wmsRootName( *project );
if ( rootLayerName.isEmpty() && !project->title().isEmpty() )
Expand All @@ -860,9 +844,23 @@ namespace QgsWms
layerParentElem.appendChild( layerParentNameElem );
}

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 );
}

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

// Root Layer tree name
if ( projectSettings )
Expand Down Expand Up @@ -1397,7 +1395,8 @@ namespace QgsWms
//insert the CRS elements after the title element to be in accordance with the WMS 1.3 specification
QDomElement titleElement = layerElement.firstChildElement( QStringLiteral( "Title" ) );
QDomElement abstractElement = layerElement.firstChildElement( QStringLiteral( "Abstract" ) );
QDomElement CRSPrecedingElement = abstractElement.isNull() ? titleElement : abstractElement; //last element before the CRS elements
QDomElement keywordListElement = layerElement.firstChildElement( QStringLiteral( "KeywordList" ) );
QDomElement CRSPrecedingElement = !keywordListElement.isNull() ? keywordListElement : !abstractElement.isNull() ? abstractElement : titleElement;

if ( CRSPrecedingElement.isNull() )
{
Expand Down Expand Up @@ -1435,15 +1434,7 @@ namespace QgsWms
QDomElement crsElement = doc.createElement( version == QLatin1String( "1.1.1" ) ? "SRS" : "CRS" );
QDomText crsTextNode = doc.createTextNode( crsText );
crsElement.appendChild( crsTextNode );
if ( !precedingElement.isNull() )
{
layerElement.insertAfter( crsElement, precedingElement );
}
else
{
QDomElement first = layerElement.firstChild().toElement();
layerElement.insertBefore( crsElement, first );
}
layerElement.insertAfter( crsElement, precedingElement );
}

void appendLayerBoundingBoxes( QDomDocument &doc, QDomElement &layerElem, const QgsRectangle &lExtent,
Expand Down
4 changes: 4 additions & 0 deletions tests/testdata/qgis_server/getcapabilities.txt
Expand Up @@ -102,8 +102,12 @@ Content-Type: text/xml; charset=utf-8
</Exception>
<sld:UserDefinedSymbolization SupportSLD="1" RemoteWCS="0" UserLayer="0" InlineFeature="0" RemoteWFS="0" UserStyle="1"/>
<Layer queryable="1">
<Name>QGIS Test Project</Name>
<Title>QGIS Test Project</Title>
<Abstract>QGIS Test Project</Abstract>
<KeywordList>
<Keyword vocabulary="ISO">infoMapAccessService</Keyword>
</KeywordList>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<CRS>EPSG:3857</CRS>
Expand Down
4 changes: 4 additions & 0 deletions tests/testdata/qgis_server/getcapabilities_inspire.txt
Expand Up @@ -123,8 +123,12 @@ Content-Type: text/xml; charset=utf-8
</inspire_common:ResponseLanguage>
</inspire_vs:ExtendedCapabilities>
<Layer queryable="1">
<Name>QGIS Test Project</Name>
<Title>QGIS Test Project</Title>
<Abstract>QGIS Test Project</Abstract>
<KeywordList>
<Keyword vocabulary="ISO">infoMapAccessService</Keyword>
</KeywordList>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<CRS>EPSG:3857</CRS>
Expand Down
4 changes: 4 additions & 0 deletions tests/testdata/qgis_server/getprojectsettings.txt
Expand Up @@ -123,8 +123,12 @@ Content-Type: text/xml; charset=utf-8
<WFSLayer name="testlayer èé"/>
</WFSLayers>
<Layer>
<Name>QGIS Test Project</Name>
<Title>QGIS Test Project</Title>
<Abstract>QGIS Test Project</Abstract>
<KeywordList>
<Keyword vocabulary="ISO">infoMapAccessService</Keyword>
</KeywordList>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<CRS>EPSG:3857</CRS>
Expand Down
4 changes: 4 additions & 0 deletions tests/testdata/qgis_server/getprojectsettings_opacity.txt
Expand Up @@ -123,8 +123,12 @@ Content-Type: text/xml; charset=utf-8
<WFSLayer name="testlayer èé"/>
</WFSLayers>
<Layer>
<Name>QGIS Test Project</Name>
<Title>QGIS Test Project</Title>
<Abstract>QGIS Test Project</Abstract>
<KeywordList>
<Keyword vocabulary="ISO">infoMapAccessService</Keyword>
</KeywordList>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<CRS>EPSG:3857</CRS>
Expand Down
4 changes: 4 additions & 0 deletions tests/testdata/qgis_server/wms_getcapabilities_1_1_1.txt
Expand Up @@ -102,8 +102,12 @@ Content-Type: text/xml; charset=utf-8
<Format>application/vnd.ogc.se_xml</Format>
</Exception>
<Layer queryable="1">
<Name>QGIS Test Project</Name>
<Title>QGIS Test Project</Title>
<Abstract>QGIS Test Project</Abstract>
<KeywordList>
<Keyword vocabulary="ISO">infoMapAccessService</Keyword>
</KeywordList>
<SRS>CRS:84</SRS>
<SRS>EPSG:4326</SRS>
<SRS>EPSG:3857</SRS>
Expand Down
4 changes: 4 additions & 0 deletions tests/testdata/qgis_server/wms_getcapabilities_1_3_0.txt
Expand Up @@ -102,8 +102,12 @@ Content-Type: text/xml; charset=utf-8
</Exception>
<sld:UserDefinedSymbolization SupportSLD="1" RemoteWCS="0" UserLayer="0" InlineFeature="0" RemoteWFS="0" UserStyle="1"/>
<Layer queryable="1">
<Name>QGIS Test Project</Name>
<Title>QGIS Test Project</Title>
<Abstract>QGIS Test Project</Abstract>
<KeywordList>
<Keyword vocabulary="ISO">infoMapAccessService</Keyword>
</KeywordList>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<CRS>EPSG:3857</CRS>
Expand Down
Expand Up @@ -94,6 +94,9 @@ Content-Type: text/xml; charset=utf-8
</Exception>
<sld:UserDefinedSymbolization SupportSLD="1" RemoteWCS="0" UserLayer="0" InlineFeature="0" RemoteWFS="0" UserStyle="1"/>
<Layer queryable="1">
<KeywordList>
<Keyword vocabulary="ISO">infoMapAccessService</Keyword>
</KeywordList>
<CRS>CRS:84</CRS>
<CRS>EPSG:3857</CRS>
<CRS>EPSG:4326</CRS>
Expand Down
Expand Up @@ -94,6 +94,9 @@ Content-Type: text/xml; charset=utf-8
</Exception>
<sld:UserDefinedSymbolization SupportSLD="1" RemoteWCS="0" UserLayer="0" InlineFeature="0" RemoteWFS="0" UserStyle="1"/>
<Layer queryable="1">
<KeywordList>
<Keyword vocabulary="ISO">infoMapAccessService</Keyword>
</KeywordList>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<CRS>EPSG:3857</CRS>
Expand Down
Expand Up @@ -96,6 +96,9 @@ Content-Type: text/xml; charset=utf-8
</Exception>
<sld:UserDefinedSymbolization SupportSLD="1" RemoteWCS="0" UserLayer="0" InlineFeature="0" RemoteWFS="0" UserStyle="1"/>
<Layer queryable="1">
<KeywordList>
<Keyword vocabulary="ISO">infoMapAccessService</Keyword>
</KeywordList>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<CRS>EPSG:3857</CRS>
Expand Down
Expand Up @@ -103,8 +103,12 @@ Content-Type: text/xml; charset=utf-8
</Exception>
<sld:UserDefinedSymbolization UserStyle="1" RemoteWFS="0" RemoteWCS="0" InlineFeature="0" UserLayer="0" SupportSLD="1"/>
<Layer queryable="1">
<Name>QGIS Server WMS Dimensions</Name>
<Title>QGIS Server WMS Dimensions</Title>
<Abstract>QGIS Server WMS Dimensions</Abstract>
<KeywordList>
<Keyword vocabulary="ISO">infoMapAccessService</Keyword>
</KeywordList>
<CRS>CRS:84</CRS>
<CRS>EPSG:3857</CRS>
<CRS>EPSG:4326</CRS>
Expand Down

0 comments on commit 9a15a3f

Please sign in to comment.