Skip to content
Permalink
Browse files

Support different xml root element for feature info response (WMSFeat…

…ureInfoDocumentName)
  • Loading branch information
mhugent committed Jan 18, 2012
1 parent 828ee7e commit 778afc5aa6426717fa2a462a01dee3abfdae3427
@@ -116,6 +116,8 @@ class QgsConfigParser
/**Returns map with layer aliases for GetFeatureInfo (or 0 pointer if not supported). Key: layer name, Value: layer alias*/
virtual QHash<QString, QString> featureInfoLayerAliasMap() const { return QHash<QString, QString>(); }

virtual QString featureInfoDocumentName( const QString& defaultValue ) const { return defaultValue; }

protected:
/**Parser to forward not resolved requests (e.g. SLD parser based on user request might have a fallback parser with admin configuration)*/
QgsConfigParser* mFallbackParser;
@@ -1397,6 +1397,21 @@ QHash<QString, QString> QgsProjectParser::featureInfoLayerAliasMap() const
return aliasMap;
}

QString QgsProjectParser::featureInfoDocumentName( const QString& defaultValue ) const
{
QDomElement propertiesElem = mXMLDoc->documentElement().firstChildElement( "properties" );
if ( propertiesElem.isNull() )
{
return defaultValue;
}
QDomElement featureInfoDocumentNameElem = propertiesElem.firstChildElement( "WMSFeatureInfoDocumentName" );
if ( featureInfoDocumentNameElem.isNull() )
{
return defaultValue;
}
return featureInfoDocumentNameElem.text();
}

QString QgsProjectParser::convertToAbsolutePath( const QString& file ) const
{
if ( !file.startsWith( "./" ) && !file.startsWith( "../" ) )
@@ -104,6 +104,8 @@ class QgsProjectParser: public QgsConfigParser
/**Returns map with layer aliases for GetFeatureInfo (or 0 pointer if not supported). Key: layer name, Value: layer alias*/
virtual QHash<QString, QString> featureInfoLayerAliasMap() const;

virtual QString featureInfoDocumentName( const QString& defaultValue ) const;

private:

//forbidden
@@ -803,7 +803,7 @@ int QgsWMSServer::getFeatureInfo( QDomDocument& result, QString version )
QStringList layerIds = layerSet( layersList, stylesList, mMapRenderer->destinationCrs() );
QMap<QString, QString> originalLayerFilters = applyRequestedLayerFilters( layersList );

QDomElement getFeatureInfoElement = result.createElement( "GetFeatureInfoResponse" );
QDomElement getFeatureInfoElement = result.createElement( mConfigParser->featureInfoDocumentName( "GetFeatureInfoResponse" ) );
result.appendChild( getFeatureInfoElement );

QStringList nonIdentifiableLayers = mConfigParser->identifyDisabledLayers();

0 comments on commit 778afc5

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