|
20 | 20 | #include "qgsprojectproperties.h" |
21 | 21 |
|
22 | 22 | //qgis includes |
| 23 | +#include "qgsavoidintersectionsdialog.h" |
23 | 24 | #include "qgscontexthelp.h" |
24 | 25 | #include "qgscoordinatetransform.h" |
25 | 26 | #include "qgslogger.h" |
@@ -113,14 +114,16 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa |
113 | 114 | mEnableTopologicalEditingCheckBox->setCheckState( Qt::Unchecked ); |
114 | 115 | } |
115 | 116 |
|
116 | | - int avoidPolygonIntersections = QgsProject::instance()->readNumEntry( "Digitizing", "/AvoidPolygonIntersections", 0 ); |
117 | | - if ( avoidPolygonIntersections != 0 ) |
| 117 | + bool avoidIntersectionListOk; |
| 118 | + mAvoidIntersectionsSettings.clear(); |
| 119 | + QStringList avoidIntersectionsList = QgsProject::instance()->readListEntry( "Digitizing", "/AvoidIntersectionsList", &avoidIntersectionListOk ); |
| 120 | + if ( avoidIntersectionListOk ) |
118 | 121 | { |
119 | | - mAvoidIntersectionsCheckBox->setCheckState( Qt::Checked ); |
120 | | - } |
121 | | - else |
122 | | - { |
123 | | - mAvoidIntersectionsCheckBox->setCheckState( Qt::Unchecked ); |
| 122 | + QStringList::const_iterator avoidIt = avoidIntersectionsList.constBegin(); |
| 123 | + for ( ; avoidIt != avoidIntersectionsList.constEnd(); ++avoidIt ) |
| 124 | + { |
| 125 | + mAvoidIntersectionsSettings.insert( *avoidIt ); |
| 126 | + } |
124 | 127 | } |
125 | 128 |
|
126 | 129 | bool layerIdListOk, enabledListOk, toleranceListOk, toleranceUnitListOk, snapToListOk; |
@@ -399,8 +402,16 @@ void QgsProjectProperties::apply() |
399 | 402 | //write the digitizing settings |
400 | 403 | int topologicalEditingEnabled = ( mEnableTopologicalEditingCheckBox->checkState() == Qt::Checked ) ? 1 : 0; |
401 | 404 | QgsProject::instance()->writeEntry( "Digitizing", "/TopologicalEditing", topologicalEditingEnabled ); |
402 | | - int avoidPolygonIntersectionsEnabled = ( mAvoidIntersectionsCheckBox->checkState() == Qt::Checked ) ? 1 : 0; |
403 | | - QgsProject::instance()->writeEntry( "Digitizing", "/AvoidPolygonIntersections", avoidPolygonIntersectionsEnabled ); |
| 405 | + |
| 406 | + //store avoid intersection layers |
| 407 | + QStringList avoidIntersectionList; |
| 408 | + QSet<QString>::const_iterator avoidIt = mAvoidIntersectionsSettings.constBegin(); |
| 409 | + for ( ; avoidIt != mAvoidIntersectionsSettings.constEnd(); ++avoidIt ) |
| 410 | + { |
| 411 | + avoidIntersectionList.append( *avoidIt ); |
| 412 | + } |
| 413 | + QgsProject::instance()->writeEntry( "Digitizing", "/AvoidIntersectionsList", avoidIntersectionList ); |
| 414 | + |
404 | 415 |
|
405 | 416 | QMap<QString, LayerEntry>::const_iterator layerEntryIt; |
406 | 417 |
|
@@ -498,6 +509,15 @@ void QgsProjectProperties::on_buttonBox_helpRequested() |
498 | 509 | QgsContextHelp::run( context_id ); |
499 | 510 | } |
500 | 511 |
|
| 512 | +void QgsProjectProperties::on_mAvoidIntersectionsPushButton_clicked() |
| 513 | +{ |
| 514 | + QgsAvoidIntersectionsDialog d( mMapCanvas, mAvoidIntersectionsSettings ); |
| 515 | + if ( d.exec() == QDialog::Accepted ) |
| 516 | + { |
| 517 | + d.enabledLayers( mAvoidIntersectionsSettings ); |
| 518 | + } |
| 519 | +} |
| 520 | + |
501 | 521 | void QgsProjectProperties::on_mSnappingOptionsPushButton_clicked() |
502 | 522 | { |
503 | 523 | QgsSnappingDialog d( mMapCanvas, mSnappingLayerSettings ); |
|
0 commit comments