]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
DumpPython Filter / Controls
authorapo <apo@opencascade.com>
Thu, 31 Mar 2005 06:12:52 +0000 (06:12 +0000)
committerapo <apo@opencascade.com>
Thu, 31 Mar 2005 06:12:52 +0000 (06:12 +0000)
src/SMESH_I/SMESH_DumpPython.cxx
src/SMESH_I/SMESH_Filter_i.cxx
src/SMESH_I/SMESH_PythonDump.hxx

index db8721515fd49fe618ca988cc572dac5a0629079..44483535fb25a2978db03b2f9d1d41b7d7698179 100644 (file)
 #include <TColStd_HSequenceOfInteger.hxx>
 #include <TCollection_AsciiString.hxx>
 
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
 namespace SMESH
 {
 
@@ -31,10 +37,53 @@ namespace SMESH
        std::string aString = myStream.str();
        TCollection_AsciiString aCollection(Standard_CString(aString.c_str()));
        aSMESHGen->AddToPythonScript(aStudy->StudyId(),aCollection);
+       if(MYDEBUG) MESSAGE(aString);
       }
     }
   }
 
+  TPythonDump& 
+  TPythonDump::
+  operator<<(long int theArg){
+    myStream<<theArg;
+    return *this;
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(int theArg){
+    myStream<<theArg;
+    return *this;
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(double theArg){
+    myStream<<theArg;
+    return *this;
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(float theArg){
+    myStream<<theArg;
+    return *this;
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(const void* theArg){
+    myStream<<theArg;
+    return *this;
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(const char* theArg){
+    myStream<<theArg;
+    return *this;
+  }
+
   TPythonDump& 
   TPythonDump::
   operator<<(const SMESH::ElementType& theArg)
@@ -106,7 +155,7 @@ namespace SMESH
   TPythonDump::
   operator<<(SMESH::FilterManager_i* theArg)
   {
-    myStream<<"aFilterManager"<<theArg;
+    myStream<<"aFilterManager";
     return *this;
   }
 
@@ -439,6 +488,7 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
   
   aScript += "def RebuildData(theStudy):";
   aScript += "\n\tsmesh = salome.lcc.FindOrLoadComponent(\"FactoryServer\", \"SMESH\")";
+  aScript += "\n\taFilterManager = smesh.CreateFilterManager()";
   if ( isPublished )
     aScript += "\n\tsmesh.SetCurrentStudy(theStudy)";
   else
index b376956f8f53ded3cf076bba93e75b31bddbd168..76b2e8e796e851c01650801e852f43239b7cd65b 100644 (file)
@@ -1554,7 +1554,6 @@ SMESH::FilterManager_ptr SMESH_Gen_i::CreateFilterManager()
 {
   SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
   SMESH::FilterManager_var anObj = aFilter->_this();
-  TPythonDump()<<aFilter<<" = smesh.CreateFilterManager()";
   return anObj._retn();
 }
 
@@ -1846,12 +1845,13 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
   if ( myPredicate != 0 )
     myPredicate->Destroy();
 
-    SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
-    FilterManager_ptr aFilterMgr = aFilter->_this();
-
+  SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
+  FilterManager_ptr aFilterMgr = aFilter->_this();
+  
   // CREATE two lists ( PREDICATES  and LOG OP )
 
   // Criterion
+  TPythonDump()<<"aCriteria = []";
   std::list<SMESH::Predicate_ptr> aPredicates;
   std::list<int>                  aBinaries;
   for ( int i = 0, n = theCriteria.length(); i < n; i++ )
@@ -1866,10 +1866,10 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
     ElementType aTypeOfElem   = theCriteria[ i ].TypeOfElement;
     long        aPrecision    = theCriteria[ i ].Precision;
 
-    TPythonDump()<<this<<".SetCriteria(SMESH.Filter.Criteria("<<
+    TPythonDump()<<"aCriteria.append(SMESH.Filter.Criterion("<<
       aCriterion<<","<<aCompare<<","<<aThreshold<<","<<aUnary<<","<<aBinary<<","<<
       aTolerance<<",'"<<aThresholdStr<<"',"<<aTypeOfElem<<","<<aPrecision<<"))";
-    
+
     SMESH::Predicate_ptr aPredicate = SMESH::Predicate::_nil();
     SMESH::NumericalFunctor_ptr aFunctor = SMESH::NumericalFunctor::_nil();
 
@@ -2007,6 +2007,7 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
     aBinaries.push_back( aBinary );
 
   } // end of for
+  TPythonDump()<<this<<".SetCriteria(aCriteria)";
 
   // CREATE ONE PREDICATE FROM PREVIOUSLY CREATED MAP
 
@@ -2439,7 +2440,7 @@ FilterLibrary_i::~FilterLibrary_i()
 //=======================================================================
 Filter_ptr FilterLibrary_i::Copy( const char* theFilterName )
 {
-  Filter_ptr aRes;
+  Filter_ptr aRes = Filter::_nil();
   LDOM_Node aFilter = findFilter( theFilterName, myDoc );
 
   if ( aFilter.isNull() )
index 34545cf65a6bbcc65544e2a6c02fc57b9d49520b..86133cf8aff44c7cc88b5f9003e7dbe232d83d68 100644 (file)
@@ -41,40 +41,22 @@ namespace SMESH
     virtual ~TPythonDump();
     
     TPythonDump& 
-    operator<<(long int theArg){
-      myStream<<theArg;
-      return *this;
-    }
+    operator<<(long int theArg);
 
     TPythonDump& 
-    operator<<(int theArg){
-      myStream<<theArg;
-      return *this;
-    }
+    operator<<(int theArg);
 
     TPythonDump& 
-    operator<<(double theArg){
-      myStream<<theArg;
-      return *this;
-    }
+    operator<<(double theArg);
 
     TPythonDump& 
-    operator<<(float theArg){
-      myStream<<theArg;
-      return *this;
-    }
+    operator<<(float theArg);
 
     TPythonDump& 
-    operator<<(const void* theArg){
-      myStream<<theArg;
-      return *this;
-    }
+    operator<<(const void* theArg);
 
     TPythonDump& 
-    operator<<(const char* theArg){
-      myStream<<theArg;
-      return *this;
-    }
+    operator<<(const char* theArg);
 
     TPythonDump& 
     operator<<(const SMESH::ElementType& theArg);