Skip to content
Permalink
Browse files

WFS server: insert/update/delete are only dependent on wfs publish pr…

…operty. Funded by Sourcepole QGIS Enterprise
  • Loading branch information
mhugent committed Sep 22, 2014
1 parent 6f84cdc commit f58fbe0d7cac662ffff28421964c4c06b5a5fefe
78 src/app/qgsprojectproperties.cpp 100755 → 100644
@@ -373,12 +373,6 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa

QSignalMapper *smPublied = new QSignalMapper( this );
connect( smPublied, SIGNAL( mapped( int ) ), this, SLOT( cbxWFSPubliedStateChanged( int ) ) );
QSignalMapper *smUpdate = new QSignalMapper( this );
connect( smUpdate, SIGNAL( mapped( int ) ), this, SLOT( cbxWFSUpdateStateChanged( int ) ) );
QSignalMapper *smInsert = new QSignalMapper( this );
connect( smInsert, SIGNAL( mapped( int ) ), this, SLOT( cbxWFSInsertStateChanged( int ) ) );
QSignalMapper *smDelete = new QSignalMapper( this );
connect( smDelete, SIGNAL( mapped( int ) ), this, SLOT( cbxWFSDeleteStateChanged( int ) ) );

twWFSLayers->setColumnCount( 6 );
twWFSLayers->horizontalHeader()->setVisible( true );
@@ -418,27 +412,18 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
QCheckBox* cbu = new QCheckBox();
cbu->setChecked( wfstUpdateLayerIdList.contains( currentLayer->id() ) );
twWFSLayers->setCellWidget( j, 3, cbu );

smUpdate->setMapping( cbu, j );
connect( cbu, SIGNAL( stateChanged( int ) ), smUpdate, SLOT( map() ) );
}
if (( provider->capabilities() & QgsVectorDataProvider::AddFeatures ) )
{
QCheckBox* cbi = new QCheckBox();
cbi->setChecked( wfstInsertLayerIdList.contains( currentLayer->id() ) );
twWFSLayers->setCellWidget( j, 4, cbi );

smInsert->setMapping( cbi, j );
connect( cbi, SIGNAL( stateChanged( int ) ), smInsert, SLOT( map() ) );
}
if (( provider->capabilities() & QgsVectorDataProvider::DeleteFeatures ) )
{
QCheckBox* cbd = new QCheckBox();
cbd->setChecked( wfstDeleteLayerIdList.contains( currentLayer->id() ) );
twWFSLayers->setCellWidget( j, 5, cbd );

smDelete->setMapping( cbd, j );
connect( cbd, SIGNAL( stateChanged( int ) ), smDelete, SLOT( map() ) );
}

j++;
@@ -1010,54 +995,21 @@ void QgsProjectProperties::cbxWFSPubliedStateChanged( int aIdx )
QCheckBox* cb = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 1 ) );
if ( cb && !cb->isChecked() )
{
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 2 ) );
if ( cbn )
cbn->setChecked( false );
}
}

void QgsProjectProperties::cbxWFSUpdateStateChanged( int aIdx )
{
QCheckBox* cb = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 2 ) );
if ( cb && cb->isChecked() )
{
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 1 ) );
if ( cbn )
cbn->setChecked( true );
}
else if ( cb && !cb->isChecked() )
{
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 3 ) );
if ( cbn )
cbn->setChecked( false );
}
}

void QgsProjectProperties::cbxWFSInsertStateChanged( int aIdx )
{
QCheckBox* cb = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 3 ) );
if ( cb && cb->isChecked() )
{
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 2 ) );
if ( cbn )
cbn->setChecked( true );
}
else if ( cb && !cb->isChecked() )
{
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 4 ) );
if ( cbn )
cbn->setChecked( false );
}
}

void QgsProjectProperties::cbxWFSDeleteStateChanged( int aIdx )
{
QCheckBox* cb = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 4 ) );
if ( cb && cb->isChecked() )
{
QCheckBox* cbn = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 3 ) );
if ( cbn )
cbn->setChecked( true );
QCheckBox* cbUpdate = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 3 ) );
if ( cbUpdate )
{
cbUpdate->setChecked( false );
}
QCheckBox* cbInsert = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 4 ) );
if ( cbInsert )
{
cbInsert->setChecked( false );
}
QCheckBox* cbDelete = qobject_cast<QCheckBox *>( twWFSLayers->cellWidget( aIdx, 5 ) );
if ( cbDelete )
{
cbDelete->setChecked( false );
}
}
}

@@ -143,9 +143,6 @@ class APP_EXPORT QgsProjectProperties : public QgsOptionsDialogBase, private Ui:
* Slot to link WFS checkboxes
*/
void cbxWFSPubliedStateChanged( int aIdx );
void cbxWFSUpdateStateChanged( int aIdx );
void cbxWFSInsertStateChanged( int aIdx );
void cbxWFSDeleteStateChanged( int aIdx );

/*!
* Slot to link WCS checkboxes
@@ -201,7 +201,7 @@ void QgsWFSProjectParser::featureTypeList( QDomElement& parentElement, QDomDocum

QSet<QString> QgsWFSProjectParser::wfstUpdateLayers() const
{
QStringList publiedIds = mProjectParser.wfsLayers();
QSet<QString> publishedIds = wfsLayerSet();
QSet<QString> wfsList;
if ( !mProjectParser.xmlDocument() )
{
@@ -227,7 +227,7 @@ QSet<QString> QgsWFSProjectParser::wfstUpdateLayers() const
for ( int i = 0; i < valueList.size(); ++i )
{
QString id = valueList.at( i ).toElement().text();
if ( publiedIds.contains( id ) )
if ( publishedIds.contains( id ) )
{
wfsList.insert( id );
}
@@ -237,7 +237,7 @@ QSet<QString> QgsWFSProjectParser::wfstUpdateLayers() const

QSet<QString> QgsWFSProjectParser::wfstInsertLayers() const
{
QSet<QString> updateIds = wfstUpdateLayers();
QSet<QString> publishedIds = wfsLayerSet();
QSet<QString> wfsList;
if ( !mProjectParser.xmlDocument() )
{
@@ -263,7 +263,7 @@ QSet<QString> QgsWFSProjectParser::wfstInsertLayers() const
for ( int i = 0; i < valueList.size(); ++i )
{
QString id = valueList.at( i ).toElement().text();
if ( updateIds.contains( id ) )
if ( publishedIds.contains( id ) )
{
wfsList.insert( id );
}
@@ -273,7 +273,7 @@ QSet<QString> QgsWFSProjectParser::wfstInsertLayers() const

QSet<QString> QgsWFSProjectParser::wfstDeleteLayers() const
{
QSet<QString> insertIds = wfstInsertLayers();
QSet<QString> publishedIds = wfsLayerSet();
QSet<QString> wfsList;
if ( !mProjectParser.xmlDocument() )
{
@@ -299,7 +299,7 @@ QSet<QString> QgsWFSProjectParser::wfstDeleteLayers() const
for ( int i = 0; i < valueList.size(); ++i )
{
QString id = valueList.at( i ).toElement().text();
if ( insertIds.contains( id ) )
if ( publishedIds.contains( id ) )
{
wfsList.insert( id );
}
@@ -463,6 +463,11 @@ QStringList QgsWFSProjectParser::wfsLayers() const
return mProjectParser.wfsLayers();
}

QSet<QString> QgsWFSProjectParser::wfsLayerSet() const
{
return QSet<QString>::fromList( wfsLayers() );
}

int QgsWFSProjectParser::wfsLayerPrecision( const QString& aLayerId ) const
{
QStringList wfsLayersId = mProjectParser.wfsLayers();
@@ -34,6 +34,7 @@ class QgsWFSProjectParser
void describeFeatureType( const QString& aTypeName, QDomElement& parentElement, QDomDocument& doc ) const;

QStringList wfsLayers() const;
QSet<QString> wfsLayerSet() const;
int wfsLayerPrecision( const QString& aLayerId ) const;

QList<QgsMapLayer*> mapLayerFromTypeName( const QString& aTypeName, bool useCache = true ) const;

0 comments on commit f58fbe0

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