Skip to content
Permalink
Browse files

Add option for using WFS type name title for the added layer name

  • Loading branch information
palmerj committed Apr 2, 2013
1 parent 7fff3b1 commit e6b624c533ee89eae4e505855e0ae8fedea1ebf1
Showing with 29 additions and 14 deletions.
  1. +11 −3 src/providers/wfs/qgswfssourceselect.cpp
  2. +18 −11 src/ui/qgswfssourceselectbase.ui
@@ -78,8 +78,9 @@ QgsWFSSourceSelect::QgsWFSSourceSelect( QWidget* parent, Qt::WFlags fl, bool emb
treeView->setItemDelegate( mItemDelegate );

QSettings settings;
QgsDebugMsg( "restoring geometry" );
QgsDebugMsg( "restoring settings" );
restoreGeometry( settings.value( "/Windows/WFSSourceSelect/geometry" ).toByteArray() );
cbxUseTitleLayerName->setChecked( settings.value( "/Windows/WFSSourceSelect/UseTitleLayerName", false ).toBool() );

mModel = new QStandardItemModel();
mModel->setHorizontalHeaderItem( 0, new QStandardItem( "Title" ) );
@@ -100,8 +101,9 @@ QgsWFSSourceSelect::QgsWFSSourceSelect( QWidget* parent, Qt::WFlags fl, bool emb
QgsWFSSourceSelect::~QgsWFSSourceSelect()
{
QSettings settings;
QgsDebugMsg( "saving geometry" );
QgsDebugMsg( "saving settings" );
settings.setValue( "/Windows/WFSSourceSelect/geometry", saveGeometry() );
settings.setValue( "/Windows/WFSSourceSelect/UseTitleLayerName", cbxUseTitleLayerName->isChecked() );

delete mItemDelegate;
delete mProjectionSelector;
@@ -377,7 +379,13 @@ void QgsWFSSourceSelect::addLayer()
}
int row = idx.row();
QString typeName = mModel->item( row, 1 )->text(); //WFS repository's name for layer
QString titleName = mModel->item( row, 0 )->text(); //WFS type name title for layer name (if option is set)
QString filter = mModel->item( row, 4 )->text(); //optional filter specified by user
QString layerName = typeName;
if ( cbxUseTitleLayerName->isChecked() && !titleName.isEmpty() )
{
layerName = titleName;
}
QgsDebugMsg( "Layer " + typeName + " Filter is " + filter );
//is "cache features" checked?
if ( mModel->item( row, 3 )->checkState() == Qt::Checked )
@@ -388,7 +396,7 @@ void QgsWFSSourceSelect::addLayer()
{ //no: include BBOX of current canvas extent in URI
mUri = conn.uriGetFeature( typeName, pCrsString, filter, extent );
}
emit addWfsLayer( mUri, typeName );
emit addWfsLayer( mUri, layerName );
}
accept();
}
@@ -14,7 +14,17 @@
<string>Add WFS Layer from a Server</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="0">
<item row="5" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QGroupBox" name="gbCRS">
<property name="title">
<string>Coordinate reference system</string>
@@ -62,16 +72,6 @@
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayoutFilter">
<item>
@@ -210,6 +210,13 @@
</attribute>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="cbxUseTitleLayerName">
<property name="text">
<string>Use title for layer name</string>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>

0 comments on commit e6b624c

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