]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
PythonDump for SMESH Controls / Filter
authorapo <apo@opencascade.com>
Wed, 30 Mar 2005 10:18:40 +0000 (10:18 +0000)
committerapo <apo@opencascade.com>
Wed, 30 Mar 2005 10:18:40 +0000 (10:18 +0000)
idl/SMESH_Filter.idl
src/SMESH_I/SMESH_Filter_i.cxx
src/SMESH_I/SMESH_Filter_i.hxx

index 0644362d43c076c62ea248d457856d9897f53ae1..929afb67a533196a54a3ec3fcadbb4564614952e 100644 (file)
@@ -278,7 +278,7 @@ module SMESH
   /*!
   *  Filter
   */
-  interface Filter: SALOME::GenericObj
+  interface Filter: SALOME::GenericObj, SMESH_IDSource
   {
     /*!
     * Structure containing information about one criterion
@@ -312,6 +312,8 @@ module SMESH
     typedef sequence<Criterion> Criteria;
 
     void          SetPredicate( in Predicate thePredicate );
+    void          SetMesh( in SMESH_Mesh theMesh );
+
     long_array    GetElementsId( in SMESH_Mesh theMesh );
     ElementType   GetElementType();
     Predicate     GetPredicate();
index 9374d8d338fdd4122b3753679bcb4332c5eb5648..a04b5a3c553f4157ddc9dc82a33f4165bd44e10f 100644 (file)
@@ -411,6 +411,11 @@ Functor_i::Functor_i():
   SMESH_Gen_i::GetPOA()->activate_object( this );
 }
 
+Functor_i::~Functor_i()
+{
+  TPythonDump()<<this<<".Destroy()";
+}
+
 void Functor_i::SetMesh( SMESH_Mesh_ptr theMesh )
 {
   myFunctorPtr->SetMesh( MeshPtr2SMDSMesh( theMesh ) );
@@ -1287,6 +1292,13 @@ FilterManager_i::FilterManager_i()
   SMESH_Gen_i::GetPOA()->activate_object( this );
 }
 
+
+FilterManager_i::~FilterManager_i()
+{
+  TPythonDump()<<this<<".Destroy()";
+}
+
+
 MinimumAngle_ptr FilterManager_i::CreateMinimumAngle()
 {
   SMESH::MinimumAngle_i* aServant = new SMESH::MinimumAngle_i();
@@ -1565,6 +1577,11 @@ Filter_i::~Filter_i()
 {
   if ( myPredicate )
     myPredicate->Destroy();
+
+  if(!CORBA::is_nil(myMesh))
+    myMesh->Destroy();
+
+  TPythonDump()<<this<<".Destroy()";
 }
 
 //=======================================================================
@@ -1599,12 +1616,25 @@ SMESH::ElementType Filter_i::GetElementType()
 // name    : Filter_i::SetMesh
 // Purpose : Set mesh
 //=======================================================================
-void Filter_i::SetMesh( SMESH_Mesh_ptr theMesh )
+void 
+Filter_i::
+SetMesh( SMESH_Mesh_ptr theMesh )
 {
-  if(myPredicate){
-    myPredicate->SetMesh( theMesh );
-    TPythonDump()<<this<<".SetMesh("<<theMesh<<")";
-  }
+  if(!CORBA::is_nil(theMesh))
+    theMesh->Register();
+
+  if(!CORBA::is_nil(myMesh))
+    myMesh->Destroy();
+
+  myMesh = theMesh;
+  TPythonDump()<<this<<".SetMesh("<<theMesh<<")";
+}
+
+SMESH::long_array* 
+Filter_i::
+GetIDs()
+{
+  return GetElementsId(myMesh);
 }
 
 //=======================================================================
@@ -1634,16 +1664,15 @@ SMESH::long_array*
 Filter_i::
 GetElementsId( SMESH_Mesh_ptr theMesh )
 {
-  Controls::Filter::TIdSequence aSequence;
-  GetElementsId(myPredicate,theMesh,aSequence);
-
   SMESH::long_array_var anArray = new SMESH::long_array;
-  long i = 0, iEnd = aSequence.size();
-
-  anArray->length( iEnd );
-  for ( ; i < iEnd; i++ )
-    anArray[ i ] = aSequence[i];
-
+  if(!CORBA::is_nil(theMesh)){
+    Controls::Filter::TIdSequence aSequence;
+    GetElementsId(myPredicate,theMesh,aSequence);
+    long i = 0, iEnd = aSequence.size();
+    anArray->length( iEnd );
+    for ( ; i < iEnd; i++ )
+      anArray[ i ] = aSequence[i];
+  }
   return anArray._retn();
 }
 
@@ -2399,6 +2428,7 @@ FilterLibrary_i::FilterLibrary_i()
 FilterLibrary_i::~FilterLibrary_i()
 {
   delete myFileName;
+  TPythonDump()<<this<<".Destroy()";
 }
 
 //=======================================================================
index 34656f075b554845927ea0b7ecbb85eff188275a..b634bfe9d4c7a94cf845635a45b8701dbd13f04f 100644 (file)
@@ -125,6 +125,7 @@ namespace SMESH
     
   protected:
     Functor_i();
+    ~Functor_i();
   protected:                                
     Controls::FunctorPtr            myFunctorPtr;
   };
@@ -629,32 +630,57 @@ namespace SMESH
   {
   public:
     Filter_i();
-    virtual          ~Filter_i();
+    ~Filter_i();
     
-    void             SetPredicate( Predicate_ptr );
-    void             SetMesh( SMESH_Mesh_ptr );
+    virtual
+    void
+    SetPredicate( Predicate_ptr );
+
+    virtual
+    void
+    SetMesh( SMESH_Mesh_ptr );
+
+    virtual
+    SMESH::long_array* 
+    GetIDs();
     
     static
-    void             GetElementsId( Predicate_i*,
-                                   const SMDS_Mesh*,
-                                   Controls::Filter::TIdSequence& );
+    void
+    GetElementsId( Predicate_i*,
+                  const SMDS_Mesh*,
+                  Controls::Filter::TIdSequence& );
     static
-    void             GetElementsId( Predicate_i*,
-                                   SMESH_Mesh_ptr,
-                                   Controls::Filter::TIdSequence& );
+    void           
+    GetElementsId( Predicate_i*,
+                  SMESH_Mesh_ptr,
+                  Controls::Filter::TIdSequence& );
+    
+    virtual
+    long_array*      
+    GetElementsId( SMESH_Mesh_ptr );
 
-    long_array*      GetElementsId( SMESH_Mesh_ptr );
-    ElementType      GetElementType();
+    virtual
+    ElementType      
+    GetElementType();
     
-    CORBA::Boolean   GetCriteria( SMESH::Filter::Criteria_out theCriteria );
-    CORBA::Boolean   SetCriteria( const SMESH::Filter::Criteria& theCriteria );
+    virtual
+    CORBA::Boolean   
+    GetCriteria( SMESH::Filter::Criteria_out theCriteria );
+
+    virtual
+    CORBA::Boolean
+    SetCriteria( const SMESH::Filter::Criteria& theCriteria );
     
-    Predicate_ptr    GetPredicate();
+    virtual
+    Predicate_ptr
+    GetPredicate();
+
     Predicate_i*     GetPredicate_i();
 
   private:
     Controls::Filter myFilter;
     Predicate_i*     myPredicate;
+    SMESH_Mesh_var   myMesh;
   };
   
   
@@ -704,6 +730,8 @@ namespace SMESH
   {
   public:
     FilterManager_i();
+    ~FilterManager_i();
+
     MinimumAngle_ptr          CreateMinimumAngle();
     AspectRatio_ptr           CreateAspectRatio();
     AspectRatio3D_ptr         CreateAspectRatio3D();