Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Improve capabilities output for layer groups. CRS and bounding box ne…
…ed to be listed before child layers (wms capabilities schema 1.3)
  • Loading branch information
Marco Hugentobler committed Jul 18, 2011
1 parent 40cabbd commit 5e45f7f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
19 changes: 16 additions & 3 deletions src/mapserver/qgsconfigparser.cpp
Expand Up @@ -103,7 +103,6 @@ void QgsConfigParser::appendExGeographicBoundingBox( QDomElement& layerElem,
QDomText nBoundLatitudeText = doc.createTextNode( QString::number( wgs84BoundingRect.yMaximum() ) );
nBoundLatitudeElement.appendChild( nBoundLatitudeText );
ExGeoBBoxElement.appendChild( nBoundLatitudeElement );
layerElem.appendChild( ExGeoBBoxElement );

//BoundingBox element
QDomElement bBoxElement = doc.createElement( "BoundingBox" );
Expand All @@ -116,7 +115,18 @@ void QgsConfigParser::appendExGeographicBoundingBox( QDomElement& layerElem,
bBoxElement.setAttribute( "miny", QString::number( layerExtent.yMinimum() ) );
bBoxElement.setAttribute( "maxx", QString::number( layerExtent.xMaximum() ) );
bBoxElement.setAttribute( "maxy", QString::number( layerExtent.yMaximum() ) );
layerElem.appendChild( bBoxElement );

QDomElement lastCRSElem = layerElem.lastChildElement( "CRS" );
if ( !lastCRSElem.isNull() )
{
layerElem.insertAfter( ExGeoBBoxElement, lastCRSElem );
layerElem.insertAfter( bBoxElement, ExGeoBBoxElement );
}
else
{
layerElem.appendChild( ExGeoBBoxElement );
layerElem.appendChild( bBoxElement );
}
}

QStringList QgsConfigParser::createCRSListForLayer( QgsMapLayer* theMapLayer ) const
Expand Down Expand Up @@ -242,6 +252,9 @@ void QgsConfigParser::appendCRSElementsToLayer( QDomElement& layerElement, QDomD
return;
}

//insert the CRS elements after the title element to be in accordance with the WMS 1.3 specification
QDomElement titleElement = layerElement.firstChildElement( "Title" );

//In case the number of advertised CRS is constrained
QSet<QString> crsSet = supportedOutputCrsSet();

Expand All @@ -255,7 +268,7 @@ void QgsConfigParser::appendCRSElementsToLayer( QDomElement& layerElement, QDomD
QDomElement crsElement = doc.createElement( "CRS" );
QDomText crsText = doc.createTextNode( *crsIt );
crsElement.appendChild( crsText );
layerElement.appendChild( crsElement );
layerElement.insertAfter( crsElement, titleElement );
}
}

Expand Down
10 changes: 0 additions & 10 deletions src/mapserver/qgsprojectparser.cpp
Expand Up @@ -272,9 +272,6 @@ void QgsProjectParser::addLayers( QDomDocument &doc,
titleElem.appendChild( titleText );
layerElem.appendChild( titleElem );

QDomElement abstractElem = doc.createElement( "Abstract" );
layerElem.appendChild( abstractElem );

//CRS
QStringList crsList = createCRSListForLayer( currentLayer );
appendCRSElementsToLayer( layerElem, doc, crsList );
Expand Down Expand Up @@ -307,13 +304,6 @@ void QgsProjectParser::addLayers( QDomDocument &doc,
continue;
}

#if 0
QString buf;
QTextStream s( &buf );
layerElem.save( s, 0 );
QgsDebugMsg( QString( "adding layer: %1" ).arg( buf ) );
#endif

parentElem.appendChild( layerElem );
}
}
Expand Down

0 comments on commit 5e45f7f

Please sign in to comment.