Skip to content

Commit

Permalink
[Geometry checker] Ensure all UI items are consistently enabled/disab…
Browse files Browse the repository at this point in the history
…led depending on type of layers to be checked
  • Loading branch information
manisandro committed Oct 23, 2017
1 parent 5470b16 commit 57c348b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/plugins/geometry_checker/qgsgeometrycheckfactory.cpp
Expand Up @@ -51,6 +51,7 @@ template<> void QgsGeometryCheckFactoryT<QgsGeometryAngleCheck>::restorePrevious
template<> bool QgsGeometryCheckFactoryT<QgsGeometryAngleCheck>::checkApplicability( Ui::QgsGeometryCheckerSetupTab &ui, int /*nPoint*/, int nLineString, int nPolygon ) const
{
ui.checkBoxAngle->setEnabled( nPolygon > 0 || nLineString > 0 );
ui.doubleSpinBoxAngle->setEnabled( ui.checkBoxAngle->isEnabled() );
return ui.checkBoxAngle->isEnabled();
}

Expand Down Expand Up @@ -81,6 +82,7 @@ template<> void QgsGeometryCheckFactoryT<QgsGeometryAreaCheck>::restorePrevious(
template<> bool QgsGeometryCheckFactoryT<QgsGeometryAreaCheck>::checkApplicability( Ui::QgsGeometryCheckerSetupTab &ui, int /*nPoint*/, int /*nLineString*/, int nPolygon ) const
{
ui.checkBoxArea->setEnabled( nPolygon > 0 );
ui.doubleSpinBoxArea->setEnabled( ui.checkBoxArea->isEnabled() );
return ui.checkBoxArea->isEnabled();
}

Expand Down Expand Up @@ -335,9 +337,10 @@ template<> void QgsGeometryCheckFactoryT<QgsGeometryMultipartCheck>::restorePrev
ui.checkBoxMultipart->setChecked( QgsSettings().value( sSettingsGroup + "checkMultipart" ).toBool() );
}

template<> bool QgsGeometryCheckFactoryT<QgsGeometryMultipartCheck>::checkApplicability( Ui::QgsGeometryCheckerSetupTab & /*ui*/, int /*nPoint*/, int /*nLineString*/, int /*nPolygon*/ ) const
template<> bool QgsGeometryCheckFactoryT<QgsGeometryMultipartCheck>::checkApplicability( Ui::QgsGeometryCheckerSetupTab &ui, int nPoint, int nLineString, int nPolygon ) const
{
return true;
ui.checkBoxMultipart->setEnabled( nPoint + nLineString + nPolygon > 0 );
return ui.checkBoxMultipart->isEnabled();
}

template<> QgsGeometryCheck *QgsGeometryCheckFactoryT<QgsGeometryMultipartCheck>::createInstance( QgsGeometryCheckerContext *context, const Ui::QgsGeometryCheckerSetupTab &ui ) const
Expand Down Expand Up @@ -578,9 +581,15 @@ template<> void QgsGeometryCheckFactoryT<QgsGeometryTypeCheck>::restorePrevious(
ui.checkBoxMultipolygon->setChecked( QgsSettings().value( sSettingsGroup + "checkTypeMultipolygon" ).toBool() );
}

template<> bool QgsGeometryCheckFactoryT<QgsGeometryTypeCheck>::checkApplicability( Ui::QgsGeometryCheckerSetupTab & /*ui*/, int /*nPoint*/, int /*nLineString*/, int /*nPolygon*/ ) const
template<> bool QgsGeometryCheckFactoryT<QgsGeometryTypeCheck>::checkApplicability( Ui::QgsGeometryCheckerSetupTab &ui, int nPoint, int nLineString, int nPolygon ) const
{
return true;
ui.checkBoxPoint->setEnabled( nPoint > 0 );
ui.checkBoxMultipoint->setEnabled( nPoint > 0 );
ui.checkBoxLine->setEnabled( nLineString > 0 );
ui.checkBoxMultiline->setEnabled( nLineString > 0 );
ui.checkBoxPolygon->setEnabled( nPolygon > 0 );
ui.checkBoxMultipolygon->setEnabled( nPolygon > 0 );
return nPoint + nLineString + nPolygon > 0;
}

template<> QgsGeometryCheck *QgsGeometryCheckFactoryT<QgsGeometryTypeCheck>::createInstance( QgsGeometryCheckerContext *context, const Ui::QgsGeometryCheckerSetupTab &ui ) const
Expand Down

0 comments on commit 57c348b

Please sign in to comment.