Skip to content
Permalink
Browse files

Use a hidden setting for activating geomtery resolution

  • Loading branch information
m-kuhn committed Mar 18, 2019
1 parent cd33ee7 commit 24b8dcc692957c9fae5771d5e8cc4e7ede3f973b
@@ -116,24 +116,6 @@ Write the geometry options to the ``node``.
Read the geometry options from ``node``.

.. versionadded:: 3.4
%End

bool automaticProblemResolutionEnabled() const;
%Docstring
Automatic problem resolution offers strategies to fix errors with
a single click.
This is currently experimental

.. versionadded:: 3.8
%End

void setAutomaticProblemResolutionEnabled( bool automaticProblemResolutionEnabled );
%Docstring
Automatic problem resolution offers strategies to fix errors with
a single click.
This is currently experimental

.. versionadded:: 3.8
%End

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

.. versionadded:: 3.4
%End

void automaticProblemResolutionEnabledChanged();
%Docstring
Defines if the automatic fixes
%End

};
@@ -87,3 +87,7 @@ maxEntriesRelationWidget=100
# A comma separated list of geometry validations to enable by default for newly added layers
# Available checks: QgsIsValidCheck,QgsGeometryGapCheck,QgsGeometryOverlapCheck,QgsGeometryMissingVertexCheck
default_checks=

# Enable problem resolution for geometry errors
# This feature is experimental and has known issues.
enable_problem_resolution=false
@@ -70,8 +70,10 @@ QgsGeometryValidationDock::QgsGeometryValidationDock( const QString &title, QgsM
mErrorLocationRubberband->setColor( QColor( 50, 255, 50, 255 ) );

mProblemDetailWidget->setVisible( false );
}

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

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

void QgsGeometryValidationDock::updateResolutionWidgetVisibility()
{
if ( !mCurrentLayer )
return;

mResolutionWidget->setVisible( mCurrentLayer->geometryOptions()->automaticProblemResolutionEnabled() );
}

QgsGeometryValidationService *QgsGeometryValidationDock::geometryValidationService() const
{
return mGeometryValidationService;
@@ -283,8 +277,6 @@ void QgsGeometryValidationDock::onCurrentLayerChanged( QgsMapLayer *layer )
disconnect( mCurrentLayer, &QgsVectorLayer::editingStarted, this, &QgsGeometryValidationDock::onLayerEditingStatusChanged );
disconnect( mCurrentLayer, &QgsVectorLayer::editingStopped, this, &QgsGeometryValidationDock::onLayerEditingStatusChanged );
disconnect( mCurrentLayer, &QgsVectorLayer::destroyed, this, &QgsGeometryValidationDock::onLayerDestroyed );
disconnect( mCurrentLayer->geometryOptions(), &QgsGeometryOptions::automaticProblemResolutionEnabledChanged, this, &QgsGeometryValidationDock::updateResolutionWidgetVisibility );
updateResolutionWidgetVisibility();
}

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

onLayerEditingStatusChanged();
@@ -57,7 +57,6 @@ class QgsGeometryValidationDock : public QgsDockWidget, public Ui_QgsGeometryVal
void updateLayerTransform();
void onDataChanged( const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles );
void onRowsInserted();
void updateResolutionWidgetVisibility();

private:

@@ -463,14 +463,12 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
}
mTopologyChecksGroupBox->setLayout( topologyCheckLayout );
mTopologyChecksGroupBox->setVisible( !topologyCheckFactories.isEmpty() );
mAutomaticProblemResolutionCheckbox->setChecked( mLayer->geometryOptions()->automaticProblemResolutionEnabled() );
}
else
{
mRemoveDuplicateNodesCheckbox->setEnabled( false );
mGeometryPrecisionLineEdit->setEnabled( false );
mGeometryAutoFixesGroupBox->setEnabled( false );
mAutomaticProblemResolutionCheckbox->setEnabled( false );
}

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

mLayer->triggerRepaint();
// notify the project we've made a change
@@ -115,15 +115,3 @@ void QgsGeometryOptions::readXml( const QDomNode &node )
const QVariant checkConfiguration = QgsXmlUtils::readVariant( checkConfigurationElem );
mCheckConfiguration = checkConfiguration.toMap();
}

bool QgsGeometryOptions::automaticProblemResolutionEnabled() const
{
return mAutomaticProblemResolutionEnabled;
}

void QgsGeometryOptions::setAutomaticProblemResolutionEnabled( bool automaticFixesEnabled )
{
if ( automaticFixesEnabled != mAutomaticProblemResolutionEnabled )
mAutomaticProblemResolutionEnabled = automaticFixesEnabled;
emit automaticProblemResolutionEnabledChanged();
}
@@ -131,24 +131,6 @@ class CORE_EXPORT QgsGeometryOptions : public QObject
*/
void readXml( const QDomNode &node );

/**
* Automatic problem resolution offers strategies to fix errors with
* a single click.
* This is currently experimental
*
* \since QGIS 3.8
*/
bool automaticProblemResolutionEnabled() const;

/**
* Automatic problem resolution offers strategies to fix errors with
* a single click.
* This is currently experimental
*
* \since QGIS 3.8
*/
void setAutomaticProblemResolutionEnabled( bool automaticProblemResolutionEnabled );

signals:

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

/**
* Defines if the automatic fixes
*/
void automaticProblemResolutionEnabledChanged();

private:

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

QStringList mGeometryChecks;
QVariantMap mCheckConfiguration;
bool mAutomaticProblemResolutionEnabled = false;
};

#endif // QGSGEOMETRYOPTIONS_H
@@ -436,8 +436,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>315</width>
<height>403</height>
<width>662</width>
<height>804</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
@@ -724,8 +724,8 @@ border-radius: 2px;</string>
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
<width>662</width>
<height>804</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_18">
@@ -910,8 +910,8 @@ border-radius: 2px;</string>
<rect>
<x>0</x>
<y>0</y>
<width>113</width>
<height>110</height>
<width>662</width>
<height>804</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
@@ -1305,8 +1305,8 @@ border-radius: 2px;</string>
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
<width>662</width>
<height>804</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_21">
@@ -1508,7 +1508,7 @@ border-radius: 2px;</string>
<x>0</x>
<y>0</y>
<width>734</width>
<height>372</height>
<height>790</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_32">
@@ -1964,8 +1964,8 @@ border-radius: 2px;</string>
<rect>
<x>0</x>
<y>0</y>
<width>378</width>
<height>678</height>
<width>662</width>
<height>804</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
@@ -2439,16 +2439,6 @@ border-radius: 2px;</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="mAutomaticProblemResolutionCheckbox">
<property name="toolTip">
<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>
</property>
<property name="text">
<string>Offer automatic problem resolution (Experimental)</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">

0 comments on commit 24b8dcc

Please sign in to comment.
You can’t perform that action at this time.