Skip to content

Commit

Permalink
Add topology checks to configuration interface
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Oct 15, 2018
1 parent d85c0a7 commit 88ef921
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -412,17 +412,29 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(

mPrecisionUnitsLabel->setText( QStringLiteral( "[%1]" ).arg( QgsUnitTypes::toAbbreviatedString( mLayer->crs().mapUnits() ) ) );

QLayout *layout = new QVBoxLayout();
const QList<QgsGeometryCheckFactory *> factories = QgsAnalysis::instance()->geometryCheckRegistry()->geometryCheckFactories( mLayer, QgsGeometryCheck::Flag::SingleGeometryCheck );
QLayout *geometryCheckLayout = new QVBoxLayout();
const QList<QgsGeometryCheckFactory *> geometryCheckFactories = QgsAnalysis::instance()->geometryCheckRegistry()->geometryCheckFactories( mLayer, QgsGeometryCheck::Flag::SingleGeometryCheck );
const QStringList activeChecks = mLayer->geometryOptions()->geometryChecks();
for ( const QgsGeometryCheckFactory *factory : factories )
for ( const QgsGeometryCheckFactory *factory : geometryCheckFactories )
{
QCheckBox *cb = new QCheckBox( factory->description() );
cb->setChecked( activeChecks.contains( factory->id() ) );
mGeometryCheckFactoriesGroupBoxes.insert( cb, factory->id() );
layout->addWidget( cb );
geometryCheckLayout->addWidget( cb );
}
mGeometryValidationGroupBox->setLayout( layout );
mGeometryValidationGroupBox->setLayout( geometryCheckLayout );

QLayout *topologyCheckLayout = new QVBoxLayout();
const QList<QgsGeometryCheckFactory *> topologyCheckFactories = QgsAnalysis::instance()->geometryCheckRegistry()->geometryCheckFactories( mLayer, QgsGeometryCheck::Flag::SingleLayerTopologyCheck );

for ( const QgsGeometryCheckFactory *factory : topologyCheckFactories )
{
QCheckBox *cb = new QCheckBox( factory->description() );
cb->setChecked( activeChecks.contains( factory->id() ) );
mGeometryCheckFactoriesGroupBoxes.insert( cb, factory->id() );
topologyCheckLayout->addWidget( cb );
}
mTopologyChecksGroupBox->setLayout( topologyCheckLayout );
}
else
{
Expand Down
76 changes: 76 additions & 0 deletions src/ui/qgsvectorlayerpropertiesbase.ui
Expand Up @@ -2415,6 +2415,82 @@ border-radius: 2px;</string>
<property name="title">
<string>Geometry validation</string>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>651</width>
<height>804</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_20">
<item>
<widget class="QGroupBox" name="mGeometryAutoFixesGroupBox">
<property name="title">
<string>Automatic Fixes</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The geometry precision defines the maximum precision to of geometry coordinates that should be stored on this layer. A snap to grid algorithm will be applied on every geometry entering this layer, resulting in coordinates being rounded to multiples of this value. The operation is applied in this layer's coordinate reference system.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Geometry precision</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="mRemoveDuplicateNodesCheckbox">
<property name="text">
<string>Remove duplicate nodes</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_11" stretch="0,0">
<item>
<widget class="QLabel" name="mPrecisionUnitsLabel">
<property name="text">
<string>[Units]</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mGeometryPrecisionLineEdit">
<property name="inputMethodHints">
<set>Qt::ImhFormattedNumbersOnly</set>
</property>
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>[No precision restriction]</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="mGeometryValidationGroupBox">
<property name="title">
<string>Geometry checks</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="mTopologyChecksGroupBox">
<property name="title">
<string>Topology checks</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
Expand Down

0 comments on commit 88ef921

Please sign in to comment.