From: asl Date: Thu, 18 Aug 2005 11:21:40 +0000 (+0000) Subject: PAL9785 X-Git-Tag: T_3_0_2a1~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e84f6641987cde6a8123af734a1fb44bbda37879;p=modules%2Fsmesh.git PAL9785 --- diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index f38896472..0aecb9981 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -2330,6 +2330,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 220, "ALL" ); createSMESHAction( 1100, "EDIT_HYPO" ); createSMESHAction( 1101, "RENAME" ); + createSMESHAction( 1102, "UNASSIGN" ); createSMESHAction( 9010, "NUM_NODES", "", 0, true ); createSMESHAction( 9011, "NUM_ELEMENTS", "", 0, true ); createSMESHAction( 1131, "DISPMODE" ); @@ -2565,9 +2566,9 @@ void SMESHGUI::initialize( CAM_Application* app ) createPopupItem( 801, OB, mesh ); // CREATE_GROUP createPopupItem( 802, OB, subMesh ); // CONSTRUCT_GROUP popupMgr()->insert( separator(), -1, 0 ); - createPopupItem( 1100, OB, hypo ); // EDIT HYPOTHESIS - createPopupItem( 1102, OB, hyp_alg, "&& hasReference" ); // REMOVE HYPOTHESIS / ALGORITHMS - createPopupItem( 1101, OB, mesh_group + " " + hyp_alg ); // RENAME + createPopupItem( 1100, OB, hypo, "&& $hasReference={false}" ); // EDIT HYPOTHESIS + createPopupItem( 1102, OB, hyp_alg ); // REMOVE HYPOTHESIS / ALGORITHMS + createPopupItem( 1101, OB, mesh_group + " " + hyp_alg, "&& $hasReference={false}" ); // RENAME popupMgr()->insert( separator(), -1, 0 ); createPopupItem( 125, OB, mesh ); // EXPORT_MED createPopupItem( 126, OB, mesh ); // EXPORT_UNV diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx index 8f4d0e782..75fde54b1 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx @@ -424,63 +424,27 @@ namespace SMESH{ try { _PTR(Study) aStudy = GetActiveStudyDocument(); - SMESH_Hypothesis_var anHyp = IObjectToInterface(IObject); - if (IObject->hasReference()) + _PTR(SObject) aHypObj = aStudy->FindObjectID( IObject->getEntry() ); + if( aHypObj ) { - if(MYDEBUG) MESSAGE("HAS REFERENCE " << IObject->getEntry()); - _PTR(SObject) aHypSObj = aStudy->FindObjectID(IObject->getReference()); - if (aHypSObj) { - _PTR(SObject) MorSM = SMESH::GetMeshOrSubmesh(aHypSObj); - if (MorSM) { - GEOM::GEOM_Object_var aShape = SMESH::GetShapeOnMeshOrSubMesh(MorSM); - if (!aShape->_is_nil()){ - SMESH::SMESH_Mesh_var aMesh = - SMESH::SObjectToInterface(MorSM); - SMESH::SMESH_subMesh_var aSubMesh = - SMESH::SObjectToInterface(MorSM); - - if (!aSubMesh->_is_nil()) - aMesh = aSubMesh->GetFather(); - - if (!aMesh->_is_nil()) { - res = aMesh->RemoveHypothesis(aShape, anHyp); - if (res < SMESH::HYP_UNKNOWN_FATAL) { - _PTR(SObject) meshSO = SMESH::FindSObject(aMesh); - if (meshSO) - SMESH::ModifiedMesh(meshSO, false); - } - if (res > SMESH::HYP_OK) { - wc.suspend(); - processHypothesisStatus(res, anHyp, false); - wc.resume(); - } - } - } - } + _PTR(SObject) MorSM = SMESH::GetMeshOrSubmesh( aHypObj ); + _PTR(SObject) aRealHypo; + if( aHypObj->ReferencedObject( aRealHypo ) ) + { + SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aRealHypo ) ); + RemoveHypothesisOrAlgorithmOnMesh( MorSM, hypo ); + } + else + { + SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aHypObj ) ); + SObjectList meshList = GetMeshesUsingAlgoOrHypothesis( hypo ); + for( int i = 0; i < meshList.size(); i++ ) + RemoveHypothesisOrAlgorithmOnMesh( meshList[ i ], hypo ); } - } - else if (IObject->hasEntry()) - { - if(MYDEBUG) MESSAGE("IObject entry HAS ENTRY " << IObject->getEntry()); - SObjectList meshList = GetMeshesUsingAlgoOrHypothesis(anHyp); - for ( int i = 0; i < meshList.size(); ++i ) { - SMESH::SMESH_Mesh_var aMesh = - SMESH::SObjectToInterface( meshList[ i ]); - GEOM::GEOM_Object_var aShape = SMESH::GetShapeOnMeshOrSubMesh( meshList[ i ]); - if ( ! aMesh->_is_nil() && !aShape->_is_nil() ) { - res = aMesh->RemoveHypothesis(aShape, anHyp); - if ( res < SMESH::HYP_UNKNOWN_FATAL ) - SMESH::ModifiedMesh( meshList[ i ], false); - if ( res > SMESH::HYP_OK ) { - wc.suspend(); - processHypothesisStatus( res, anHyp, false ); - wc.resume(); - } - } - } } } - catch(const SALOME::SALOME_Exception& S_ex) { + catch(const SALOME::SALOME_Exception& S_ex) + { wc.suspend(); SalomeApp_Tools::QtCatchCorbaException(S_ex); res = SMESH::HYP_UNKNOWN_FATAL; @@ -544,7 +508,7 @@ namespace SMESH{ if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency number ="<GetFather(); if (aFather) { _PTR(SObject) SOfatherFather = aFather->GetFather(); diff --git a/src/SMESHGUI/SMESHGUI_Selection.cxx b/src/SMESHGUI/SMESHGUI_Selection.cxx index 5a060f295..fe962f55e 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.cxx +++ b/src/SMESHGUI/SMESHGUI_Selection.cxx @@ -286,10 +286,12 @@ QVariant SMESHGUI_Selection::hasReference( int ind ) const { if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" ) { - Handle(SALOME_InteractiveObject) io = - static_cast( myDataOwners[ ind ].get() )->IO(); - if ( !io.IsNull() ) - return QVariant( io->hasReference(), 0 ); + SalomeApp_DataOwner* owner = dynamic_cast( myDataOwners[ ind ].operator->() ); + if( owner ) + { + _PTR(SObject) obj ( study()->studyDS()->FindObjectID( owner->entry().latin1() ) ), ref; + return QVariant( obj->ReferencedObject( ref ), 0 ); + } } return QVariant( false, 0 ); } @@ -328,9 +330,16 @@ int SMESHGUI_Selection::type( SalomeApp_DataOwner* owner, if( !obj ) return -1; + _PTR(SObject) ref; + if( obj->ReferencedObject( ref ) ) + obj = ref; + _PTR(SObject) objFather = obj->GetFather(); _PTR(SComponent) objComponent = obj->GetFatherComponent(); + if( objComponent->ComponentDataType()!="SMESH" ) + return -1; + int aLevel = obj->Depth() - objComponent->Depth(), aFTag = objFather->Tag(), anOTag = obj->Tag(), diff --git a/src/SMESHGUI/SMESH_msg_en.po b/src/SMESHGUI/SMESH_msg_en.po index 65291e2f8..e0b272264 100644 --- a/src/SMESHGUI/SMESH_msg_en.po +++ b/src/SMESHGUI/SMESH_msg_en.po @@ -2125,6 +2125,9 @@ msgstr "Quality controls" msgid "MEN_RENAME" msgstr "Rename" +msgid "MEN_UNASSIGN" +msgstr "Unassign" + msgid "MEN_NUM_NODES" msgstr "Display Nodes #" @@ -2403,6 +2406,9 @@ msgstr "Update" msgid "TOP_RENAME" msgstr "Rename" +msgid "TOP_UNASSIGN" +msgstr "Unassign" + msgid "TOP_NUM_NODES" msgstr "Display Nodes" @@ -2683,6 +2689,9 @@ msgstr "Edit Local Hypothesis" msgid "STB_RENAME" msgstr "Rename" +msgid "STB_UNASSIGN" +msgstr "Unassign" + msgid "STB_NUM_NODES" msgstr "Display Nodes"