Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/smesh.git] / src / SMESH_I / SMESH_Group_i.hxx
index 8e6e33f9f679c8d360134c20123e1d872137fccc..dcb441057e0399e8978bae67fc1392c0474c78c4 100644 (file)
@@ -1,34 +1,36 @@
-//  Copyright (C) 2007-2008  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
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
 //  File   : SMESH_Group_i.hxx
 //  Author : Sergey ANIKIN, OCC
 //  Module : SMESH
-//  $Header$
 //
 #ifndef SMESH_Group_i_HeaderFile
 #define SMESH_Group_i_HeaderFile
 
 #include "SMESH.hxx"
+#include "SMESH_Mesh_i.hxx"
+#include "SMESH_Filter_i.hxx"
 
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SMESH_Group)
@@ -37,9 +39,9 @@
 
 #include "SALOME_GenericObj_i.hh"
 
-class SMESH_Mesh_i;
 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,11 +65,33 @@ 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
+   * Result array of number enityties
+   * Inherited from SMESH_IDSource
+   */
+  virtual SMESH::long_array* GetMeshInfo();
 
   // Inherited from SMESH_IDSource interface
   virtual SMESH::long_array* GetIDs();
 
+  /*!
+   * Returns types of elements it contains
+   * 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; }
   SMESH_Mesh_i* GetMeshServant() const { return myMeshServant; }
@@ -80,9 +104,20 @@ 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;
+
 private:
   SMESH_Mesh_i* myMeshServant;
   int myLocalID;
+
+  void changeLocalId(int localId) { myLocalID = localId; }
+  friend class SMESH_Mesh_i;
+
+  int myNbNodes, myGroupDSTic;
 };
 
 // ======
@@ -94,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 );
@@ -103,6 +139,8 @@ class SMESH_I_EXPORT SMESH_Group_i:
 
   CORBA::Long AddByPredicate( SMESH::Predicate_ptr thePredicate );
   CORBA::Long RemoveByPredicate( SMESH::Predicate_ptr thePredicate );
+
+  CORBA::Long AddFrom( SMESH::SMESH_IDSource_ptr theSource );
 };
 
 // =========================
@@ -114,9 +152,42 @@ 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();
+
+  // method of SMESH::Filter_i::TPredicateChangeWaiter
+  virtual void PredicateChanged();
+
+ private:
+  SMESH::Filter_var myFilter;
+};
 #endif