Skip to content

Commit e7428cd

Browse files
author
jef
committed
apply #3258
git-svn-id: http://svn.osgeo.org/qgis/trunk@14778 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 4426308 commit e7428cd

6 files changed

+86
-98
lines changed

src/app/qgsprojectproperties.cpp

-47
Original file line numberDiff line numberDiff line change
@@ -107,29 +107,6 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
107107
myColor = QColor( myRedInt, myGreenInt, myBlueInt );
108108
pbnCanvasColor->setColor( myColor );
109109

110-
//read the digitizing settings
111-
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
112-
if ( topologicalEditing != 0 )
113-
{
114-
mEnableTopologicalEditingCheckBox->setCheckState( Qt::Checked );
115-
}
116-
else
117-
{
118-
mEnableTopologicalEditingCheckBox->setCheckState( Qt::Unchecked );
119-
}
120-
121-
bool avoidIntersectionListOk;
122-
mAvoidIntersectionsSettings.clear();
123-
QStringList avoidIntersectionsList = QgsProject::instance()->readListEntry( "Digitizing", "/AvoidIntersectionsList", &avoidIntersectionListOk );
124-
if ( avoidIntersectionListOk )
125-
{
126-
QStringList::const_iterator avoidIt = avoidIntersectionsList.constBegin();
127-
for ( ; avoidIt != avoidIntersectionsList.constEnd(); ++avoidIt )
128-
{
129-
mAvoidIntersectionsSettings.insert( *avoidIt );
130-
}
131-
}
132-
133110
QgsMapLayer* currentLayer = 0;
134111

135112
QStringList noIdentifyLayerIdList = QgsProject::instance()->readListEntry( "Identify", "/disabledLayers" );
@@ -325,20 +302,6 @@ void QgsProjectProperties::apply()
325302
QgsProject::instance()->writeEntry( "Gui", "/CanvasColorGreenPart", myColor.green() );
326303
QgsProject::instance()->writeEntry( "Gui", "/CanvasColorBluePart", myColor.blue() );
327304

328-
//write the digitizing settings
329-
int topologicalEditingEnabled = ( mEnableTopologicalEditingCheckBox->checkState() == Qt::Checked ) ? 1 : 0;
330-
QgsProject::instance()->writeEntry( "Digitizing", "/TopologicalEditing", topologicalEditingEnabled );
331-
332-
//store avoid intersection layers
333-
QStringList avoidIntersectionList;
334-
QSet<QString>::const_iterator avoidIt = mAvoidIntersectionsSettings.constBegin();
335-
for ( ; avoidIt != mAvoidIntersectionsSettings.constEnd(); ++avoidIt )
336-
{
337-
avoidIntersectionList.append( *avoidIt );
338-
}
339-
QgsProject::instance()->writeEntry( "Digitizing", "/AvoidIntersectionsList", avoidIntersectionList );
340-
341-
342305
QStringList noIdentifyLayerList;
343306
for ( int i = 0; i < twIdentifyLayers->rowCount(); i++ )
344307
{
@@ -389,16 +352,6 @@ void QgsProjectProperties::on_pbnCanvasColor_clicked()
389352
}
390353
}
391354

392-
void QgsProjectProperties::on_mAvoidIntersectionsPushButton_clicked()
393-
{
394-
QgsAvoidIntersectionsDialog d( mMapCanvas, mAvoidIntersectionsSettings );
395-
if ( d.exec() == QDialog::Accepted )
396-
{
397-
d.enabledLayers( mAvoidIntersectionsSettings );
398-
}
399-
}
400-
401-
402355
void QgsProjectProperties::on_cbxProjectionEnabled_stateChanged( int state )
403356
{
404357
btnGrpMapUnits->setEnabled( state == Qt::Unchecked );

src/app/qgsprojectproperties.h

-8
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@ class QgsProjectProperties : public QDialog, private Ui::QgsProjectPropertiesBas
8989
*/
9090
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
9191

92-
/*!
93-
*
94-
*/
95-
void on_mAvoidIntersectionsPushButton_clicked();
96-
9792
void on_cbxProjectionEnabled_stateChanged( int state );
9893

9994
/*!
@@ -112,9 +107,6 @@ class QgsProjectProperties : public QDialog, private Ui::QgsProjectPropertiesBas
112107
private:
113108
QgsMapCanvas* mMapCanvas;
114109

115-
/**Stores ids of layers where intersections of new polygons is considered. Is passed to / read from QgsAvoidIntersectionsDialog*/
116-
QSet<QString> mAvoidIntersectionsSettings;
117-
118110
/*!
119111
* Function to save dialog window state
120112
*/

src/app/qgssnappingdialog.cpp

+51-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616
***************************************************************************/
1717

1818
#include "qgssnappingdialog.h"
19+
#include "qgsavoidintersectionsdialog.h"
1920
#include "qgsmapcanvas.h"
2021
#include "qgsmaplayer.h"
2122
#include "qgsvectorlayer.h"
2223
#include "qgsmaplayerregistry.h"
2324
#include "qgisapp.h"
2425
#include "qgsproject.h"
26+
#include "qgslogger.h"
2527
#include <QCheckBox>
2628
#include <QDoubleValidator>
2729
#include <QComboBox>
@@ -36,7 +38,7 @@ class QgsSnappingDock : public QDockWidget
3638
QgsSnappingDock( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 )
3739
: QDockWidget( title, parent, flags )
3840
{
39-
setObjectName( "Snapping Options" ); // set object name so the position can be saved
41+
setObjectName( "Snapping and Digitizing Options" ); // set object name so the position can be saved
4042
}
4143

4244
virtual void closeEvent( QCloseEvent * ev )
@@ -54,7 +56,7 @@ QgsSnappingDialog::QgsSnappingDialog( QWidget* parent, QgsMapCanvas* canvas ): Q
5456
bool myDockFlag = myQsettings.value( "/qgis/dockSnapping", false ).toBool();
5557
if ( myDockFlag )
5658
{
57-
mDock = new QgsSnappingDock( tr( "Snapping Options" ), QgisApp::instance() );
59+
mDock = new QgsSnappingDock( tr( "Snapping and Digitizing Options" ), QgisApp::instance() );
5860
mDock->setAllowedAreas( Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea );
5961
mDock->setWidget( this );
6062
connect( this, SIGNAL( destroyed() ), mDock, SLOT( close() ) );
@@ -67,6 +69,7 @@ QgsSnappingDialog::QgsSnappingDialog( QWidget* parent, QgsMapCanvas* canvas ): Q
6769
connect( mButtonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
6870
}
6971
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer * ) ), this, SLOT( connectUpdate( QgsMapLayer * ) ) );
72+
connect( cbxEnableTopologicalEditingCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( on_cbxEnableTopologicalEditingCheckBox_stateChanged( int ) ) );
7073

7174
update();
7275

@@ -87,6 +90,29 @@ QgsSnappingDialog::~QgsSnappingDialog()
8790
{
8891
}
8992

93+
void QgsSnappingDialog::on_cbxEnableTopologicalEditingCheckBox_stateChanged( int state )
94+
{
95+
int topologicalEditingEnabled = ( state == Qt::Checked ) ? 1 : 0;
96+
QgsProject::instance()->writeEntry( "Digitizing", "/TopologicalEditing", topologicalEditingEnabled );
97+
}
98+
99+
void QgsSnappingDialog::on_mAvoidIntersectionsPushButton_clicked()
100+
{
101+
QgsAvoidIntersectionsDialog d( mMapCanvas, mAvoidIntersectionsSettings );
102+
if ( d.exec() == QDialog::Accepted )
103+
{
104+
d.enabledLayers( mAvoidIntersectionsSettings );
105+
//store avoid intersection layers
106+
QStringList avoidIntersectionList;
107+
QSet<QString>::const_iterator avoidIt = mAvoidIntersectionsSettings.constBegin();
108+
for ( ; avoidIt != mAvoidIntersectionsSettings.constEnd(); ++avoidIt )
109+
{
110+
avoidIntersectionList.append( *avoidIt );
111+
}
112+
QgsProject::instance()->writeEntry( "Digitizing", "/AvoidIntersectionsList", avoidIntersectionList );
113+
}
114+
}
115+
90116
void QgsSnappingDialog::closeEvent( QCloseEvent* event )
91117
{
92118
QDialog::closeEvent( event );
@@ -201,6 +227,29 @@ void QgsSnappingDialog::update()
201227
cbxUnits->setCurrentIndex( toleranceUnitList[idx].toInt() );
202228
}
203229

230+
// read the digitizing settings
231+
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
232+
if ( topologicalEditing != 0 )
233+
{
234+
cbxEnableTopologicalEditingCheckBox->setCheckState( Qt::Checked );
235+
}
236+
else
237+
{
238+
cbxEnableTopologicalEditingCheckBox->setCheckState( Qt::Unchecked );
239+
}
240+
241+
bool avoidIntersectionListOk;
242+
mAvoidIntersectionsSettings.clear();
243+
QStringList avoidIntersectionsList = QgsProject::instance()->readListEntry( "Digitizing", "/AvoidIntersectionsList", &avoidIntersectionListOk );
244+
if ( avoidIntersectionListOk )
245+
{
246+
QStringList::const_iterator avoidIt = avoidIntersectionsList.constBegin();
247+
for ( ; avoidIt != avoidIntersectionsList.constEnd(); ++avoidIt )
248+
{
249+
mAvoidIntersectionsSettings.insert( *avoidIt );
250+
}
251+
}
252+
204253
if ( myDockFlag )
205254
{
206255
for ( int i = 0; i < mLayerTreeWidget->topLevelItemCount(); ++i )

src/app/qgssnappingdialog.h

+7
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ class QgsSnappingDialog: public QDialog, private Ui::QgsSnappingDialogBase
4848
//! connect to the layers destroyed() and then update()
4949
void connectUpdate( QgsMapLayer* theMapLayer );
5050

51+
void on_cbxEnableTopologicalEditingCheckBox_stateChanged( int );
52+
void on_mAvoidIntersectionsPushButton_clicked();
53+
5154
protected:
5255
/**Constructor
5356
@param canvas pointer to the map canvas (for detecting which vector layers are loaded
5457
*/
5558
//QgsSnappingDialog( QgsMapCanvas* canvas );
59+
5660
/**
5761
* Handle closing of the window
5862
* @param event unused
@@ -64,6 +68,9 @@ class QgsSnappingDialog: public QDialog, private Ui::QgsSnappingDialogBase
6468
/**Default constructor forbidden*/
6569
QgsSnappingDialog();
6670

71+
/**Stores ids of layers where intersections of new polygons is considered. Is passed to / read from QgsAvoidIntersectionsDialog*/
72+
QSet<QString> mAvoidIntersectionsSettings;
73+
6774
/**Used to query the loaded layers*/
6875
QgsMapCanvas* mMapCanvas;
6976

src/ui/qgsprojectpropertiesbase.ui

+1-32
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<item row="0" column="0">
2424
<widget class="QTabWidget" name="tabWidget">
2525
<property name="currentIndex">
26-
<number>1</number>
26+
<number>0</number>
2727
</property>
2828
<property name="iconSize">
2929
<size>
@@ -285,35 +285,6 @@
285285
</layout>
286286
</widget>
287287
</item>
288-
<item row="3" column="0">
289-
<widget class="QGroupBox" name="grpDigitizing">
290-
<property name="sizePolicy">
291-
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
292-
<horstretch>0</horstretch>
293-
<verstretch>0</verstretch>
294-
</sizepolicy>
295-
</property>
296-
<property name="title">
297-
<string>Digitizing</string>
298-
</property>
299-
<layout class="QGridLayout" name="gridLayout_1">
300-
<item row="0" column="0">
301-
<widget class="QCheckBox" name="mEnableTopologicalEditingCheckBox">
302-
<property name="text">
303-
<string>Enable topological editing</string>
304-
</property>
305-
</widget>
306-
</item>
307-
<item row="1" column="0">
308-
<widget class="QPushButton" name="mAvoidIntersectionsPushButton">
309-
<property name="text">
310-
<string>Avoid intersections of new polygons...</string>
311-
</property>
312-
</widget>
313-
</item>
314-
</layout>
315-
</widget>
316-
</item>
317288
</layout>
318289
</widget>
319290
<widget class="QWidget" name="tab2">
@@ -422,8 +393,6 @@
422393
<tabstop>radAutomatic</tabstop>
423394
<tabstop>radManual</tabstop>
424395
<tabstop>spinBoxDP</tabstop>
425-
<tabstop>mEnableTopologicalEditingCheckBox</tabstop>
426-
<tabstop>mAvoidIntersectionsPushButton</tabstop>
427396
<tabstop>cbxProjectionEnabled</tabstop>
428397
<tabstop>twIdentifyLayers</tabstop>
429398
<tabstop>tabWidget</tabstop>

src/ui/qgssnappingdialogbase.ui

+27-9
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,8 @@
1313
<property name="windowTitle">
1414
<string>Snapping options</string>
1515
</property>
16-
<layout class="QGridLayout">
17-
<property name="margin">
18-
<number>9</number>
19-
</property>
20-
<property name="spacing">
21-
<number>6</number>
22-
</property>
23-
<item row="0" column="0">
16+
<layout class="QVBoxLayout" name="verticalLayout">
17+
<item>
2418
<widget class="QTreeWidget" name="mLayerTreeWidget">
2519
<property name="indentation">
2620
<number>0</number>
@@ -55,7 +49,31 @@
5549
</column>
5650
</widget>
5751
</item>
58-
<item row="1" column="0">
52+
<item>
53+
<layout class="QHBoxLayout" name="horizontalLayout">
54+
<item>
55+
<widget class="QCheckBox" name="cbxEnableTopologicalEditingCheckBox">
56+
<property name="text">
57+
<string>Enable topological editing</string>
58+
</property>
59+
<property name="checked">
60+
<bool>false</bool>
61+
</property>
62+
<property name="tristate">
63+
<bool>false</bool>
64+
</property>
65+
</widget>
66+
</item>
67+
<item>
68+
<widget class="QPushButton" name="mAvoidIntersectionsPushButton">
69+
<property name="text">
70+
<string>Avoid intersections of new polygons...</string>
71+
</property>
72+
</widget>
73+
</item>
74+
</layout>
75+
</item>
76+
<item>
5977
<widget class="QDialogButtonBox" name="mButtonBox">
6078
<property name="orientation">
6179
<enum>Qt::Horizontal</enum>

0 commit comments

Comments
 (0)