Skip to content

Commit

Permalink
Possibility to set url for a feature info schema
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Oct 25, 2012
1 parent 1a092f9 commit a622d1b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mapserver/qgsconfigparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ class QgsConfigParser
virtual QString featureInfoDocumentElement( const QString& defaultValue ) const { return defaultValue; }
/**Returns document element namespace in GetFeatureInfo response or empty string*/
virtual QString featureInfoDocumentElementNS() const { return ""; }
/**Returns schema url for feature info xsd (or an empty string if there is no schema)*/
virtual QString featureInfoSchema() const { return ""; }

/**Return feature info in format SIA2045?*/
virtual bool featureInfoFormatSIA2045() const { return false; }
Expand Down
15 changes: 15 additions & 0 deletions src/mapserver/qgsprojectparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1929,6 +1929,21 @@ QString QgsProjectParser::featureInfoDocumentElementNS() const
return featureInfoDocumentNSElem.text();
}

QString QgsProjectParser::featureInfoSchema() const
{
QDomElement propertiesElem = mXMLDoc->documentElement().firstChildElement( "properties" );
if ( propertiesElem.isNull() )
{
return "";
}
QDomElement featureInfoSchemaElem = propertiesElem.firstChildElement( "WMSFeatureInfoSchema" );
if ( featureInfoSchemaElem.isNull() )
{
return "";
}
return featureInfoSchemaElem.text();
}

bool QgsProjectParser::featureInfoFormatSIA2045() const
{
if ( !mXMLDoc )
Expand Down
2 changes: 2 additions & 0 deletions src/mapserver/qgsprojectparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ class QgsProjectParser: public QgsConfigParser

virtual QString featureInfoDocumentElementNS() const;

virtual QString featureInfoSchema() const;

/**Return feature info in format SIA2045?*/
bool featureInfoFormatSIA2045() const;

Expand Down
8 changes: 8 additions & 0 deletions src/mapserver/qgswmsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,14 @@ int QgsWMSServer::getFeatureInfo( QDomDocument& result, QString version )
{
getFeatureInfoElement = result.createElementNS( featureInfoElemNS, featureInfoElemName );
}
//feature info schema
QString featureInfoSchema = mConfigParser->featureInfoSchema();
if ( !featureInfoSchema.isEmpty() )
{
getFeatureInfoElement.setAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
getFeatureInfoElement.setAttribute( "xsi:schemaLocation", featureInfoSchema );
}

result.appendChild( getFeatureInfoElement );

QStringList nonIdentifiableLayers = mConfigParser->identifyDisabledLayers();
Expand Down

0 comments on commit a622d1b

Please sign in to comment.