From: eap Date: Mon, 10 Apr 2006 15:29:29 +0000 (+0000) Subject: add to GenericHypothesisCreator_i a method returning it's IDL module name to be used... X-Git-Tag: T3_2_0b1_pre1~39 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=6b5e44e4d80909167c44caf5028dfb1e92bc625c add to GenericHypothesisCreator_i a method returning it's IDL module name to be used for importing it in the script by PythonDump --- diff --git a/src/SMESH_I/SMESH_DumpPython.cxx b/src/SMESH_I/SMESH_DumpPython.cxx index b1d71f582..491f24ad3 100644 --- a/src/SMESH_I/SMESH_DumpPython.cxx +++ b/src/SMESH_I/SMESH_DumpPython.cxx @@ -489,6 +489,16 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl else aScript += aSMESHGen + ".SetCurrentStudy(None)"; + // import python files corresponding to plugins + set moduleNameSet; + map::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 diff --git a/src/SMESH_I/SMESH_Hypothesis_i.hxx b/src/SMESH_I/SMESH_Hypothesis_i.hxx index df89d82c8..fd806b027 100644 --- a/src/SMESH_I/SMESH_Hypothesis_i.hxx +++ b/src/SMESH_I/SMESH_Hypothesis_i.hxx @@ -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 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); }; diff --git a/src/StdMeshers_I/StdMeshers_i.cxx b/src/StdMeshers_I/StdMeshers_i.cxx index a379e81ac..a9104ec81 100644 --- a/src/StdMeshers_I/StdMeshers_i.cxx +++ b/src/StdMeshers_I/StdMeshers_i.cxx @@ -49,6 +49,12 @@ using namespace std; #include "StdMeshers_Quadrangle_2D_i.hxx" #include "StdMeshers_Hexa_3D_i.hxx" +template class StdHypothesisCreator_i:public HypothesisCreator_i +{ + // 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; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "NumberOfSegments") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "LengthFromEdges") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "NotConformAllowed") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Propagation") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "MaxElementArea") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "MaxElementVolume") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "StartEndLength") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Deflection1D") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Arithmetic1D") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "AutomaticLength") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "QuadranglePreference") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "QuadraticMesh") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; // Algorithms else if (strcmp(aHypName, "Regular_1D") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "MEFISTO_2D") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Quadrangle_2D") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Hexa_3D") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else ; return aCreator;