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

@ -1284,7 +1284,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
SMESH::SMESH_Mesh_var aMesh; SMESH::SMESH_Mesh_var aMesh;
SMESH::SMESH_subMesh_var aSubMesh; SMESH::SMESH_subMesh_var aSubMesh;
Handle(SALOME_InteractiveObject) IObject = selected.First(); Handle(SALOME_InteractiveObject) IObject = selected.First();
if (IObject->hasEntry()){ if (IObject->hasEntry()) {
_PTR(SObject) aMeshSObj = aStudy->FindObjectID(IObject->getEntry()); _PTR(SObject) aMeshSObj = aStudy->FindObjectID(IObject->getEntry());
GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( aMeshSObj ); GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( aMeshSObj );
if ( aShapeObject->_is_nil() ) { if ( aShapeObject->_is_nil() ) {
@ -1292,69 +1292,50 @@ 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() )
if (!aMesh->_is_nil()){
GEOM::GEOM_Object_var refShapeObject = SMESH::GetShapeOnMeshOrSubMesh(aMeshSObj);
if (!refShapeObject->_is_nil()) {
if(!GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject)){
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);
}
}
}else if(!aSubMesh->_is_nil()){
aMesh = aSubMesh->GetFather(); aMesh = aSubMesh->GetFather();
GEOM::GEOM_Object_var refShapeObject = SMESH::GetShapeOnMeshOrSubMesh(aMeshSObj);
if(!refShapeObject->_is_nil()){ if (!aMesh->_is_nil()) {
bool compute = GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject); // if(!GetSMESHGen()->IsReadyToCompute(aMesh,aShapeObject)) {
if(!compute){ // SUIT_MessageBox::warn1(desktop(),
SUIT_MessageBox::warn1(desktop(), // tr("SMESH_WRN_WARNING"),
tr("SMESH_WRN_WARNING"), // tr("SMESH_WRN_MISSING_PARAMETERS"),
tr("SMESH_WRN_MISSING_PARAMETERS"), // tr("SMESH_BUT_OK"));
tr("SMESH_BUT_OK")); // break;
break; // }
} SMESH::algo_error_array_var errors = GetSMESHGen()->GetAlgoState(aMesh,aShapeObject);
try{ if ( errors->length() > 0 ) {
if ( GetSMESHGen()->Compute(aMesh,refShapeObject) ) SUIT_MessageBox::warn1(desktop(),
SMESH::ModifiedMesh(aMeshSObj,true); tr("SMESH_WRN_WARNING"),
// TO Do : change icon of all submeshes SMESH::GetMessageOnAlgoStateErrors( errors.in() ),
else tr("SMESH_BUT_OK"));
SUIT_MessageBox::warn1(desktop(), break;
tr("SMESH_WRN_WARNING"), }
tr("SMESH_WRN_COMPUTE_FAILED"), try{
tr("SMESH_BUT_OK")); if (GetSMESHGen()->Compute(aMesh,aShapeObject))
}catch(const SALOME::SALOME_Exception & S_ex){ SMESH::ModifiedMesh(aMeshSObj,true);
SalomeApp_Tools::QtCatchCorbaException(S_ex); 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();
TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,IObject->getEntry()); TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,IObject->getEntry());
if ( automaticUpdate() && aVisualObj){ if ( automaticUpdate() && aVisualObj){
aVisualObj->Update(); aVisualObj->Update();
SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry()); SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
if(!anActor){ if(!anActor){
anActor = SMESH::CreateActor(aStudy,IObject->getEntry()); anActor = SMESH::CreateActor(aStudy,IObject->getEntry());
if(anActor){ if(anActor){
SMESH::DisplayActor(view,anActor); //apo SMESH::DisplayActor(view,anActor); //apo
SMESH::FitAll(); SMESH::FitAll();
} }