]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
add to GenericHypothesisCreator_i a method returning it's IDL module name to be used...
authoreap <eap@opencascade.com>
Mon, 10 Apr 2006 15:29:29 +0000 (15:29 +0000)
committereap <eap@opencascade.com>
Mon, 10 Apr 2006 15:29:29 +0000 (15:29 +0000)
src/SMESH_I/SMESH_DumpPython.cxx
src/SMESH_I/SMESH_Hypothesis_i.hxx
src/StdMeshers_I/StdMeshers_i.cxx

index b1d71f582b35bd698ec51597dab6155d6df4b34a..491f24ad32697bd518203e9129c41a7ba823b2ef 100644 (file)
@@ -489,6 +489,16 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
   else
     aScript += aSMESHGen + ".SetCurrentStudy(None)";
 
+  // import python files corresponding to plugins
+  set<string> moduleNameSet;
+  map<string, GenericHypothesisCreator_i*>::iterator hyp_creator = myHypCreatorMap.begin();
+  for ( ; hyp_creator != myHypCreatorMap.end(); ++hyp_creator ) {
+    string moduleName = hyp_creator->second->GetModuleName();
+    bool newModule = moduleNameSet.insert( moduleName ).second;
+    if ( newModule )
+      aScript += helper + "\n\t" + "import " + (char*) moduleName.c_str();
+  }
+
   // Dump trace of restored study
   if (theSavedTrace.Length() > 0) {
     // For the convertion of IDL API calls -> smesh.py API, "smesh" standing for SMESH_Gen
index df89d82c818e9464c60602120bedb374815fff63..fd806b0276737d9dd11b7544a504bc437dc8c109 100644 (file)
@@ -92,6 +92,8 @@ public:
   virtual SMESH_Hypothesis_i* Create(PortableServer::POA_ptr thePOA,
                                      int                     theStudyId,
                                      ::SMESH_Gen*            theGenImpl) = 0;
+  // return the name of IDL module
+  virtual std::string GetModuleName() = 0;
 };
 
 //=============================================================================
@@ -106,7 +108,7 @@ template <class T> class HypothesisCreator_i: public GenericHypothesisCreator_i
 public:
   virtual SMESH_Hypothesis_i* Create (PortableServer::POA_ptr thePOA,
                                       int                     theStudyId,
-                                      ::SMESH_Gen*            theGenImpl) 
+                                      ::SMESH_Gen*            theGenImpl)
   {
     return new T (thePOA, theStudyId, theGenImpl);
   };
index a379e81ac2fa141000679e89bda00f0552757c03..a9104ec81e6037fa9f9a373cd1066dd783d31846 100644 (file)
@@ -49,6 +49,12 @@ using namespace std;
 #include "StdMeshers_Quadrangle_2D_i.hxx"
 #include "StdMeshers_Hexa_3D_i.hxx"
 
+template <class T> class StdHypothesisCreator_i:public HypothesisCreator_i<T>
+{
+  // as we have 'module StdMeshers' in SMESH_BasicHypothesis.idl
+  virtual std::string GetModuleName() { return "StdMeshers"; }
+};
+
 //=============================================================================
 /*!
  *
@@ -65,41 +71,41 @@ extern "C"
 
     // Hypotheses
     if      (strcmp(aHypName, "LocalLength") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_LocalLength_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_LocalLength_i>;
     else if (strcmp(aHypName, "NumberOfSegments") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_NumberOfSegments_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_NumberOfSegments_i>;
     else if (strcmp(aHypName, "LengthFromEdges") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_LengthFromEdges_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_LengthFromEdges_i>;
     else if (strcmp(aHypName, "NotConformAllowed") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_NotConformAllowed_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_NotConformAllowed_i>;
     else if (strcmp(aHypName, "Propagation") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_Propagation_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_Propagation_i>;
     else if (strcmp(aHypName, "MaxElementArea") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_MaxElementArea_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_MaxElementArea_i>;
     else if (strcmp(aHypName, "MaxElementVolume") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_MaxElementVolume_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_MaxElementVolume_i>;
     else if (strcmp(aHypName, "StartEndLength") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_StartEndLength_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_StartEndLength_i>;
     else if (strcmp(aHypName, "Deflection1D") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_Deflection1D_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_Deflection1D_i>;
     else if (strcmp(aHypName, "Arithmetic1D") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_Arithmetic1D_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_Arithmetic1D_i>;
     else if (strcmp(aHypName, "AutomaticLength") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_AutomaticLength_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_AutomaticLength_i>;
     else if (strcmp(aHypName, "QuadranglePreference") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_QuadranglePreference_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_QuadranglePreference_i>;
     else if (strcmp(aHypName, "QuadraticMesh") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_QuadraticMesh_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_QuadraticMesh_i>;
 
     // Algorithms
     else if (strcmp(aHypName, "Regular_1D") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_Regular_1D_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_Regular_1D_i>;
     else if (strcmp(aHypName, "MEFISTO_2D") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_MEFISTO_2D_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_MEFISTO_2D_i>;
     else if (strcmp(aHypName, "Quadrangle_2D") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_Quadrangle_2D_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_Quadrangle_2D_i>;
     else if (strcmp(aHypName, "Hexa_3D") == 0)
-      aCreator = new HypothesisCreator_i<StdMeshers_Hexa_3D_i>;
+      aCreator = new StdHypothesisCreator_i<StdMeshers_Hexa_3D_i>;
     else ;
 
     return aCreator;