+ // ============
+ // Dump python
+ // ============
+
+ virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
+ CORBA::Boolean isPublished,
+ CORBA::Boolean& isValidScript);
+
+ void AddToPythonScript (int theStudyID, const TCollection_AsciiString& theString);
+
+ void RemoveLastFromPythonScript (int theStudyID);
+
+ static void AddToCurrentPyScript (const TCollection_AsciiString& theString);
+
+ void SavePython (SALOMEDS::Study_ptr theStudy);
+
+ TCollection_AsciiString DumpPython_impl (int theStudyID,
+ Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
+ Resource_DataMapOfAsciiStringAsciiString& theNames,
+ bool isPublished,
+ bool& aValidScript,
+ const TCollection_AsciiString& theSavedTrace);
+
+ TCollection_AsciiString GetNewPythonLines (int theStudyID);
+
+ void CleanPythonTrace (int theStudyID);
+
+ // Dump python comfort methods
+
+ static TCollection_AsciiString& AddObject(TCollection_AsciiString& theStr,
+ CORBA::Object_ptr theObject);
+ // add object to script string
+
+ template <class _array>
+ static TCollection_AsciiString& AddArray(TCollection_AsciiString& theStr,
+ const _array & array)
+ // put array contents into theStr like this: "[ 1, 2, 5 ]"
+ {
+ ostringstream sout; // can convert long int, and TCollection_AsciiString cant
+ sout << "[ ";
+ for (int i = 1; i <= array.length(); i++) {
+ sout << array[i-1];
+ if ( i < array.length() )
+ sout << ", ";
+ }
+ sout << " ]";
+ theStr += (char*) sout.str().c_str();
+ return theStr;
+ }
+
+ // *****************************************
+ // Internal methods
+ // *****************************************
+public:
+ // Get shape reader
+ GEOM_Client* GetShapeReader();
+
+ // Tags definition
+ static long GetHypothesisRootTag();
+ static long GetAlgorithmsRootTag();
+ static long GetRefOnShapeTag();
+ static long GetRefOnAppliedHypothesisTag();
+ static long GetRefOnAppliedAlgorithmsTag();
+ static long GetSubMeshOnVertexTag();
+ static long GetSubMeshOnEdgeTag();
+ static long GetSubMeshOnFaceTag();
+ static long GetSubMeshOnSolidTag();
+ static long GetSubMeshOnCompoundTag();
+ static long GetSubMeshOnWireTag();
+ static long GetSubMeshOnShellTag();
+ static long GetNodeGroupsTag();
+ static long GetEdgeGroupsTag();
+ static long GetFaceGroupsTag();
+ static long GetVolumeGroupsTag();
+
+ // publishing methods
+ SALOMEDS::SComponent_ptr PublishComponent(SALOMEDS::Study_ptr theStudy);
+ SALOMEDS::SObject_ptr PublishMesh (SALOMEDS::Study_ptr theStudy,
+ SMESH::SMESH_Mesh_ptr theMesh,
+ const char* theName = 0);
+ SALOMEDS::SObject_ptr PublishHypothesis (SALOMEDS::Study_ptr theStudy,
+ SMESH::SMESH_Hypothesis_ptr theHyp,
+ const char* theName = 0);
+ SALOMEDS::SObject_ptr PublishSubMesh (SALOMEDS::Study_ptr theStudy,
+ SMESH::SMESH_Mesh_ptr theMesh,
+ SMESH::SMESH_subMesh_ptr theSubMesh,
+ GEOM::GEOM_Object_ptr theShapeObject,
+ const char* theName = 0);
+ SALOMEDS::SObject_ptr PublishGroup (SALOMEDS::Study_ptr theStudy,
+ SMESH::SMESH_Mesh_ptr theMesh,
+ SMESH::SMESH_GroupBase_ptr theGroup,
+ GEOM::GEOM_Object_ptr theShapeObject,
+ const char* theName = 0);
+ bool AddHypothesisToShape(SALOMEDS::Study_ptr theStudy,
+ SMESH::SMESH_Mesh_ptr theMesh,
+ GEOM::GEOM_Object_ptr theShapeObject,
+ SMESH::SMESH_Hypothesis_ptr theHyp);
+ bool RemoveHypothesisFromShape(SALOMEDS::Study_ptr theStudy,
+ SMESH::SMESH_Mesh_ptr theMesh,
+ GEOM::GEOM_Object_ptr theShapeObject,
+ SMESH::SMESH_Hypothesis_ptr theHyp);
+ SALOMEDS::SObject_ptr GetMeshOrSubmeshByShape (SALOMEDS::Study_ptr theStudy,
+ SMESH::SMESH_Mesh_ptr theMesh,
+ GEOM::GEOM_Object_ptr theShape);
+ static void SetName(SALOMEDS::SObject_ptr theSObject,
+ const char* theName,
+ const char* theDefaultName = 0);
+
+ // Get study context
+ StudyContext* GetCurrentStudyContext();
+
+ // Register an object in a StudyContext; return object id
+ int RegisterObject(CORBA::Object_ptr theObject);
+
+ // Get current study ID
+ int GetCurrentStudyID()
+ { return myCurrentStudy->_is_nil() ? -1 : myCurrentStudy->StudyId(); }
+
+private:
+ // Create hypothesis of given type
+ SMESH::SMESH_Hypothesis_ptr createHypothesis( const char* theHypName,
+ const char* theLibName)
+ throw ( SALOME::SALOME_Exception );
+
+ // Create empty mesh on shape
+ SMESH::SMESH_Mesh_ptr createMesh()
+ throw ( SALOME::SALOME_Exception );
+
+ static void loadGeomData( SALOMEDS::SComponent_ptr theCompRoot );