0016585: EDF PAL 518: Clarify Solid construction error message.

This commit is contained in:
dmv 2008-07-28 08:02:46 +00:00
parent 7a5690cc55
commit 2c0e438822
2 changed files with 49 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#include <GEOMImpl_Types.hxx>
#include <SUIT_ResourceMgr.h>
#include <SUIT_MessageBox.h>
#include <SUIT_Session.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
@ -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 :

View File

@ -50,6 +50,7 @@ protected:
private:
void Init();
bool isClosed(int i);
void enterEvent( QEvent* );
private: