Salome HOME
Mounting the hypothesis LengthFromEdges in th GUI of SMESH. This
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.cxx
index 529ede7b55e7faaa2c6e82d27b355d26f9daaa87..5f56add8f6b6f36327723b5e0dcd1a479b0c7679 100644 (file)
@@ -2202,7 +2202,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
                                        Standard_Boolean res;
                                        SMESH_Actor *ac =
                                                smeshGUI->FindActorByEntry(IObject->getEntry(), res,
-                                               true);
+                                               false);
                                        if (res)
                                        {
                                                smeshGUI->DisplayActor(ac, true);
@@ -3156,6 +3156,28 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
                break;
        }
 
+       case 5034:                                     // HYPOTHESIS - LENGTH FROM EDGES
+       {
+         SMESH::SMESH_Hypothesis_var Hyp;
+         try
+           {
+             Hyp = smeshGUI->myComponentMesh->CreateHypothesis("LengthFromEdges", smeshGUI->myStudyId);
+
+             if (!Hyp->_is_nil())
+               {
+                 SALOMEDS::SObject_var SHyp = smeshGUI->myStudyAPI.AddNewHypothesis(Hyp);
+                 smeshGUI->myStudyAPI.SetName(SHyp, "LengthFromEdges");
+               }
+           }
+         catch(const SALOME::SALOME_Exception & S_ex)
+           {
+             QtCatchCorbaException(S_ex);
+           }
+         smeshGUI->myActiveStudy->updateObjBrowser(true);
+
+         break;
+       }
+
        case 6016:                                      // CONTROLS 
        case 6015:
        case 6014:
@@ -4152,6 +4174,11 @@ void SMESHGUI::BuildPresentation(const Handle(SALOME_InteractiveObject) & theIO)
                                // The actor belongs to inactive view -> create a copy and display it in the active view
                                if (!rwInter->isInViewer(IObject))
                                {
+                                       if(ac->GetMapper()==NULL)
+                                       {
+                                               SMESH::SMESH_Mesh_var aMesh = smeshGUI->ConvertIOinMesh(theIO, res);
+                                               ac=smeshGUI->ReadScript(aMesh);
+                                       }
                                        SMESH_Actor *acCopy = SMESH_Actor::New();
                                        acCopy->ShallowCopy(ac);
                                        ac = acCopy;
@@ -4200,7 +4227,7 @@ SMESH_Actor *SMESHGUI::ReadScript(SMESH::SMESH_Mesh_ptr aMesh)
        if (!aMesh->_is_nil())
        {
                Standard_Boolean result;
-               MeshActor = FindActor(aMesh, result, true);
+               MeshActor = FindActor(aMesh, result, false);
                if (result)
                {
                        SMESH::log_array_var aSeq = aMesh->GetLog(true);
@@ -6052,15 +6079,15 @@ void SMESHGUI::Update(const Handle(SALOME_InteractiveObject) & IO)
                                        getActiveStudyFrame()->getRightFrame()->getViewFrame())->
                                        getRWInteractor();
 
+                               ac = ReadScript(aMesh);
                                // The actor belongs to inactive view -> create a copy and display it in the active view
                                if (!rwInter->isInViewer(IO))
                                {
                                        SMESH_Actor *acCopy = SMESH_Actor::New();
                                        acCopy->ShallowCopy(ac);
-
-                                       smeshGUI->DisplayActor(acCopy, false);
+                                       ac=acCopy;
                                }
-                               ac = ReadScript(aMesh);
+
                                if (ac != NULL)
                                {
 #ifdef TRACE