PAL10491. use GetAlgoState() instead of IsReadyToCompute()

This commit is contained in:
eap 2005-11-14 09:16:18 +00:00
parent 81e9dbdf6c
commit ad354c1c09

View File

@ -1292,23 +1292,30 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
break; break;
} }
if( aMeshSObj ) { if( aMeshSObj ) {
SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(aMeshSObj); aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(aMeshSObj);
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(aMeshSObj); aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(aMeshSObj);
if ( !aSubMesh->_is_nil() )
aMesh = aSubMesh->GetFather();
if (!aMesh->_is_nil()) { if (!aMesh->_is_nil()) {
GEOM::GEOM_Object_var refShapeObject = SMESH::GetShapeOnMeshOrSubMesh(aMeshSObj); // if(!GetSMESHGen()->IsReadyToCompute(aMesh,aShapeObject)) {
if (!refShapeObject->_is_nil()) { // SUIT_MessageBox::warn1(desktop(),
if(!GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject)){ // tr("SMESH_WRN_WARNING"),
// tr("SMESH_WRN_MISSING_PARAMETERS"),
// tr("SMESH_BUT_OK"));
// break;
// }
SMESH::algo_error_array_var errors = GetSMESHGen()->GetAlgoState(aMesh,aShapeObject);
if ( errors->length() > 0 ) {
SUIT_MessageBox::warn1(desktop(), SUIT_MessageBox::warn1(desktop(),
tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_WARNING"),
tr("SMESH_WRN_MISSING_PARAMETERS"), SMESH::GetMessageOnAlgoStateErrors( errors.in() ),
tr("SMESH_BUT_OK")); tr("SMESH_BUT_OK"));
break; break;
} }
try{ try{
if (GetSMESHGen()->Compute(aMesh,refShapeObject)) if (GetSMESHGen()->Compute(aMesh,aShapeObject))
SMESH::ModifiedMesh(aMeshSObj,true); SMESH::ModifiedMesh(aMeshSObj,true);
// TO Do : change icon of all submeshes
else else
SUIT_MessageBox::warn1(desktop(), SUIT_MessageBox::warn1(desktop(),
tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_WARNING"),
@ -1319,32 +1326,6 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
SalomeApp_Tools::QtCatchCorbaException(S_ex); SalomeApp_Tools::QtCatchCorbaException(S_ex);
} }
} }
}else if(!aSubMesh->_is_nil()){
aMesh = aSubMesh->GetFather();
GEOM::GEOM_Object_var refShapeObject = SMESH::GetShapeOnMeshOrSubMesh(aMeshSObj);
if(!refShapeObject->_is_nil()){
bool compute = GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject);
if(!compute){
SUIT_MessageBox::warn1(desktop(),
tr("SMESH_WRN_WARNING"),
tr("SMESH_WRN_MISSING_PARAMETERS"),
tr("SMESH_BUT_OK"));
break;
}
try{
if ( GetSMESHGen()->Compute(aMesh,refShapeObject) )
SMESH::ModifiedMesh(aMeshSObj,true);
// TO Do : change icon of all submeshes
else
SUIT_MessageBox::warn1(desktop(),
tr("SMESH_WRN_WARNING"),
tr("SMESH_WRN_COMPUTE_FAILED"),
tr("SMESH_BUT_OK"));
}catch(const SALOME::SALOME_Exception & S_ex){
SalomeApp_Tools::QtCatchCorbaException(S_ex);
}
}
}
} }
} }
CORBA::Long anId = aStudy->StudyId(); CORBA::Long anId = aStudy->StudyId();