Skip to content

Commit 24b8dcc

Browse files
committedMar 18, 2019
Use a hidden setting for activating geomtery resolution
1 parent cd33ee7 commit 24b8dcc

File tree

8 files changed

+18
-96
lines changed

8 files changed

+18
-96
lines changed
 

‎python/core/auto_generated/qgsgeometryoptions.sip.in

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -116,24 +116,6 @@ Write the geometry options to the ``node``.
116116
Read the geometry options from ``node``.
117117

118118
.. versionadded:: 3.4
119-
%End
120-
121-
bool automaticProblemResolutionEnabled() const;
122-
%Docstring
123-
Automatic problem resolution offers strategies to fix errors with
124-
a single click.
125-
This is currently experimental
126-
127-
.. versionadded:: 3.8
128-
%End
129-
130-
void setAutomaticProblemResolutionEnabled( bool automaticProblemResolutionEnabled );
131-
%Docstring
132-
Automatic problem resolution offers strategies to fix errors with
133-
a single click.
134-
This is currently experimental
135-
136-
.. versionadded:: 3.8
137119
%End
138120

139121
signals:
@@ -166,11 +148,6 @@ Geometries which are edited on this layer will be rounded to multiples of this v
166148
Set to 0.0 to disable.
167149

168150
.. versionadded:: 3.4
169-
%End
170-
171-
void automaticProblemResolutionEnabledChanged();
172-
%Docstring
173-
Defines if the automatic fixes
174151
%End
175152

176153
};

‎resources/qgis_global_settings.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,7 @@ maxEntriesRelationWidget=100
8787
# A comma separated list of geometry validations to enable by default for newly added layers
8888
# Available checks: QgsIsValidCheck,QgsGeometryGapCheck,QgsGeometryOverlapCheck,QgsGeometryMissingVertexCheck
8989
default_checks=
90+
91+
# Enable problem resolution for geometry errors
92+
# This feature is experimental and has known issues.
93+
enable_problem_resolution=false

‎src/app/qgsgeometryvalidationdock.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ QgsGeometryValidationDock::QgsGeometryValidationDock( const QString &title, QgsM
7070
mErrorLocationRubberband->setColor( QColor( 50, 255, 50, 255 ) );
7171

7272
mProblemDetailWidget->setVisible( false );
73-
}
7473

74+
// Problem resolution is unstable and therefore disabled by default
75+
mResolutionWidget->setVisible( QgsSettings().value( QStringLiteral( "geometry_validation/enable_problem_resolution" ) ) == QLatin1String( "true" ) );
76+
}
7577

7678
QgsGeometryValidationModel *QgsGeometryValidationDock::geometryValidationModel() const
7779
{
@@ -164,14 +166,6 @@ void QgsGeometryValidationDock::onRowsInserted()
164166
setUserVisible( true );
165167
}
166168

167-
void QgsGeometryValidationDock::updateResolutionWidgetVisibility()
168-
{
169-
if ( !mCurrentLayer )
170-
return;
171-
172-
mResolutionWidget->setVisible( mCurrentLayer->geometryOptions()->automaticProblemResolutionEnabled() );
173-
}
174-
175169
QgsGeometryValidationService *QgsGeometryValidationDock::geometryValidationService() const
176170
{
177171
return mGeometryValidationService;
@@ -283,8 +277,6 @@ void QgsGeometryValidationDock::onCurrentLayerChanged( QgsMapLayer *layer )
283277
disconnect( mCurrentLayer, &QgsVectorLayer::editingStarted, this, &QgsGeometryValidationDock::onLayerEditingStatusChanged );
284278
disconnect( mCurrentLayer, &QgsVectorLayer::editingStopped, this, &QgsGeometryValidationDock::onLayerEditingStatusChanged );
285279
disconnect( mCurrentLayer, &QgsVectorLayer::destroyed, this, &QgsGeometryValidationDock::onLayerDestroyed );
286-
disconnect( mCurrentLayer->geometryOptions(), &QgsGeometryOptions::automaticProblemResolutionEnabledChanged, this, &QgsGeometryValidationDock::updateResolutionWidgetVisibility );
287-
updateResolutionWidgetVisibility();
288280
}
289281

290282
mCurrentLayer = qobject_cast<QgsVectorLayer *>( layer );
@@ -294,7 +286,6 @@ void QgsGeometryValidationDock::onCurrentLayerChanged( QgsMapLayer *layer )
294286
connect( mCurrentLayer, &QgsVectorLayer::editingStarted, this, &QgsGeometryValidationDock::onLayerEditingStatusChanged );
295287
connect( mCurrentLayer, &QgsVectorLayer::editingStopped, this, &QgsGeometryValidationDock::onLayerEditingStatusChanged );
296288
connect( mCurrentLayer, &QgsVectorLayer::destroyed, this, &QgsGeometryValidationDock::onLayerDestroyed );
297-
connect( mCurrentLayer->geometryOptions(), &QgsGeometryOptions::automaticProblemResolutionEnabledChanged, this, &QgsGeometryValidationDock::updateResolutionWidgetVisibility );
298289
}
299290

300291
onLayerEditingStatusChanged();

‎src/app/qgsgeometryvalidationdock.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ class QgsGeometryValidationDock : public QgsDockWidget, public Ui_QgsGeometryVal
5757
void updateLayerTransform();
5858
void onDataChanged( const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles );
5959
void onRowsInserted();
60-
void updateResolutionWidgetVisibility();
6160

6261
private:
6362

‎src/app/qgsvectorlayerproperties.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,14 +463,12 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
463463
}
464464
mTopologyChecksGroupBox->setLayout( topologyCheckLayout );
465465
mTopologyChecksGroupBox->setVisible( !topologyCheckFactories.isEmpty() );
466-
mAutomaticProblemResolutionCheckbox->setChecked( mLayer->geometryOptions()->automaticProblemResolutionEnabled() );
467466
}
468467
else
469468
{
470469
mRemoveDuplicateNodesCheckbox->setEnabled( false );
471470
mGeometryPrecisionLineEdit->setEnabled( false );
472471
mGeometryAutoFixesGroupBox->setEnabled( false );
473-
mAutomaticProblemResolutionCheckbox->setEnabled( false );
474472
}
475473

476474
mOptsPage_Information->setProperty( "helpPage", QStringLiteral( "working_with_vector/vector_properties.html#information-properties" ) );
@@ -841,7 +839,6 @@ void QgsVectorLayerProperties::apply()
841839
activeChecks << it.value();
842840
}
843841
mLayer->geometryOptions()->setGeometryChecks( activeChecks );
844-
mLayer->geometryOptions()->setAutomaticProblemResolutionEnabled( mAutomaticProblemResolutionCheckbox->isChecked() );
845842

846843
mLayer->triggerRepaint();
847844
// notify the project we've made a change

‎src/core/qgsgeometryoptions.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,3 @@ void QgsGeometryOptions::readXml( const QDomNode &node )
115115
const QVariant checkConfiguration = QgsXmlUtils::readVariant( checkConfigurationElem );
116116
mCheckConfiguration = checkConfiguration.toMap();
117117
}
118-
119-
bool QgsGeometryOptions::automaticProblemResolutionEnabled() const
120-
{
121-
return mAutomaticProblemResolutionEnabled;
122-
}
123-
124-
void QgsGeometryOptions::setAutomaticProblemResolutionEnabled( bool automaticFixesEnabled )
125-
{
126-
if ( automaticFixesEnabled != mAutomaticProblemResolutionEnabled )
127-
mAutomaticProblemResolutionEnabled = automaticFixesEnabled;
128-
emit automaticProblemResolutionEnabledChanged();
129-
}

‎src/core/qgsgeometryoptions.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -131,24 +131,6 @@ class CORE_EXPORT QgsGeometryOptions : public QObject
131131
*/
132132
void readXml( const QDomNode &node );
133133

134-
/**
135-
* Automatic problem resolution offers strategies to fix errors with
136-
* a single click.
137-
* This is currently experimental
138-
*
139-
* \since QGIS 3.8
140-
*/
141-
bool automaticProblemResolutionEnabled() const;
142-
143-
/**
144-
* Automatic problem resolution offers strategies to fix errors with
145-
* a single click.
146-
* This is currently experimental
147-
*
148-
* \since QGIS 3.8
149-
*/
150-
void setAutomaticProblemResolutionEnabled( bool automaticProblemResolutionEnabled );
151-
152134
signals:
153135

154136
/**
@@ -181,11 +163,6 @@ class CORE_EXPORT QgsGeometryOptions : public QObject
181163
*/
182164
void geometryPrecisionChanged();
183165

184-
/**
185-
* Defines if the automatic fixes
186-
*/
187-
void automaticProblemResolutionEnabledChanged();
188-
189166
private:
190167

191168
/**
@@ -206,7 +183,6 @@ class CORE_EXPORT QgsGeometryOptions : public QObject
206183

207184
QStringList mGeometryChecks;
208185
QVariantMap mCheckConfiguration;
209-
bool mAutomaticProblemResolutionEnabled = false;
210186
};
211187

212188
#endif // QGSGEOMETRYOPTIONS_H

‎src/ui/qgsvectorlayerpropertiesbase.ui

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,8 @@
436436
<rect>
437437
<x>0</x>
438438
<y>0</y>
439-
<width>315</width>
440-
<height>403</height>
439+
<width>662</width>
440+
<height>804</height>
441441
</rect>
442442
</property>
443443
<layout class="QVBoxLayout" name="verticalLayout_9">
@@ -724,8 +724,8 @@ border-radius: 2px;</string>
724724
<rect>
725725
<x>0</x>
726726
<y>0</y>
727-
<width>100</width>
728-
<height>30</height>
727+
<width>662</width>
728+
<height>804</height>
729729
</rect>
730730
</property>
731731
<layout class="QVBoxLayout" name="verticalLayout_18">
@@ -910,8 +910,8 @@ border-radius: 2px;</string>
910910
<rect>
911911
<x>0</x>
912912
<y>0</y>
913-
<width>113</width>
914-
<height>110</height>
913+
<width>662</width>
914+
<height>804</height>
915915
</rect>
916916
</property>
917917
<layout class="QVBoxLayout" name="verticalLayout_23">
@@ -1305,8 +1305,8 @@ border-radius: 2px;</string>
13051305
<rect>
13061306
<x>0</x>
13071307
<y>0</y>
1308-
<width>100</width>
1309-
<height>30</height>
1308+
<width>662</width>
1309+
<height>804</height>
13101310
</rect>
13111311
</property>
13121312
<layout class="QVBoxLayout" name="verticalLayout_21">
@@ -1508,7 +1508,7 @@ border-radius: 2px;</string>
15081508
<x>0</x>
15091509
<y>0</y>
15101510
<width>734</width>
1511-
<height>372</height>
1511+
<height>790</height>
15121512
</rect>
15131513
</property>
15141514
<layout class="QVBoxLayout" name="verticalLayout_32">
@@ -1964,8 +1964,8 @@ border-radius: 2px;</string>
19641964
<rect>
19651965
<x>0</x>
19661966
<y>0</y>
1967-
<width>378</width>
1968-
<height>678</height>
1967+
<width>662</width>
1968+
<height>804</height>
19691969
</rect>
19701970
</property>
19711971
<layout class="QVBoxLayout" name="verticalLayout_13">
@@ -2439,16 +2439,6 @@ border-radius: 2px;</string>
24392439
</property>
24402440
</widget>
24412441
</item>
2442-
<item>
2443-
<widget class="QCheckBox" name="mAutomaticProblemResolutionCheckbox">
2444-
<property name="toolTip">
2445-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This enables additional buttons for check results that will automatically fix problems.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Experimental&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This functionality is tagged as experimental since some of the automatic fixes do not work completely reliable.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
2446-
</property>
2447-
<property name="text">
2448-
<string>Offer automatic problem resolution (Experimental)</string>
2449-
</property>
2450-
</widget>
2451-
</item>
24522442
<item>
24532443
<spacer name="verticalSpacer_4">
24542444
<property name="orientation">

0 commit comments

Comments
 (0)
Please sign in to comment.