Salome HOME
CoTech decision: move MEDWrapper from MED to SMESH
[modules/smesh.git] / src / SMESH_I / SMESH_2smeshpy.hxx
index f92c285b4c4176cf3463c4afe671db5b35fc7e4a..32ad5cd94b017365781c69f5e06c4e8521db50ef 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -37,6 +37,7 @@
 #include <list>
 #include <map>
 #include <vector>
+#include <set>
 
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SALOMEDS)
@@ -46,8 +47,8 @@
  * This file was created in order to respond to requirement of bug PAL10494:
  * SMESH python dump uses idl interface.
  *
- * The creation reason is that smesh.py commands defining hypotheses encapsulate
- * several SMESH engine method calls. As well, the dependencies between smesh.py
+ * The creation reason is that smeshBuilder.py commands defining hypotheses encapsulate
+ * several SMESH engine method calls. As well, the dependencies between smeshBuilder.py
  * classes differ from ones between corresponding SMESH IDL interfaces.
  * 
  * Everything here is for internal usage by SMESH_2smeshpy::ConvertScript()
@@ -122,7 +123,7 @@ public:
   bool IsEmpty() const { return myString.IsEmpty(); }
   _AString GetIndentation();
   const _AString & GetResultValue();
-  const int GetNbResultValues();
+  int GetNbResultValues();
   _AString GetResultValue(int res);
   const _AString & GetObject();
   const _AString & GetMethod();
@@ -222,6 +223,7 @@ class _pyGen: public _pyObject
 public:
   _pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
          Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
+         std::set< TCollection_AsciiString >&      theRemovedObjIDs,
          SALOMEDS::Study_ptr&                      theStudy,
          const bool                                theToKeepAllCommands);
   Handle(_pyCommand) AddCommand( const _AString& theCommand );
@@ -235,8 +237,8 @@ public:
   _pyID GenerateNewID( const _pyID& theID );
   void AddObject( Handle(_pyObject)& theObj );
   void SetProxyObject( const _pyID& theID, Handle(_pyObject)& theObj );
-  Handle(_pyObject) FindObject( const _pyID& theObjID ) const;
-  Handle(_pySubMesh) FindSubMesh( const _pyID& theSubMeshID );
+  Handle(_pyObject)     FindObject( const _pyID& theObjID ) const;
+  Handle(_pySubMesh)    FindSubMesh( const _pyID& theSubMeshID );
   Handle(_pyHypothesis) FindHyp( const _pyID& theHypID );
   Handle(_pyHypothesis) FindAlgo( const _pyID& theGeom, const _pyID& theMesh,
                                   const Handle(_pyHypothesis)& theHypothesis);
@@ -248,6 +250,7 @@ public:
 
   bool IsGeomObject(const _pyID& theObjID) const;
   bool IsNotPublished(const _pyID& theObjID) const;
+  void ObjectCreationRemoved(const _pyID& theObjID);
   bool IsToKeepAllCommands() const { return myToKeepAllCommands; }
   void AddExportedMesh(const _AString& file, const ExportedMeshData& mesh )
   { myFile2ExportedMesh[ file ] = mesh; }
@@ -265,23 +268,25 @@ private:
   void setNeighbourCommand( Handle(_pyCommand)& theCmd,
                             Handle(_pyCommand)& theOtherCmd,
                             const bool theIsAfter );
-  
+  void addFilterUser( Handle(_pyCommand)& theCmd, const Handle(_pyObject)& user );
+
 private:
-  std::map< _pyID, Handle(_pyMesh) >       myMeshes;
-  std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors;
-  std::map< _pyID, Handle(_pyObject) >     myObjects;
-  std::list< Handle(_pyHypothesis) >       myHypos;
-  std::list< Handle(_pyCommand) >          myCommands;
-  int                                      myNbCommands;
+  std::map< _pyID, Handle(_pyMesh) >        myMeshes;
+  std::map< _pyID, Handle(_pyMeshEditor) >  myMeshEditors;
+  std::map< _pyID, Handle(_pyObject) >      myObjects;
+  std::list< Handle(_pyHypothesis) >        myHypos;
+  std::list< Handle(_pyCommand) >           myCommands;
+  int                                       myNbCommands;
   Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod;
   Resource_DataMapOfAsciiStringAsciiString& myObjectNames;
-  Handle(_pyCommand)                       myLastCommand;
-  int                                      myNbFilters;
-  bool                                     myToKeepAllCommands;
-  SALOMEDS::Study_var                      myStudy;
-  int                                      myGeomIDNb, myGeomIDIndex;
-  std::map< _AString, ExportedMeshData >   myFile2ExportedMesh;
-  Handle( _pyHypothesisReader )            myHypReader;
+  std::set< TCollection_AsciiString >&      myRemovedObjIDs;
+  Handle(_pyCommand)                        myLastCommand;
+  int                                       myNbFilters;
+  bool                                      myToKeepAllCommands;
+  SALOMEDS::Study_var                       myStudy;
+  int                                       myGeomIDNb, myGeomIDIndex;
+  std::map< _AString, ExportedMeshData >    myFile2ExportedMesh;
+  Handle( _pyHypothesisReader )             myHypReader;
 
   DEFINE_STANDARD_RTTI (_pyGen)
 };
@@ -295,7 +300,7 @@ private:
 class _pyMesh: public _pyObject
 {
   std::list< Handle(_pyHypothesis) > myHypos;
-  std::list< Handle(_pyCommand) >    myAddHypCmds;
+  std::list< Handle(_pyCommand) >    myAddHypCmds, myNotConvertedAddHypCmds;
   std::list< Handle(_pySubMesh) >    mySubmeshes;
   std::list< Handle(_pyGroup) >      myGroups;
   std::list< Handle(_pyMeshEditor)>  myEditors;
@@ -360,7 +365,7 @@ protected:
   _pyID   myGeom,   myMesh;
   struct CreationMethod {
     _AString              myMethod; // method of algo or mesh creating a hyp
-    // myArgNb(i)-th arg of myArgMethods(i) of hyp becomes an i-th arg of myAlgoMethod
+    // myArgNb(i)-th arg of myArgMethods(i) of hyp becomes an i-th arg of myMethod
     std::vector<_AString> myArgMethods;
     std::vector<int>      myArgNb; // arg nb countered from 1
     std::vector<_AString> myArgs; // creation arguments
@@ -369,6 +374,7 @@ protected:
   // a hypothesis can be created by different algos by different methods
   typedef std::map<_AString, CreationMethod > TType2CrMethod;
   TType2CrMethod                myAlgoType2CreationMethod;
+  std::set< _AString >          myAccumulativeMethods;
   CreationMethod*               myCurCrMethod; // used for adding to myAlgoType2CreationMethod
   std::list<Handle(_pyCommand)> myArgCommands;
   std::list<Handle(_pyCommand)> myUnusedCommands;
@@ -389,6 +395,8 @@ public:
   void AddArgMethod(const _AString& method, const int argNb = 1)
   { myCurCrMethod->myArgMethods.push_back( method );
     myCurCrMethod->myArgNb.push_back( argNb ); }
+  void AddAccumulativeMethod( const _AString& method)
+  { myAccumulativeMethods.insert( method ); }
   //const TColStd_SequenceOfAsciiString& GetArgs() const { return myArgs; }
   const std::list<Handle(_pyCommand)>& GetArgCommands() const { return myArgCommands; }
   void ClearAllCommands();
@@ -587,6 +595,8 @@ public:
   virtual void Process( const Handle(_pyCommand)& theCommand);
   virtual void Flush();
   virtual void Free() { myFilter.Nullify(); }
+  virtual bool CanClear();
+  void RemovedWithContents();
 
   DEFINE_STANDARD_RTTI (_pyGroup)
 };