Skip to content

Commit ea6802e

Browse files
committedOct 26, 2012
Support elements KeywordList, Fees, AccesConstraints in QGIS server capabilities
1 parent 4ed1a66 commit ea6802e

File tree

3 files changed

+147
-71
lines changed

3 files changed

+147
-71
lines changed
 

‎src/app/qgsprojectproperties.cpp

Lines changed: 65 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
223223
mWMSAbstract->setPlainText( QgsProject::instance()->readEntry( "WMSServiceAbstract", "/", "" ) );
224224
mWMSOnlineResourceLineEdit->setText( QgsProject::instance()->readEntry( "WMSOnlineResource", "/", "" ) );
225225
mWMSUrlLineEdit->setText( QgsProject::instance()->readEntry( "WMSUrl", "/", "" ) );
226+
mWMSFees->setText( QgsProject::instance()->readEntry( "WMSFees", "/", "" ) );
227+
mWMSAccessConstraints->setText( QgsProject::instance()->readEntry( "WMSAccessConstraints", "/", "" ) );
228+
mWMSKeywordList->setText( QgsProject::instance()->readListEntry( "WMSKeywordList", "/" ).join( "," ) );
226229

227230
bool ok;
228231
QStringList values;
@@ -304,14 +307,14 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
304307
QStringList wfstInsertLayerIdList = QgsProject::instance()->readListEntry( "WFSTLayers", "Insert" );
305308
QStringList wfstDeleteLayerIdList = QgsProject::instance()->readListEntry( "WFSTLayers", "Delete" );
306309

307-
QSignalMapper *smPublied = new QSignalMapper(this);
308-
connect(smPublied, SIGNAL(mapped(int)), this, SLOT(on_cbxWFSPublied_stateChanged(int)));
309-
QSignalMapper *smUpdate = new QSignalMapper(this);
310-
connect(smUpdate, SIGNAL(mapped(int)), this, SLOT(on_cbxWFSUpdate_stateChanged(int)));
311-
QSignalMapper *smInsert = new QSignalMapper(this);
312-
connect(smInsert, SIGNAL(mapped(int)), this, SLOT(on_cbxWFSInsert_stateChanged(int)));
313-
QSignalMapper *smDelete = new QSignalMapper(this);
314-
connect(smDelete, SIGNAL(mapped(int)), this, SLOT(on_cbxWFSDelete_stateChanged(int)));
310+
QSignalMapper *smPublied = new QSignalMapper( this );
311+
connect( smPublied, SIGNAL( mapped( int ) ), this, SLOT( on_cbxWFSPublied_stateChanged( int ) ) );
312+
QSignalMapper *smUpdate = new QSignalMapper( this );
313+
connect( smUpdate, SIGNAL( mapped( int ) ), this, SLOT( on_cbxWFSUpdate_stateChanged( int ) ) );
314+
QSignalMapper *smInsert = new QSignalMapper( this );
315+
connect( smInsert, SIGNAL( mapped( int ) ), this, SLOT( on_cbxWFSInsert_stateChanged( int ) ) );
316+
QSignalMapper *smDelete = new QSignalMapper( this );
317+
connect( smDelete, SIGNAL( mapped( int ) ), this, SLOT( on_cbxWFSDelete_stateChanged( int ) ) );
315318

316319
twWFSLayers->setColumnCount( 5 );
317320
twWFSLayers->horizontalHeader()->setVisible( true );
@@ -337,37 +340,37 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
337340
cbp->setChecked( wfsLayerIdList.contains( currentLayer->id() ) );
338341
twWFSLayers->setCellWidget( j, 1, cbp );
339342

340-
smPublied->setMapping(cbp, j);
341-
connect(cbp, SIGNAL(stateChanged(int)), smPublied, SLOT(map()));
343+
smPublied->setMapping( cbp, j );
344+
connect( cbp, SIGNAL( stateChanged( int ) ), smPublied, SLOT( map() ) );
342345

343346
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer*>( currentLayer );
344347
QgsVectorDataProvider* provider = vlayer->dataProvider();
345-
if ( (provider->capabilities() & QgsVectorDataProvider::ChangeAttributeValues ) && (provider->capabilities() & QgsVectorDataProvider::ChangeGeometries ) )
348+
if (( provider->capabilities() & QgsVectorDataProvider::ChangeAttributeValues ) && ( provider->capabilities() & QgsVectorDataProvider::ChangeGeometries ) )
346349
{
347350
QCheckBox* cbu = new QCheckBox();
348351
cbu->setChecked( wfstUpdateLayerIdList.contains( currentLayer->id() ) );
349352
twWFSLayers->setCellWidget( j, 2, cbu );
350353

351-
smUpdate->setMapping(cbu, j);
352-
connect(cbu, SIGNAL(stateChanged(int)), smUpdate, SLOT(map()));
354+
smUpdate->setMapping( cbu, j );
355+
connect( cbu, SIGNAL( stateChanged( int ) ), smUpdate, SLOT( map() ) );
353356
}
354-
if ( ( provider->capabilities() & QgsVectorDataProvider::AddFeatures ) )
357+
if (( provider->capabilities() & QgsVectorDataProvider::AddFeatures ) )
355358
{
356359
QCheckBox* cbi = new QCheckBox();
357360
cbi->setChecked( wfstInsertLayerIdList.contains( currentLayer->id() ) );
358361
twWFSLayers->setCellWidget( j, 3, cbi );
359362

360-
smInsert->setMapping(cbi, j);
361-
connect(cbi, SIGNAL(stateChanged(int)), smInsert, SLOT(map()));
363+
smInsert->setMapping( cbi, j );
364+
connect( cbi, SIGNAL( stateChanged( int ) ), smInsert, SLOT( map() ) );
362365
}
363-
if ( ( provider->capabilities() & QgsVectorDataProvider::DeleteFeatures ) )
366+
if (( provider->capabilities() & QgsVectorDataProvider::DeleteFeatures ) )
364367
{
365368
QCheckBox* cbd = new QCheckBox();
366369
cbd->setChecked( wfstDeleteLayerIdList.contains( currentLayer->id() ) );
367370
twWFSLayers->setCellWidget( j, 4, cbd );
368371

369-
smDelete->setMapping(cbd, j);
370-
connect(cbd, SIGNAL(stateChanged(int)), smDelete, SLOT(map()));
372+
smDelete->setMapping( cbd, j );
373+
connect( cbd, SIGNAL( stateChanged( int ) ), smDelete, SLOT( map() ) );
371374
}
372375

373376
j++;
@@ -567,6 +570,9 @@ void QgsProjectProperties::apply()
567570
QgsProject::instance()->writeEntry( "WMSServiceAbstract", "/", mWMSAbstract->toPlainText() );
568571
QgsProject::instance()->writeEntry( "WMSOnlineResource", "/", mWMSOnlineResourceLineEdit->text() );
569572
QgsProject::instance()->writeEntry( "WMSUrl", "/", mWMSUrlLineEdit->text() );
573+
QgsProject::instance()->writeEntry( "WMSFees", "/", mWMSFees->text() );
574+
QgsProject::instance()->writeEntry( "WMSAccessConstraints", "/", mWMSAccessConstraints->text() );
575+
QgsProject::instance()->writeEntry( "WMSKeywordList", "/", mWMSKeywordList->text().split( "," ) );
570576

571577
if ( grpWMSExt->isChecked() )
572578
{
@@ -762,58 +768,58 @@ void QgsProjectProperties::on_cbxProjectionEnabled_stateChanged( int state )
762768

763769
void QgsProjectProperties::on_cbxWFSPublied_stateChanged( int aIdx )
764770
{
765-
QCheckBox* cb = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 1 ) );
766-
if ( cb && !cb->isChecked() )
767-
{
768-
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 2 ) );
769-
if ( cbn )
770-
cbn->setChecked(false);
771-
}
771+
QCheckBox* cb = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 1 ) );
772+
if ( cb && !cb->isChecked() )
773+
{
774+
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 2 ) );
775+
if ( cbn )
776+
cbn->setChecked( false );
777+
}
772778
}
773779

774780
void QgsProjectProperties::on_cbxWFSUpdate_stateChanged( int aIdx )
775781
{
776-
QCheckBox* cb = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 2 ) );
777-
if ( cb && cb->isChecked() )
778-
{
779-
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 1 ) );
780-
if ( cbn )
781-
cbn->setChecked(true);
782-
}
783-
else if ( cb && !cb->isChecked() )
784-
{
785-
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 3 ) );
786-
if ( cbn )
787-
cbn->setChecked(false);
788-
}
782+
QCheckBox* cb = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 2 ) );
783+
if ( cb && cb->isChecked() )
784+
{
785+
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 1 ) );
786+
if ( cbn )
787+
cbn->setChecked( true );
788+
}
789+
else if ( cb && !cb->isChecked() )
790+
{
791+
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 3 ) );
792+
if ( cbn )
793+
cbn->setChecked( false );
794+
}
789795
}
790796

791797
void QgsProjectProperties::on_cbxWFSInsert_stateChanged( int aIdx )
792798
{
793-
QCheckBox* cb = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 3 ) );
794-
if ( cb && cb->isChecked() )
795-
{
796-
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 2 ) );
797-
if ( cbn )
798-
cbn->setChecked(true);
799-
}
800-
else if ( cb && !cb->isChecked() )
801-
{
802-
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 4 ) );
803-
if ( cbn )
804-
cbn->setChecked(false);
805-
}
799+
QCheckBox* cb = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 3 ) );
800+
if ( cb && cb->isChecked() )
801+
{
802+
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 2 ) );
803+
if ( cbn )
804+
cbn->setChecked( true );
805+
}
806+
else if ( cb && !cb->isChecked() )
807+
{
808+
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 4 ) );
809+
if ( cbn )
810+
cbn->setChecked( false );
811+
}
806812
}
807813

808814
void QgsProjectProperties::on_cbxWFSDelete_stateChanged( int aIdx )
809815
{
810-
QCheckBox* cb = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 4 ) );
811-
if ( cb && cb->isChecked() )
812-
{
813-
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 3 ) );
814-
if ( cbn )
815-
cbn->setChecked(true);
816-
}
816+
QCheckBox* cb = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 4 ) );
817+
if ( cb && cb->isChecked() )
818+
{
819+
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 3 ) );
820+
if ( cbn )
821+
cbn->setChecked( true );
822+
}
817823
}
818824

819825
void QgsProjectProperties::setMapUnitsToCurrentProjection()

‎src/mapserver/qgsprojectparser.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,26 @@ void QgsProjectParser::serviceCapabilities( QDomElement& parentElement, QDomDocu
17191719
serviceElem.appendChild( wmsAbstractElem );
17201720
}
17211721

1722+
//keyword list
1723+
QDomElement keywordListElem = propertiesElem.firstChildElement( "WMSKeywordList" );
1724+
if ( !keywordListElem.isNull() )
1725+
{
1726+
QDomElement wmsKeywordElem = doc.createElement( "KeywordList" );
1727+
QDomNodeList keywordList = keywordListElem.elementsByTagName( "value" );
1728+
for ( int i = 0; i < keywordList.size(); ++i )
1729+
{
1730+
QDomElement keywordElem = doc.createElement( "Keyword" );
1731+
QDomText keywordText = doc.createTextNode( keywordList.at( i ).toElement().text() );
1732+
keywordElem.appendChild( keywordText );
1733+
wmsKeywordElem.appendChild( keywordElem );
1734+
}
1735+
1736+
if ( keywordList.size() > 0 )
1737+
{
1738+
serviceElem.appendChild( wmsKeywordElem );
1739+
}
1740+
}
1741+
17221742
//OnlineResource element is mandatory according to the WMS specification
17231743
QDomElement wmsOnlineResourceElem = propertiesElem.firstChildElement( "WMSOnlineResource" );
17241744
QDomElement onlineResourceElem = doc.createElement( "OnlineResource" );
@@ -1785,6 +1805,26 @@ void QgsProjectParser::serviceCapabilities( QDomElement& parentElement, QDomDocu
17851805

17861806
serviceElem.appendChild( contactInfoElem );
17871807

1808+
//Fees
1809+
QDomElement feesElem = propertiesElem.firstChildElement( "WMSFees" );
1810+
if ( !feesElem.isNull() )
1811+
{
1812+
QDomElement wmsFeesElem = doc.createElement( "Fees" );
1813+
QDomText wmsFeesText = doc.createTextNode( feesElem.text() );
1814+
wmsFeesElem.appendChild( wmsFeesText );
1815+
serviceElem.appendChild( wmsFeesElem );
1816+
}
1817+
1818+
//AccessConstraints
1819+
QDomElement accessConstraintsElem = propertiesElem.firstChildElement( "WMSAccessConstraints" );
1820+
if ( !accessConstraintsElem.isNull() )
1821+
{
1822+
QDomElement wmsAccessConstraintsElem = doc.createElement( "AccessConstraints" );
1823+
QDomText wmsAccessConstraintsText = doc.createTextNode( accessConstraintsElem.text() );
1824+
wmsAccessConstraintsElem.appendChild( wmsAccessConstraintsText );
1825+
serviceElem.appendChild( wmsAccessConstraintsElem );
1826+
}
1827+
17881828
//MaxWidth / MaxHeight for WMS 1.3
17891829
QString version = doc.documentElement().attribute( "version" );
17901830
if ( version != "1.1.1" )

‎src/ui/qgsprojectpropertiesbase.ui

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<x>0</x>
5252
<y>0</y>
5353
<width>600</width>
54-
<height>489</height>
54+
<height>497</height>
5555
</rect>
5656
</property>
5757
<layout class="QGridLayout" name="gridLayout_13">
@@ -799,7 +799,7 @@
799799
<x>0</x>
800800
<y>0</y>
801801
<width>600</width>
802-
<height>984</height>
802+
<height>1085</height>
803803
</rect>
804804
</property>
805805
<layout class="QGridLayout" name="gridLayout_15">
@@ -815,6 +815,16 @@
815815
<bool>false</bool>
816816
</property>
817817
<layout class="QGridLayout" name="gridLayout_6">
818+
<item row="3" column="0">
819+
<widget class="QLabel" name="label_7">
820+
<property name="text">
821+
<string>Person</string>
822+
</property>
823+
<property name="buddy">
824+
<cstring>mWMSContactPerson</cstring>
825+
</property>
826+
</widget>
827+
</item>
818828
<item row="0" column="0">
819829
<widget class="QLabel" name="label_6">
820830
<property name="text">
@@ -851,16 +861,6 @@
851861
<item row="2" column="1">
852862
<widget class="QLineEdit" name="mWMSOnlineResourceLineEdit"/>
853863
</item>
854-
<item row="3" column="0">
855-
<widget class="QLabel" name="label_7">
856-
<property name="text">
857-
<string>Person</string>
858-
</property>
859-
<property name="buddy">
860-
<cstring>mWMSContactPerson</cstring>
861-
</property>
862-
</widget>
863-
</item>
864864
<item row="3" column="1">
865865
<widget class="QLineEdit" name="mWMSContactPerson"/>
866866
</item>
@@ -900,6 +900,36 @@
900900
<item row="6" column="1">
901901
<widget class="QTextEdit" name="mWMSAbstract"/>
902902
</item>
903+
<item row="7" column="1">
904+
<widget class="QLineEdit" name="mWMSFees"/>
905+
</item>
906+
<item row="7" column="0">
907+
<widget class="QLabel" name="mWMSFeesLabel">
908+
<property name="text">
909+
<string>Fees</string>
910+
</property>
911+
</widget>
912+
</item>
913+
<item row="8" column="1">
914+
<widget class="QLineEdit" name="mWMSAccessConstraints"/>
915+
</item>
916+
<item row="8" column="0">
917+
<widget class="QLabel" name="mWMSAccessConstraintsLabel">
918+
<property name="text">
919+
<string>Access constraints</string>
920+
</property>
921+
</widget>
922+
</item>
923+
<item row="9" column="1">
924+
<widget class="QLineEdit" name="mWMSKeywordList"/>
925+
</item>
926+
<item row="9" column="0">
927+
<widget class="QLabel" name="mWMSKeywordListLabel">
928+
<property name="text">
929+
<string>Keyword list</string>
930+
</property>
931+
</widget>
932+
</item>
903933
</layout>
904934
</widget>
905935
</item>

0 commit comments

Comments
 (0)
Please sign in to comment.