From: dmv Date: Mon, 28 Jul 2008 08:02:46 +0000 (+0000) Subject: 0016585: EDF PAL 518: Clarify Solid construction error message. X-Git-Tag: V5_1_0a1~34 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2c0e43882202b0ac24184658f763ffdde4955730;p=modules%2Fgeom.git 0016585: EDF PAL 518: Clarify Solid construction error message. --- diff --git a/src/BuildGUI/BuildGUI_SolidDlg.cxx b/src/BuildGUI/BuildGUI_SolidDlg.cxx index b560080f5..aca4110b1 100644 --- a/src/BuildGUI/BuildGUI_SolidDlg.cxx +++ b/src/BuildGUI/BuildGUI_SolidDlg.cxx @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -134,6 +135,17 @@ void BuildGUI_SolidDlg::ClickOnOk() //================================================================================= bool BuildGUI_SolidDlg::ClickOnApply() { + for ( int i = 0, n = myShells.length(); i< n; i++ ) { + if ( !isClosed(i)) { + QString aName = GEOMBase::GetName( myShells[i] ); + SUIT_MessageBox::warning( (QWidget*)SUIT_Session::session()->activeApplication()->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_SHAPE_UNCLOSED").arg(aName) , + QObject::tr("BUT_OK") ); + return false; + } + } + if ( !onAccept() ) return false; @@ -235,6 +247,42 @@ bool BuildGUI_SolidDlg::isValid( QString& ) return myOkShells; } +//================================================================================= +// function : isClosed +// purpose : Check the object 'i' in myShells list is closed or unclosed +//================================================================================= +bool BuildGUI_SolidDlg::isClosed(int i) +{ + GEOM::GEOM_Object_var aShape = myShells[i]; + GEOM::GEOM_IKindOfShape::shape_kind aKind; + GEOM::ListOfLong_var anInts; + GEOM::ListOfDouble_var aDbls; + + if (aShape->_is_nil()) { + MESSAGE ("Shape is NULL!!!"); + return false; + } + + GEOM::GEOM_IMeasureOperations_ptr anOp = myGeomGUI->GetGeomGen()->GetIMeasureOperations( getStudyId() ); + + // GEOM::GEOM_IMeasureOperations_var anOp = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); + + // Detect kind of shape and parameters + aKind = anOp->KindOfShape(aShape, anInts, aDbls); + + if ( !anOp->IsDone() ) { + MESSAGE ("KindOfShape Operation is NOT DONE!!!"); + return false; + } + + if ( anInts[0] == 1 ) + return true; + else if ( anInts[0] == 2 ) + return false; + + return false; +} + //================================================================================= // function : execute // purpose : diff --git a/src/BuildGUI/BuildGUI_SolidDlg.h b/src/BuildGUI/BuildGUI_SolidDlg.h index 5ca0f7bc7..d666fc032 100644 --- a/src/BuildGUI/BuildGUI_SolidDlg.h +++ b/src/BuildGUI/BuildGUI_SolidDlg.h @@ -50,6 +50,7 @@ protected: private: void Init(); + bool isClosed(int i); void enterEvent( QEvent* ); private: