]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
PAL9785
authorasl <asl@opencascade.com>
Thu, 18 Aug 2005 11:21:40 +0000 (11:21 +0000)
committerasl <asl@opencascade.com>
Thu, 18 Aug 2005 11:21:40 +0000 (11:21 +0000)
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx
src/SMESHGUI/SMESHGUI_Selection.cxx
src/SMESHGUI/SMESH_msg_en.po

index f3889647249840f059d72f005a40259d4bdfe876..0aecb9981e5d63135f57e2923356a975c0a57c44 100644 (file)
@@ -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
index 8f4d0e782ba511a70ec32df4e04a723ab096fede..75fde54b194d956fb5dfdfe53444a06156fb20e7 100644 (file)
@@ -424,63 +424,27 @@ namespace SMESH{
 
     try {
       _PTR(Study) aStudy = GetActiveStudyDocument();
-      SMESH_Hypothesis_var anHyp = IObjectToInterface<SMESH_Hypothesis>(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<SMESH::SMESH_Mesh>(MorSM);
-             SMESH::SMESH_subMesh_var aSubMesh =
-               SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(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<SMESH::SMESH_Mesh>( 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 ="<<listSO.size());
        for (unsigned int i = 0; i < listSO.size(); i++) {
          _PTR(SObject) SO = listSO[i];
-         if (!SO) {
+         if (SO) {
            _PTR(SObject) aFather = SO->GetFather();
            if (aFather) {
              _PTR(SObject) SOfatherFather = aFather->GetFather();
index 5a060f295a9e82289ada685df68f8d710ef21a18..fe962f55ed740ede345e7889e46c77f0706dcb21 100644 (file)
@@ -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<SalomeApp_DataOwner*>( myDataOwners[ ind ].get() )->IO();
-    if ( !io.IsNull() )
-      return QVariant( io->hasReference(), 0 );
+    SalomeApp_DataOwner* owner = dynamic_cast<SalomeApp_DataOwner*>( 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(),
index 65291e2f8c71fd1cb95c1151fb293d7d50d89939..e0b272264af830ad11cf63782a9eb09cce121065 100644 (file)
@@ -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"