Index: src/app/qgssnappingdialog.cpp =================================================================== --- src/app/qgssnappingdialog.cpp (revision 14769) +++ src/app/qgssnappingdialog.cpp (working copy) @@ -16,12 +16,14 @@ ***************************************************************************/ #include "qgssnappingdialog.h" +#include "qgsavoidintersectionsdialog.h" #include "qgsmapcanvas.h" #include "qgsmaplayer.h" #include "qgsvectorlayer.h" #include "qgsmaplayerregistry.h" #include "qgisapp.h" #include "qgsproject.h" +#include "qgslogger.h" #include #include #include @@ -35,7 +37,7 @@ QgsSnappingDock( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 ) : QDockWidget( title, parent, flags ) { - setObjectName( "Snapping Options" ); // set object name so the position can be saved + setObjectName( "Snapping and Digitizing Options" ); // set object name so the position can be saved } virtual void closeEvent( QCloseEvent * ev ) @@ -53,7 +55,7 @@ bool myDockFlag = myQsettings.value( "/qgis/dockSnapping", false ).toBool(); if ( myDockFlag ) { - mDock = new QgsSnappingDock( tr( "Snapping Options" ), QgisApp::instance() ); + mDock = new QgsSnappingDock( tr( "Snapping and Digitizing Options" ), QgisApp::instance() ); mDock->setAllowedAreas( Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea ); mDock->setWidget( this ); connect( this, SIGNAL( destroyed() ), mDock, SLOT( close() ) ); @@ -66,7 +68,9 @@ } connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer * ) ), this, SLOT( update() ) ); connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( update() ) ); + connect( cbxEnableTopologicalEditingCheckBox, SIGNAL( stateChanged( int ) ),this, SLOT( on_cbxEnableTopologicalEditingCheckBox_stateChanged(int) ) ); + update(); mLayerTreeWidget->setHeaderLabels( QStringList() << "" ); @@ -86,6 +90,29 @@ { } +void QgsSnappingDialog::on_cbxEnableTopologicalEditingCheckBox_stateChanged(int state) +{ + int topologicalEditingEnabled = ( state == Qt::Checked ) ? 1 : 0; + QgsProject::instance()->writeEntry( "Digitizing", "/TopologicalEditing", topologicalEditingEnabled ); +} + +void QgsSnappingDialog::on_mAvoidIntersectionsPushButton_clicked() +{ + QgsAvoidIntersectionsDialog d( mMapCanvas, mAvoidIntersectionsSettings ); + if ( d.exec() == QDialog::Accepted ) + { + d.enabledLayers( mAvoidIntersectionsSettings ); + //store avoid intersection layers + QStringList avoidIntersectionList; + QSet::const_iterator avoidIt = mAvoidIntersectionsSettings.constBegin(); + for ( ; avoidIt != mAvoidIntersectionsSettings.constEnd(); ++avoidIt ) + { + avoidIntersectionList.append( *avoidIt ); + } + QgsProject::instance()->writeEntry( "Digitizing", "/AvoidIntersectionsList", avoidIntersectionList ); + } +} + void QgsSnappingDialog::closeEvent( QCloseEvent* event ) { QDialog::closeEvent( event ); @@ -196,6 +223,29 @@ cbxSnapTo->setCurrentIndex( snappingStringIdx ); leTolerance->setText( QString::number( toleranceList[idx].toDouble(), 'f' ) ); cbxUnits->setCurrentIndex( toleranceUnitList[idx].toInt() ); + + //read the digitizing settings + int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 ); + if ( topologicalEditing != 0 ) + { + cbxEnableTopologicalEditingCheckBox->setCheckState( Qt::Checked ); + } + else + { + cbxEnableTopologicalEditingCheckBox->setCheckState( Qt::Unchecked ); + } + + bool avoidIntersectionListOk; + mAvoidIntersectionsSettings.clear(); + QStringList avoidIntersectionsList = QgsProject::instance()->readListEntry( "Digitizing", "/AvoidIntersectionsList", &avoidIntersectionListOk ); + if ( avoidIntersectionListOk ) + { + QStringList::const_iterator avoidIt = avoidIntersectionsList.constBegin(); + for ( ; avoidIt != avoidIntersectionsList.constEnd(); ++avoidIt ) + { + mAvoidIntersectionsSettings.insert( *avoidIt ); + } + } } if ( myDockFlag ) Index: src/app/qgsprojectproperties.cpp =================================================================== --- src/app/qgsprojectproperties.cpp (revision 14769) +++ src/app/qgsprojectproperties.cpp (working copy) @@ -107,29 +107,7 @@ myColor = QColor( myRedInt, myGreenInt, myBlueInt ); pbnCanvasColor->setColor( myColor ); - //read the digitizing settings - int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 ); - if ( topologicalEditing != 0 ) - { - mEnableTopologicalEditingCheckBox->setCheckState( Qt::Checked ); - } - else - { - mEnableTopologicalEditingCheckBox->setCheckState( Qt::Unchecked ); - } - bool avoidIntersectionListOk; - mAvoidIntersectionsSettings.clear(); - QStringList avoidIntersectionsList = QgsProject::instance()->readListEntry( "Digitizing", "/AvoidIntersectionsList", &avoidIntersectionListOk ); - if ( avoidIntersectionListOk ) - { - QStringList::const_iterator avoidIt = avoidIntersectionsList.constBegin(); - for ( ; avoidIt != avoidIntersectionsList.constEnd(); ++avoidIt ) - { - mAvoidIntersectionsSettings.insert( *avoidIt ); - } - } - QgsMapLayer* currentLayer = 0; QStringList noIdentifyLayerIdList = QgsProject::instance()->readListEntry( "Identify", "/disabledLayers" ); @@ -325,20 +303,6 @@ QgsProject::instance()->writeEntry( "Gui", "/CanvasColorGreenPart", myColor.green() ); QgsProject::instance()->writeEntry( "Gui", "/CanvasColorBluePart", myColor.blue() ); - //write the digitizing settings - int topologicalEditingEnabled = ( mEnableTopologicalEditingCheckBox->checkState() == Qt::Checked ) ? 1 : 0; - QgsProject::instance()->writeEntry( "Digitizing", "/TopologicalEditing", topologicalEditingEnabled ); - - //store avoid intersection layers - QStringList avoidIntersectionList; - QSet::const_iterator avoidIt = mAvoidIntersectionsSettings.constBegin(); - for ( ; avoidIt != mAvoidIntersectionsSettings.constEnd(); ++avoidIt ) - { - avoidIntersectionList.append( *avoidIt ); - } - QgsProject::instance()->writeEntry( "Digitizing", "/AvoidIntersectionsList", avoidIntersectionList ); - - QStringList noIdentifyLayerList; for ( int i = 0; i < twIdentifyLayers->rowCount(); i++ ) { @@ -389,16 +353,6 @@ } } -void QgsProjectProperties::on_mAvoidIntersectionsPushButton_clicked() -{ - QgsAvoidIntersectionsDialog d( mMapCanvas, mAvoidIntersectionsSettings ); - if ( d.exec() == QDialog::Accepted ) - { - d.enabledLayers( mAvoidIntersectionsSettings ); - } -} - - void QgsProjectProperties::on_cbxProjectionEnabled_stateChanged( int state ) { btnGrpMapUnits->setEnabled( state == Qt::Unchecked ); Index: src/app/qgssnappingdialog.h =================================================================== --- src/app/qgssnappingdialog.h (revision 14769) +++ src/app/qgssnappingdialog.h (working copy) @@ -44,6 +44,13 @@ //! update the Dialog void update(); + void on_cbxEnableTopologicalEditingCheckBox_stateChanged( int ); + + /*! + * + */ + void on_mAvoidIntersectionsPushButton_clicked(); + //! show dialog or dock void show(); @@ -60,6 +67,9 @@ private: + /**Stores ids of layers where intersections of new polygons is considered. Is passed to / read from QgsAvoidIntersectionsDialog*/ + QSet mAvoidIntersectionsSettings; + /**Default constructor forbidden*/ QgsSnappingDialog(); Index: src/app/qgsprojectproperties.h =================================================================== --- src/app/qgsprojectproperties.h (revision 14769) +++ src/app/qgsprojectproperties.h (working copy) @@ -89,11 +89,6 @@ */ void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); } - /*! - * - */ - void on_mAvoidIntersectionsPushButton_clicked(); - void on_cbxProjectionEnabled_stateChanged( int state ); /*! @@ -112,9 +107,6 @@ private: QgsMapCanvas* mMapCanvas; - /**Stores ids of layers where intersections of new polygons is considered. Is passed to / read from QgsAvoidIntersectionsDialog*/ - QSet mAvoidIntersectionsSettings; - /*! * Function to save dialog window state */ Index: src/ui/qgssnappingdialogbase.ui =================================================================== --- src/ui/qgssnappingdialogbase.ui (revision 14769) +++ src/ui/qgssnappingdialogbase.ui (working copy) @@ -6,8 +6,8 @@ 0 0 - 644 - 290 + 688 + 402 @@ -22,6 +22,24 @@ + + true + + + + 0 + 0 + + + + false + + + + + + QFrame::Sunken + 0 @@ -30,7 +48,7 @@ - + @@ -56,6 +74,26 @@ + + + Enable topological editing + + + false + + + false + + + + + + + Avoid intersections of new polygons... + + + + Qt::Horizontal Index: src/ui/qgsprojectpropertiesbase.ui =================================================================== --- src/ui/qgsprojectpropertiesbase.ui (revision 14769) +++ src/ui/qgsprojectpropertiesbase.ui (working copy) @@ -23,7 +23,7 @@ - 1 + 0 @@ -285,35 +285,6 @@ - - - - - 0 - 0 - - - - Digitizing - - - - - - Enable topological editing - - - - - - - Avoid intersections of new polygons... - - - - - - @@ -422,8 +393,6 @@ radAutomatic radManual spinBoxDP - mEnableTopologicalEditingCheckBox - mAvoidIntersectionsPushButton cbxProjectionEnabled twIdentifyLayers tabWidget