Skip to content
Permalink
Browse files

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
Marco Hugentobler committed Jul 18, 2011
1 parent 40cabbd commit 5e45f7f92e3636f9ef6a0f03dc4e4df72a613117
Showing with 16 additions and 13 deletions.
  1. +16 −3 src/mapserver/qgsconfigparser.cpp
  2. +0 −10 src/mapserver/qgsprojectparser.cpp
@@ -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" );
@@ -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
@@ -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();

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

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

0 comments on commit 5e45f7f

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