Salome HOME
0020889: EDF 1433 SMESH: SplitHexaToTetra: add the 24 tetras mode
[modules/smesh.git] / src / SMESH_I / SMESH_Group_i.hxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
24 //  File   : SMESH_Group_i.hxx
25 //  Author : Sergey ANIKIN, OCC
26 //  Module : SMESH
27 //
28 #ifndef SMESH_Group_i_HeaderFile
29 #define SMESH_Group_i_HeaderFile
30
31 #include "SMESH.hxx"
32 #include "SMESH_Mesh_i.hxx"
33
34 #include <SALOMEconfig.h>
35 #include CORBA_SERVER_HEADER(SMESH_Group)
36 #include CORBA_SERVER_HEADER(SMESH_Mesh)
37 #include CORBA_CLIENT_HEADER(GEOM_Gen)
38
39 #include "SALOME_GenericObj_i.hh"
40
41 class SMESH_Group;
42 class SMESHDS_GroupBase;
43
44 // ===========
45 // Group Base
46 // ===========
47 class SMESH_I_EXPORT SMESH_GroupBase_i:
48   public virtual POA_SMESH::SMESH_GroupBase,
49   public virtual SALOME::GenericObj_i
50 {
51  public:
52   SMESH_GroupBase_i(PortableServer::POA_ptr thePOA,
53                     SMESH_Mesh_i* theMeshServant,
54                     const int theLocalID );
55   virtual ~SMESH_GroupBase_i();
56
57   // CORBA interface implementation
58   void SetName(const char* name);
59   char* GetName();
60   SMESH::ElementType GetType();
61   CORBA::Long Size();
62   CORBA::Boolean IsEmpty();
63   CORBA::Boolean Contains(CORBA::Long elem_id);
64   CORBA::Long GetID(CORBA::Long elem_index);
65   SMESH::long_array* GetListOfID();
66   SMESH::SMESH_Mesh_ptr GetMesh();
67
68   /*!
69    * Returns statistic of mesh elements
70    * Result array of number enityties
71    * Inherited from SMESH_IDSource
72    */
73   virtual SMESH::long_array* GetMeshInfo();
74
75   // Inherited from SMESH_IDSource interface
76   virtual SMESH::long_array* GetIDs();
77
78   /*!
79    * Returns types of elements it contains
80    * Inherited from SMESH_IDSource interface
81    */
82   virtual SMESH::array_of_ElementType* GetTypes();
83
84   // Internal C++ interface
85   int GetLocalID() const { return myLocalID; }
86   SMESH_Mesh_i* GetMeshServant() const { return myMeshServant; }
87   SMESH_Group* GetSmeshGroup() const;
88   SMESHDS_GroupBase* GetGroupDS() const;
89
90   void SetColor(const SALOMEDS::Color& color);
91   SALOMEDS::Color GetColor();
92
93   void SetColorNumber(CORBA::Long color);
94   CORBA::Long GetColorNumber();
95
96 private:
97   SMESH_Mesh_i* myMeshServant;
98   int myLocalID;
99
100   void changeLocalId(int localId) { myLocalID = localId; }
101   friend void SMESH_Mesh_i::CheckGeomGroupModif();
102 };
103
104 // ======
105 // Group
106 // ======
107
108 class SMESH_I_EXPORT SMESH_Group_i:
109   public virtual POA_SMESH::SMESH_Group,
110   public SMESH_GroupBase_i
111 {
112  public:
113   SMESH_Group_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID );
114
115   // CORBA interface implementation
116   void Clear();
117   CORBA::Long Add( const SMESH::long_array& theIDs );
118   CORBA::Long Remove( const SMESH::long_array& theIDs );
119
120   CORBA::Long AddByPredicate( SMESH::Predicate_ptr thePredicate );
121   CORBA::Long RemoveByPredicate( SMESH::Predicate_ptr thePredicate );
122
123   CORBA::Long AddFrom( SMESH::SMESH_IDSource_ptr theSource );
124 };
125
126 // =========================
127 // Group linked to geometry
128 // =========================
129
130 class SMESH_I_EXPORT SMESH_GroupOnGeom_i:
131   public virtual POA_SMESH::SMESH_GroupOnGeom,
132   public SMESH_GroupBase_i
133 {
134  public:
135   SMESH_GroupOnGeom_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID );
136
137   // CORBA interface implementation
138   GEOM::GEOM_Object_ptr GetShape();
139 };
140 #endif