Salome HOME
PR: synchro V6_main tag mergeto_V7_main_11Feb13
[modules/smesh.git] / src / SMESH_I / SMESH_Group_i.hxx
index 4d97f6cbbd3091c94986cedd7b6c7ea918346d88..226319b62f2bb6fe3a8d345fef4b1fc4b1d88883 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  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
@@ -30,6 +30,7 @@
 
 #include "SMESH.hxx"
 #include "SMESH_Mesh_i.hxx"
+#include "SMESH_Filter_i.hxx"
 
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SMESH_Group)
@@ -40,6 +41,7 @@
 
 class SMESH_Group;
 class SMESHDS_GroupBase;
+class SMESH_PreMeshInfo;
 
 // ===========
 // Group Base
@@ -50,8 +52,8 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
 {
  public:
   SMESH_GroupBase_i(PortableServer::POA_ptr thePOA,
-                    SMESH_Mesh_i* theMeshServant,
-                    const int theLocalID );
+                    SMESH_Mesh_i*           theMeshServant,
+                    const int               theLocalID );
   virtual ~SMESH_GroupBase_i();
 
   // CORBA interface implementation
@@ -63,7 +65,11 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
   CORBA::Boolean Contains(CORBA::Long elem_id);
   CORBA::Long GetID(CORBA::Long elem_index);
   SMESH::long_array* GetListOfID();
-  SMESH::SMESH_Mesh_ptr GetMesh();
+  SMESH::long_array* GetNodeIDs();
+  CORBA::Long GetNumberOfNodes();
+  CORBA::Boolean IsNodeInfoAvailable(); // for gui
+
+  virtual SMESH::SMESH_Mesh_ptr GetMesh();
 
   /*!
    * Returns statistic of mesh elements
@@ -80,6 +86,11 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
    * Inherited from SMESH_IDSource interface
    */
   virtual SMESH::array_of_ElementType* GetTypes();
+  /*!
+   * Returns false if GetMeshInfo() returns incorrect information that may
+   * happen if mesh data is not yet fully loaded from the file of study.
+   */
+  virtual bool IsMeshInfoCorrect();
 
   // Internal C++ interface
   int GetLocalID() const { return myLocalID; }
@@ -93,6 +104,14 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
   void SetColorNumber(CORBA::Long color);
   CORBA::Long GetColorNumber();
 
+protected:
+
+  SMESH_PreMeshInfo* & changePreMeshInfo() { return myPreMeshInfo; }
+  SMESH_PreMeshInfo* myPreMeshInfo; // mesh info before full loading from study file
+  friend class SMESH_PreMeshInfo;
+
+  int myNbNodes, myGroupDSTic;
+
 private:
   SMESH_Mesh_i* myMeshServant;
   int myLocalID;
@@ -110,8 +129,9 @@ class SMESH_I_EXPORT SMESH_Group_i:
   public SMESH_GroupBase_i
 {
  public:
-  SMESH_Group_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID );
-
+  SMESH_Group_i( PortableServer::POA_ptr thePOA,
+                 SMESH_Mesh_i*           theMeshServant,
+                 const int               theLocalID );
   // CORBA interface implementation
   void Clear();
   CORBA::Long Add( const SMESH::long_array& theIDs );
@@ -132,9 +152,44 @@ class SMESH_I_EXPORT SMESH_GroupOnGeom_i:
   public SMESH_GroupBase_i
 {
  public:
-  SMESH_GroupOnGeom_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID );
-
+  SMESH_GroupOnGeom_i( PortableServer::POA_ptr thePOA,
+                       SMESH_Mesh_i*           theMeshServant,
+                       const int               theLocalID );
   // CORBA interface implementation
   GEOM::GEOM_Object_ptr GetShape();
 };
+
+// =========================
+// Group deined by filter
+// =========================
+
+class SMESH_I_EXPORT SMESH_GroupOnFilter_i:
+  public virtual POA_SMESH::SMESH_GroupOnFilter,
+  public SMESH_GroupBase_i,
+  public SMESH::Filter_i::TPredicateChangeWaiter
+{
+ public:
+  SMESH_GroupOnFilter_i( PortableServer::POA_ptr thePOA,
+                         SMESH_Mesh_i*           theMeshServant,
+                         const int               theLocalID );
+  ~SMESH_GroupOnFilter_i();
+
+  // Persistence
+  static SMESH::Filter_ptr StringToFilter(const std::string& thePersistentString );
+  std::string FilterToString() const;
+
+  static SMESH_PredicatePtr GetPredicate( SMESH::Filter_ptr );
+
+  // CORBA interface implementation
+  void SetFilter(SMESH::Filter_ptr theFilter);
+  SMESH::Filter_ptr GetFilter();
+  virtual SMESH::long_array* GetListOfID();
+  virtual SMESH::long_array* GetMeshInfo();
+
+  // method of SMESH::Filter_i::TPredicateChangeWaiter
+  virtual void PredicateChanged();
+
+ private:
+  SMESH::Filter_var myFilter;
+};
 #endif