Skip to content

Commit

Permalink
Support different xml root element for feature info response (WMSFeat…
Browse files Browse the repository at this point in the history
…ureInfoDocumentName)
  • Loading branch information
mhugent committed Jan 18, 2012
1 parent 828ee7e commit 778afc5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/mapserver/qgsconfigparser.h
Expand Up @@ -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;
Expand Down
15 changes: 15 additions & 0 deletions src/mapserver/qgsprojectparser.cpp
Expand Up @@ -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( "../" ) )
Expand Down
2 changes: 2 additions & 0 deletions src/mapserver/qgsprojectparser.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/mapserver/qgswmsserver.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit 778afc5

Please sign in to comment.