Skip to content

Commit

Permalink
Add Service online resource element to WMS capability response. This …
Browse files Browse the repository at this point in the history
…element is mandatory according to the 1.3 spec
  • Loading branch information
mhugent committed Jul 19, 2011
1 parent c9bb721 commit 707ab4e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/app/qgsprojectproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
mWMSContactMail->setText( QgsProject::instance()->readEntry( "WMSContactMail", "/", "" ) );
mWMSContactPhone->setText( QgsProject::instance()->readEntry( "WMSContactPhone", "/", "" ) );
mWMSAbstract->setPlainText( QgsProject::instance()->readEntry( "WMSServiceAbstract", "/", "" ) );
mWMSOnlineResourceLineEdit->setText( QgsProject::instance()->readEntry( "WMSOnlineResource", "/", "" ) );

bool ok;
QStringList values;
Expand Down Expand Up @@ -372,6 +373,7 @@ void QgsProjectProperties::apply()
QgsProject::instance()->writeEntry( "WMSContactMail", "/", mWMSContactMail->text() );
QgsProject::instance()->writeEntry( "WMSContactPhone", "/", mWMSContactPhone->text() );
QgsProject::instance()->writeEntry( "WMSServiceAbstract", "/", mWMSAbstract->toPlainText() );
QgsProject::instance()->writeEntry( "WMSOnlineResource", "/", mWMSOnlineResourceLineEdit->text() );

if ( grpWMSExt->isChecked() )
{
Expand Down
12 changes: 12 additions & 0 deletions src/mapserver/qgsprojectparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,18 @@ void QgsProjectParser::serviceCapabilities( QDomElement& parentElement, QDomDocu
serviceElem.appendChild( wmsAbstractElem );
}

//OnlineResource element is mandatory according to the WMS specification
QDomElement wmsOnlineResourceElem = propertiesElem.firstChildElement( "WMSOnlineResource" );
QDomElement onlineResourceElem = doc.createElement( "OnlineResource" );
onlineResourceElem.setAttribute( "xmlns:xlink", "http://www.w3.org/1999/xlink" );
onlineResourceElem.setAttribute( "xlink:type", "simple" );
if ( !wmsOnlineResourceElem.isNull() )
{
onlineResourceElem.setAttribute( "xlink:href", wmsOnlineResourceElem.text() );
}

serviceElem.appendChild( onlineResourceElem );

//Contact information
QDomElement contactInfoElem = doc.createElement( "ContactInformation" );

Expand Down
26 changes: 18 additions & 8 deletions src/ui/qgsprojectpropertiesbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@
<item row="0" column="2">
<widget class="QLineEdit" name="mWMSTitle"/>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Person</string>
Expand All @@ -403,10 +403,10 @@
</property>
</widget>
</item>
<item row="2" column="2">
<item row="3" column="2">
<widget class="QLineEdit" name="mWMSContactPerson"/>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Phone</string>
Expand All @@ -416,13 +416,13 @@
</property>
</widget>
</item>
<item row="5" column="2">
<item row="6" column="2">
<widget class="QLineEdit" name="mWMSContactPhone"/>
</item>
<item row="7" column="2">
<item row="8" column="2">
<widget class="QTextEdit" name="mWMSAbstract"/>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Abstract</string>
Expand All @@ -432,14 +432,14 @@
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>E-Mail</string>
</property>
</widget>
</item>
<item row="4" column="2">
<item row="5" column="2">
<widget class="QLineEdit" name="mWMSContactMail"/>
</item>
<item row="1" column="0">
Expand All @@ -455,6 +455,16 @@
<item row="1" column="2">
<widget class="QLineEdit" name="mWMSContactOrganization"/>
</item>
<item row="2" column="2">
<widget class="QLineEdit" name="mWMSOnlineResourceLineEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mWMSOnlineResourceLabel">
<property name="text">
<string>Online resource</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down

0 comments on commit 707ab4e

Please sign in to comment.