Salome HOME
Bug 0020378: EDF 1042 SMESH : Gui of SMESH hypothesis not multi-study ?
authorjfa <jfa@opencascade.com>
Wed, 17 Jun 2009 12:39:17 +0000 (12:39 +0000)
committerjfa <jfa@opencascade.com>
Wed, 17 Jun 2009 12:39:17 +0000 (12:39 +0000)
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx
src/SMESHGUI/SMESHGUI_HypothesesUtils.h
src/SMESHGUI/SMESHGUI_MeshOp.cxx
src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx

index 6f2bc5d955ff7b0fbaebb5d7da772b91d05bfb5f..2d1f630b5ef1077366104e1bd3f9d0107f47c682 100644 (file)
@@ -23,7 +23,7 @@
 // File   : SMESHGUI.cxx
 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
 // SMESH includes
-//
+
 #include "SMESHGUI.h"
 #include "SMESHGUI_NodesDlg.h"
 #include "SMESHGUI_TransparencyDlg.h"
@@ -2090,9 +2090,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
         /* Warning : however by internal mechanism all subMeshes icons are changed !                     */
         if ( !aHypothesis->_is_nil() )
         {
-          SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
-          if (aCreator)
+          // BUG 0020378
+          //SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
+          SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
+          if (aCreator) {
             aCreator->edit( aHypothesis.in(), anIObject->getName(), desktop() );
+          }
           else
           {
             // report error
index 5f3500230d4617ab7c32b62fecc2828bdc845f3c..50de8b76221e7167081dca22032f0f8089b0b77a 100644 (file)
@@ -22,8 +22,8 @@
 // SMESH SMESHGUI : GUI for SMESH component
 // File   : SMESHGUI_HypothesesUtils.cxx
 // Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
+
 // SMESH includes
-//
 #include "SMESHGUI_HypothesesUtils.h"
 
 #include "SMESHGUI.h"
@@ -82,8 +82,9 @@ namespace SMESH
   THypothesisDataMap myHypothesesMap;
   THypothesisDataMap myAlgorithmsMap;
 
-  typedef QMap<QString,SMESHGUI_GenericHypothesisCreator*> THypCreatorMap;
-  THypCreatorMap myHypCreatorMap;
+  // BUG 0020378
+  //typedef QMap<QString,SMESHGUI_GenericHypothesisCreator*> THypCreatorMap;
+  //THypCreatorMap myHypCreatorMap;
 
   QList<HypothesesSet*> myListOfHypothesesSets;
 
@@ -319,24 +320,26 @@ namespace SMESH
     return false;
   }
 
-  SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator(const QString& aHypType)
+  HypothesisCreatorPtr GetHypothesisCreator(const QString& aHypType)
   {
     if(MYDEBUG) MESSAGE("Get HypothesisCreator for " << aHypType.toLatin1().data());
 
     SMESHGUI_GenericHypothesisCreator* aCreator = 0;
 
     // check, if creator for this hypothesis type already exists
-    if (myHypCreatorMap.find(aHypType) != myHypCreatorMap.end()) {
-      aCreator = myHypCreatorMap[aHypType];
-    }
-    else {
+    // BUG 0020378
+    //if (myHypCreatorMap.find(aHypType) != myHypCreatorMap.end()) {
+    //  aCreator = myHypCreatorMap[aHypType];
+    //}
+    //else
+    {
       // 1. Init list of available hypotheses, if needed
       InitAvailableHypotheses();
 
       // 2. Get names of plugin libraries
       HypothesisData* aHypData = GetHypothesisData(aHypType);
       if (!aHypData) 
-        return aCreator;
+        return HypothesisCreatorPtr(aCreator);
       QString aClientLibName = aHypData->ClientLibName;
       QString aServerLibName = aHypData->ServerLibName;
 
@@ -376,7 +379,8 @@ namespace SMESH
            }
            else {
              // map hypothesis creator to a hypothesis name
-             myHypCreatorMap[aHypType] = aCreator;
+              // BUG 0020378
+             //myHypCreatorMap[aHypType] = aCreator;
            }
          }
        }
@@ -386,7 +390,7 @@ namespace SMESH
       }
     }
 
-    return aCreator;
+    return HypothesisCreatorPtr(aCreator);
   }
 
 
index 18813f4c8bcd1b1ce834b18673322dc91e9f2da0..89c1335dfa76fb269f09e69468f09036a7139b3a 100644 (file)
@@ -22,7 +22,7 @@
 // SMESH SMESHGUI : GUI for SMESH component
 // File   : SMESHGUI_HypothesesUtils.h
 // Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
-//
+
 #ifndef SMESHGUI_HYPOTHESESUTILS_H
 #define SMESHGUI_HYPOTHESESUTILS_H
 
@@ -47,6 +47,9 @@
 // STL includes
 #include <vector>
 
+// boost includes
+#include <boost/shared_ptr.hpp>
+
 class HypothesisData;
 class HypothesesSet;
 class SMESHGUI_GenericHypothesisCreator;
@@ -55,6 +58,8 @@ class algo_error_array;
 
 namespace SMESH
 {
+  typedef boost::shared_ptr<SMESHGUI_GenericHypothesisCreator> HypothesisCreatorPtr;
+
   SMESHGUI_EXPORT
   void InitAvailableHypotheses();
 
@@ -82,12 +87,12 @@ namespace SMESH
                              const HypothesisData* );
 
   SMESHGUI_EXPORT
-  SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& );
+  HypothesisCreatorPtr GetHypothesisCreator( const QString& );
 
   SMESHGUI_EXPORT
   SMESH::SMESH_Hypothesis_ptr CreateHypothesis( const QString&,
-                                               const QString&,
-                                               const bool = false);
+                                                const QString&,
+                                                const bool = false );
 
   SMESHGUI_EXPORT
   bool AddHypothesisOnMesh( SMESH::SMESH_Mesh_ptr, SMESH::SMESH_Hypothesis_ptr );
index ae29fc4b167d01e90325338a9e9be1c321ee33c2..d1a19e9ce08518c301315b5ee2c34ccd3d57cb58 100644 (file)
@@ -22,8 +22,8 @@
 // SMESH SMESHGUI : GUI for SMESH component
 // File   : SMESHGUI_MeshOp.cxx
 // Author : Sergey LITONIN, Open CASCADE S.A.S.
+
 // SMESH includes
-//
 #include "SMESHGUI_MeshOp.h"
 
 #include "SMESHGUI.h"
@@ -1053,7 +1053,9 @@ void SMESHGUI_MeshOp::createHypothesis (const int theDim,
     SMESH::CreateHypothesis(theTypeName, aHypName, false);
   } else {
     // Get hypotheses creator client (GUI)
-    SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
+    // BUG 0020378
+    //SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
+    SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(theTypeName);
 
     // Create hypothesis
     if (aCreator) {
@@ -1108,7 +1110,9 @@ void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex )
   if ( aHyp->_is_nil() )
     return;
 
-  SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator( aHyp->GetName() );
+  // BUG 0020378
+  //SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHyp->GetName());
+  SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(aHyp->GetName());
   if ( aCreator )
   {
     // Get initial parameters
@@ -1682,11 +1686,14 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
         SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
       } else {
         // Get hypotheses creator client (GUI)
-        SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName);
+        // BUG 0020378
+        //SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName);
+        SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(aHypName);
 
         // Create algorithm
-        if (aCreator)
+        if (aCreator) {
           aCreator->create(true, aHypName, myDlg);
+        }
         else
           SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
       }
index ffdc4a7f151ff310022a74d0bef3f16f75891390..481d34e02016bb77455f0cda6b5be0d2cc73f21e 100644 (file)
@@ -198,8 +198,9 @@ void StdMeshersGUI_LayerDistributionParamWdg::onEdit()
     return;
 
   CORBA::String_var hypType = myHyp->GetName();
-  SMESHGUI_GenericHypothesisCreator*
-    editor = SMESH::GetHypothesisCreator( hypType.in() );
+  // BUG 0020378
+  //SMESHGUI_GenericHypothesisCreator* editor = SMESH::GetHypothesisCreator(hypType.in());
+  SMESH::HypothesisCreatorPtr editor = SMESH::GetHypothesisCreator(hypType.in());
   if ( !editor ) return;
 
   if ( myDlg ) myDlg->hide();