Patch3258.diff
src/app/qgssnappingdialog.cpp (working copy) | ||
---|---|---|
16 | 16 |
***************************************************************************/ |
17 | 17 | |
18 | 18 |
#include "qgssnappingdialog.h" |
19 |
#include "qgsavoidintersectionsdialog.h" |
|
19 | 20 |
#include "qgsmapcanvas.h" |
20 | 21 |
#include "qgsmaplayer.h" |
21 | 22 |
#include "qgsvectorlayer.h" |
22 | 23 |
#include "qgsmaplayerregistry.h" |
23 | 24 |
#include "qgisapp.h" |
24 | 25 |
#include "qgsproject.h" |
26 |
#include "qgslogger.h" |
|
25 | 27 |
#include <QCheckBox> |
26 | 28 |
#include <QDoubleValidator> |
27 | 29 |
#include <QComboBox> |
... | ... | |
35 | 37 |
QgsSnappingDock( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 ) |
36 | 38 |
: QDockWidget( title, parent, flags ) |
37 | 39 |
{ |
38 |
setObjectName( "Snapping Options" ); // set object name so the position can be saved |
|
40 |
setObjectName( "Snapping and Digitizing Options" ); // set object name so the position can be saved
|
|
39 | 41 |
} |
40 | 42 | |
41 | 43 |
virtual void closeEvent( QCloseEvent * ev ) |
... | ... | |
53 | 55 |
bool myDockFlag = myQsettings.value( "/qgis/dockSnapping", false ).toBool(); |
54 | 56 |
if ( myDockFlag ) |
55 | 57 |
{ |
56 |
mDock = new QgsSnappingDock( tr( "Snapping Options" ), QgisApp::instance() ); |
|
58 |
mDock = new QgsSnappingDock( tr( "Snapping and Digitizing Options" ), QgisApp::instance() );
|
|
57 | 59 |
mDock->setAllowedAreas( Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea ); |
58 | 60 |
mDock->setWidget( this ); |
59 | 61 |
connect( this, SIGNAL( destroyed() ), mDock, SLOT( close() ) ); |
... | ... | |
66 | 68 |
} |
67 | 69 |
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer * ) ), this, SLOT( update() ) ); |
68 | 70 |
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( update() ) ); |
71 |
connect( cbxEnableTopologicalEditingCheckBox, SIGNAL( stateChanged( int ) ),this, SLOT( on_cbxEnableTopologicalEditingCheckBox_stateChanged(int) ) ); |
|
69 | 72 | |
73 | ||
70 | 74 |
update(); |
71 | 75 | |
72 | 76 |
mLayerTreeWidget->setHeaderLabels( QStringList() << "" ); |
... | ... | |
86 | 90 |
{ |
87 | 91 |
} |
88 | 92 | |
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 | ||
89 | 116 |
void QgsSnappingDialog::closeEvent( QCloseEvent* event ) |
90 | 117 |
{ |
91 | 118 |
QDialog::closeEvent( event ); |
... | ... | |
196 | 223 |
cbxSnapTo->setCurrentIndex( snappingStringIdx ); |
197 | 224 |
leTolerance->setText( QString::number( toleranceList[idx].toDouble(), 'f' ) ); |
198 | 225 |
cbxUnits->setCurrentIndex( toleranceUnitList[idx].toInt() ); |
226 | ||
227 |
//read the digitizing settings |
|
228 |
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 ); |
|
229 |
if ( topologicalEditing != 0 ) |
|
230 |
{ |
|
231 |
cbxEnableTopologicalEditingCheckBox->setCheckState( Qt::Checked ); |
|
232 |
} |
|
233 |
else |
|
234 |
{ |
|
235 |
cbxEnableTopologicalEditingCheckBox->setCheckState( Qt::Unchecked ); |
|
236 |
} |
|
237 | ||
238 |
bool avoidIntersectionListOk; |
|
239 |
mAvoidIntersectionsSettings.clear(); |
|
240 |
QStringList avoidIntersectionsList = QgsProject::instance()->readListEntry( "Digitizing", "/AvoidIntersectionsList", &avoidIntersectionListOk ); |
|
241 |
if ( avoidIntersectionListOk ) |
|
242 |
{ |
|
243 |
QStringList::const_iterator avoidIt = avoidIntersectionsList.constBegin(); |
|
244 |
for ( ; avoidIt != avoidIntersectionsList.constEnd(); ++avoidIt ) |
|
245 |
{ |
|
246 |
mAvoidIntersectionsSettings.insert( *avoidIt ); |
|
247 |
} |
|
248 |
} |
|
199 | 249 |
} |
200 | 250 | |
201 | 251 |
if ( myDockFlag ) |
src/app/qgsprojectproperties.cpp (working copy) | ||
---|---|---|
107 | 107 |
myColor = QColor( myRedInt, myGreenInt, myBlueInt ); |
108 | 108 |
pbnCanvasColor->setColor( myColor ); |
109 | 109 | |
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 | 110 | |
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 | ||
133 | 111 |
QgsMapLayer* currentLayer = 0; |
134 | 112 | |
135 | 113 |
QStringList noIdentifyLayerIdList = QgsProject::instance()->readListEntry( "Identify", "/disabledLayers" ); |
... | ... | |
325 | 303 |
QgsProject::instance()->writeEntry( "Gui", "/CanvasColorGreenPart", myColor.green() ); |
326 | 304 |
QgsProject::instance()->writeEntry( "Gui", "/CanvasColorBluePart", myColor.blue() ); |
327 | 305 | |
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 | ||
342 | 306 |
QStringList noIdentifyLayerList; |
343 | 307 |
for ( int i = 0; i < twIdentifyLayers->rowCount(); i++ ) |
344 | 308 |
{ |
... | ... | |
389 | 353 |
} |
390 | 354 |
} |
391 | 355 | |
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 | ||
402 | 356 |
void QgsProjectProperties::on_cbxProjectionEnabled_stateChanged( int state ) |
403 | 357 |
{ |
404 | 358 |
btnGrpMapUnits->setEnabled( state == Qt::Unchecked ); |
src/app/qgssnappingdialog.h (working copy) | ||
---|---|---|
44 | 44 |
//! update the Dialog |
45 | 45 |
void update(); |
46 | 46 | |
47 |
void on_cbxEnableTopologicalEditingCheckBox_stateChanged( int ); |
|
48 | ||
49 |
/*! |
|
50 |
* |
|
51 |
*/ |
|
52 |
void on_mAvoidIntersectionsPushButton_clicked(); |
|
53 | ||
47 | 54 |
//! show dialog or dock |
48 | 55 |
void show(); |
49 | 56 | |
... | ... | |
60 | 67 | |
61 | 68 | |
62 | 69 |
private: |
70 |
/**Stores ids of layers where intersections of new polygons is considered. Is passed to / read from QgsAvoidIntersectionsDialog*/ |
|
71 |
QSet<QString> mAvoidIntersectionsSettings; |
|
72 | ||
63 | 73 |
/**Default constructor forbidden*/ |
64 | 74 |
QgsSnappingDialog(); |
65 | 75 |
src/app/qgsprojectproperties.h (working copy) | ||
---|---|---|
89 | 89 |
*/ |
90 | 90 |
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); } |
91 | 91 | |
92 |
/*! |
|
93 |
* |
|
94 |
*/ |
|
95 |
void on_mAvoidIntersectionsPushButton_clicked(); |
|
96 | ||
97 | 92 |
void on_cbxProjectionEnabled_stateChanged( int state ); |
98 | 93 | |
99 | 94 |
/*! |
... | ... | |
112 | 107 |
private: |
113 | 108 |
QgsMapCanvas* mMapCanvas; |
114 | 109 | |
115 |
/**Stores ids of layers where intersections of new polygons is considered. Is passed to / read from QgsAvoidIntersectionsDialog*/ |
|
116 |
QSet<QString> mAvoidIntersectionsSettings; |
|
117 | ||
118 | 110 |
/*! |
119 | 111 |
* Function to save dialog window state |
120 | 112 |
*/ |
src/ui/qgssnappingdialogbase.ui (working copy) | ||
---|---|---|
6 | 6 |
<rect> |
7 | 7 |
<x>0</x> |
8 | 8 |
<y>0</y> |
9 |
<width>644</width>
|
|
10 |
<height>290</height>
|
|
9 |
<width>688</width>
|
|
10 |
<height>402</height>
|
|
11 | 11 |
</rect> |
12 | 12 |
</property> |
13 | 13 |
<property name="windowTitle"> |
... | ... | |
22 | 22 |
</property> |
23 | 23 |
<item row="0" column="0"> |
24 | 24 |
<widget class="QTreeWidget" name="mLayerTreeWidget"> |
25 |
<property name="enabled"> |
|
26 |
<bool>true</bool> |
|
27 |
</property> |
|
28 |
<property name="sizePolicy"> |
|
29 |
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> |
|
30 |
<horstretch>0</horstretch> |
|
31 |
<verstretch>0</verstretch> |
|
32 |
</sizepolicy> |
|
33 |
</property> |
|
34 |
<property name="autoFillBackground"> |
|
35 |
<bool>false</bool> |
|
36 |
</property> |
|
37 |
<property name="styleSheet"> |
|
38 |
<string notr="true"/> |
|
39 |
</property> |
|
40 |
<property name="frameShadow"> |
|
41 |
<enum>QFrame::Sunken</enum> |
|
42 |
</property> |
|
25 | 43 |
<property name="indentation"> |
26 | 44 |
<number>0</number> |
27 | 45 |
</property> |
... | ... | |
30 | 48 |
</property> |
31 | 49 |
<column> |
32 | 50 |
<property name="text"> |
33 |
<string> </string>
|
|
51 |
<string/>
|
|
34 | 52 |
</property> |
35 | 53 |
</column> |
36 | 54 |
<column> |
... | ... | |
56 | 74 |
</widget> |
57 | 75 |
</item> |
58 | 76 |
<item row="1" column="0"> |
77 |
<widget class="QCheckBox" name="cbxEnableTopologicalEditingCheckBox"> |
|
78 |
<property name="text"> |
|
79 |
<string>Enable topological editing</string> |
|
80 |
</property> |
|
81 |
<property name="checked"> |
|
82 |
<bool>false</bool> |
|
83 |
</property> |
|
84 |
<property name="tristate"> |
|
85 |
<bool>false</bool> |
|
86 |
</property> |
|
87 |
</widget> |
|
88 |
</item> |
|
89 |
<item row="2" column="0"> |
|
90 |
<widget class="QPushButton" name="mAvoidIntersectionsPushButton"> |
|
91 |
<property name="text"> |
|
92 |
<string>Avoid intersections of new polygons...</string> |
|
93 |
</property> |
|
94 |
</widget> |
|
95 |
</item> |
|
96 |
<item row="3" column="0"> |
|
59 | 97 |
<widget class="QDialogButtonBox" name="mButtonBox"> |
60 | 98 |
<property name="orientation"> |
61 | 99 |
<enum>Qt::Horizontal</enum> |
src/ui/qgsprojectpropertiesbase.ui (working copy) | ||
---|---|---|
23 | 23 |
<item row="0" column="0"> |
24 | 24 |
<widget class="QTabWidget" name="tabWidget"> |
25 | 25 |
<property name="currentIndex"> |
26 |
<number>1</number>
|
|
26 |
<number>0</number>
|
|
27 | 27 |
</property> |
28 | 28 |
<property name="iconSize"> |
29 | 29 |
<size> |
... | ... | |
285 | 285 |
</layout> |
286 | 286 |
</widget> |
287 | 287 |
</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> |
|
317 | 288 |
</layout> |
318 | 289 |
</widget> |
319 | 290 |
<widget class="QWidget" name="tab2"> |
... | ... | |
422 | 393 |
<tabstop>radAutomatic</tabstop> |
423 | 394 |
<tabstop>radManual</tabstop> |
424 | 395 |
<tabstop>spinBoxDP</tabstop> |
425 |
<tabstop>mEnableTopologicalEditingCheckBox</tabstop> |
|
426 |
<tabstop>mAvoidIntersectionsPushButton</tabstop> |
|
427 | 396 |
<tabstop>cbxProjectionEnabled</tabstop> |
428 | 397 |
<tabstop>twIdentifyLayers</tabstop> |
429 | 398 |
<tabstop>tabWidget</tabstop> |