Skip to content
Permalink
Browse files

[QGIS-Server] Help editing OWS Server general information

Fees and access constraints have a defined list of value by ISO. To help user editing these parameters, edit lines have been remplaced by editable combo box.

To enhance general information and has more INSPIRE compatibility, contact position is added to general information.
  • Loading branch information
rldhont committed Nov 6, 2015
1 parent 25c68c6 commit 5473c3394f688c4d5e9ac3bff82cd1f33a3afea5
@@ -51,6 +51,8 @@
#include "qgsexpressioncontext.h"
#include "qgsmapoverviewcanvas.h"

#include "qgsmessagelog.h"

//qt includes
#include <QInputDialog>
#include <QFileDialog>
@@ -270,10 +272,66 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
mWMSAbstract->setPlainText( QgsProject::instance()->readEntry( "WMSServiceAbstract", "/", "" ) );
mWMSOnlineResourceLineEdit->setText( QgsProject::instance()->readEntry( "WMSOnlineResource", "/", "" ) );
mWMSUrlLineEdit->setText( QgsProject::instance()->readEntry( "WMSUrl", "/", "" ) );
mWMSFees->setText( QgsProject::instance()->readEntry( "WMSFees", "/", "" ) );
mWMSAccessConstraints->setText( QgsProject::instance()->readEntry( "WMSAccessConstraints", "/", "" ) );
mWMSKeywordList->setText( QgsProject::instance()->readListEntry( "WMSKeywordList", "/" ).join( ", " ) );

// WMS Contact Position
QString contactPositionText = QgsProject::instance()->readEntry( "WMSContactPosition", "/", "" );
mWMSContactPositionCb->addItem( "" );
mWMSContactPositionCb->addItem( tr( "Custodian" ), "custodian" );
mWMSContactPositionCb->addItem( tr( "Owner" ), "owner" );
mWMSContactPositionCb->addItem( tr( "User" ), "user" );
mWMSContactPositionCb->addItem( tr( "Distributor" ), "distributor" );
mWMSContactPositionCb->addItem( tr( "Originator" ), "originator" );
mWMSContactPositionCb->addItem( tr( "Point of contact" ), "pointOfContact" );
mWMSContactPositionCb->addItem( tr( "Principal investigator" ), "principalInvestigator" );
mWMSContactPositionCb->addItem( tr( "Processor" ), "processor" );
mWMSContactPositionCb->addItem( tr( "Publisher" ), "publisher" );
mWMSContactPositionCb->addItem( tr( "Author" ), "author" );
int contactPositionIndex = mWMSContactPositionCb->findData( contactPositionText );
if ( contactPositionIndex > 0 )
{
mWMSContactPositionCb->setCurrentIndex( contactPositionIndex );
}
else if ( contactPositionText != "" )
{
mWMSContactPositionCb->setEditText( contactPositionText );
}

// WMS Fees
QString feesText = QgsProject::instance()->readEntry( "WMSFees", "/", "" );
mWMSFeesCb->addItem( tr( "Conditions unknown" ), "conditions unknown" );
mWMSFeesCb->addItem( tr( "No conditions apply" ), "no conditions apply" );
int feesIndex = mWMSFeesCb->findData( feesText );
if ( feesIndex > -1 )
{
mWMSFeesCb->setCurrentIndex( feesIndex );
}
else if ( feesText != "" )
{
mWMSFeesCb->setEditText( feesText );
}

// WMS Access Constraints
QString accessConstraintsText = QgsProject::instance()->readEntry( "WMSAccessConstraints", "/", "" );
mWMSAccessConstraintsCb->addItem( tr( "None" ), "None" );
mWMSAccessConstraintsCb->addItem( tr( "Copyright" ), "copyright" );
mWMSAccessConstraintsCb->addItem( tr( "Patent" ), "patent" );
mWMSAccessConstraintsCb->addItem( tr( "Patent pending" ), "patentPending" );
mWMSAccessConstraintsCb->addItem( tr( "Trademark" ), "trademark" );
mWMSAccessConstraintsCb->addItem( tr( "License" ), "license" );
mWMSAccessConstraintsCb->addItem( tr( "Intellectual property rights" ), "intellectualPropertyRights" );
mWMSAccessConstraintsCb->addItem( tr( "Restricted" ), "restricted" );
mWMSAccessConstraintsCb->addItem( tr( "Other restrictions" ), "otherRestrictions" );
int accessConstraintsIndex = mWMSAccessConstraintsCb->findData( accessConstraintsText );
if ( accessConstraintsIndex > -1 )
{
mWMSAccessConstraintsCb->setCurrentIndex( accessConstraintsIndex );
}
else if ( accessConstraintsText != "" )
{
mWMSAccessConstraintsCb->setEditText( accessConstraintsText );
}

// WMS GetFeatureInfo precision
int WMSprecision = QgsProject::instance()->readNumEntry( "WMSPrecision", "/", -1 );
if ( WMSprecision != -1 )
@@ -737,8 +795,43 @@ void QgsProjectProperties::apply()
QgsProject::instance()->writeEntry( "WMSServiceAbstract", "/", mWMSAbstract->toPlainText() );
QgsProject::instance()->writeEntry( "WMSOnlineResource", "/", mWMSOnlineResourceLineEdit->text() );
QgsProject::instance()->writeEntry( "WMSUrl", "/", mWMSUrlLineEdit->text() );
QgsProject::instance()->writeEntry( "WMSFees", "/", mWMSFees->text() );
QgsProject::instance()->writeEntry( "WMSAccessConstraints", "/", mWMSAccessConstraints->text() );

// WMS Contact Position
int contactPositionIndex = mWMSContactPositionCb->currentIndex();
QString contactPositionText = mWMSContactPositionCb->currentText();
if ( contactPositionText != "" && contactPositionText == mWMSContactPositionCb->itemText( contactPositionIndex ) )
{
QgsProject::instance()->writeEntry( "WMSContactPosition", "/", mWMSContactPositionCb->itemData( contactPositionIndex ).toString() );
}
else
{
QgsProject::instance()->writeEntry( "WMSContactPosition", "/", contactPositionText );
}

// WMS Fees
int feesIndex = mWMSFeesCb->currentIndex();
QString feesText = mWMSFeesCb->currentText();
if ( feesText != "" && feesText == mWMSFeesCb->itemText( feesIndex ) )
{
QgsProject::instance()->writeEntry( "WMSFees", "/", mWMSFeesCb->itemData( feesIndex ).toString() );
}
else
{
QgsProject::instance()->writeEntry( "WMSFees", "/", feesText );
}

// WMS Access Constraints
int accessConstraintsIndex = mWMSAccessConstraintsCb->currentIndex();
QString accessConstraintsText = mWMSAccessConstraintsCb->currentText();
if ( accessConstraintsText != "" && accessConstraintsText == mWMSAccessConstraintsCb->itemText( accessConstraintsIndex ) )
{
QgsProject::instance()->writeEntry( "WMSAccessConstraints", "/", mWMSAccessConstraintsCb->itemData( accessConstraintsIndex ).toString() );
}
else
{
QgsProject::instance()->writeEntry( "WMSAccessConstraints", "/", accessConstraintsText );
}

//WMS keyword list
QStringList keywordStringList = mWMSKeywordList->text().split( ',' );
if ( keywordStringList.size() > 0 )
@@ -491,6 +491,18 @@ void QgsServerProjectParser::serviceCapabilities( QDomElement& parentElement, QD
QDomText contactOrganizationText = doc.createTextNode( contactOrganizationString );
wmsContactOrganizationElem.appendChild( contactOrganizationText );
contactPersonPrimaryElem.appendChild( wmsContactOrganizationElem );

//Contact position
QDomElement contactPositionElem = propertiesElement.firstChildElement( "WMSContactPosition" );
QString contactPositionString;
if ( !contactPositionElem.isNull() )
{
contactPositionString = contactPositionElem.text();
}
QDomElement wmsContactPositionElem = doc.createElement( "ContactPosition" );
QDomText contactPositionText = doc.createTextNode( contactPositionString );
wmsContactPositionElem.appendChild( contactPositionText );
contactPersonPrimaryElem.appendChild( wmsContactPositionElem );
contactInfoElem.appendChild( contactPersonPrimaryElem );

//phone
@@ -1449,12 +1449,6 @@
<string notr="true">projowsserver</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="7" column="1">
<widget class="QLineEdit" name="mWMSFees"/>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="mWMSAccessConstraints"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
@@ -1485,13 +1479,13 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QLineEdit" name="mWMSContactMail"/>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="mWMSContactPerson"/>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>E-Mail</string>
@@ -1501,7 +1495,7 @@
<item row="1" column="1">
<widget class="QLineEdit" name="mWMSContactOrganization"/>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Phone</string>
@@ -1514,7 +1508,7 @@
<item row="0" column="1">
<widget class="QLineEdit" name="mWMSTitle"/>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Abstract</string>
@@ -1524,20 +1518,20 @@
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QLineEdit" name="mWMSContactPhone"/>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QTextEdit" name="mWMSAbstract"/>
</item>
<item row="9" column="0">
<item row="10" column="0">
<widget class="QLabel" name="mWMSKeywordListLabel">
<property name="text">
<string>Keyword list</string>
</property>
</widget>
</item>
<item row="9" column="1">
<item row="10" column="1">
<widget class="QLineEdit" name="mWMSKeywordList"/>
</item>
<item row="1" column="0">
@@ -1550,20 +1544,48 @@
</property>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QLabel" name="mWMSAccessConstraintsLabel">
<property name="text">
<string>Access constraints</string>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="mWMSFeesLabel">
<property name="text">
<string>Fees</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QComboBox" name="mWMSFeesCb">
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QComboBox" name="mWMSAccessConstraintsCb">
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>Position</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="mWMSContactPositionCb">
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -2391,9 +2413,10 @@
<tabstop>mWMSContactPerson</tabstop>
<tabstop>mWMSContactMail</tabstop>
<tabstop>mWMSContactPhone</tabstop>
<tabstop>mWMSContactPositionCb</tabstop>
<tabstop>mWMSAbstract</tabstop>
<tabstop>mWMSFees</tabstop>
<tabstop>mWMSAccessConstraints</tabstop>
<tabstop>mWMSFeesCb</tabstop>
<tabstop>mWMSAccessConstraintsCb</tabstop>
<tabstop>mWMSKeywordList</tabstop>
<tabstop>grpWMSExt</tabstop>
<tabstop>mWMSExtMinX</tabstop>
@@ -15,6 +15,7 @@ Content-Type: text/xml; charset=utf-8
<ContactPersonPrimary>
<ContactPerson>Alessandro Pasotti</ContactPerson>
<ContactOrganization>QGIS dev team</ContactOrganization>
<ContactPosition></ContactPosition>
</ContactPersonPrimary>
<ContactVoiceTelephone></ContactVoiceTelephone>
<ContactElectronicMailAddress>elpaso@itopen.it</ContactElectronicMailAddress>
@@ -15,6 +15,7 @@ Content-Type: text/xml; charset=utf-8
<ContactPersonPrimary>
<ContactPerson>Alessandro Pasotti</ContactPerson>
<ContactOrganization>QGIS dev team</ContactOrganization>
<ContactPosition></ContactPosition>
</ContactPersonPrimary>
<ContactVoiceTelephone></ContactVoiceTelephone>
<ContactElectronicMailAddress>elpaso@itopen.it</ContactElectronicMailAddress>

0 comments on commit 5473c33

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