Salome HOME
correct previous integration (Porting to Python 2.6)
[modules/smesh.git] / src / SMESH_I / SMESH_Group_i.hxx
1 //  Copyright (C) 2007-2008  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 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
23 //  File   : SMESH_Group_i.hxx
24 //  Author : Sergey ANIKIN, OCC
25 //  Module : SMESH
26 //
27 #ifndef SMESH_Group_i_HeaderFile
28 #define SMESH_Group_i_HeaderFile
29
30 #include "SMESH.hxx"
31 #include "SMESH_Mesh_i.hxx"
32
33 #include <SALOMEconfig.h>
34 #include CORBA_SERVER_HEADER(SMESH_Group)
35 #include CORBA_SERVER_HEADER(SMESH_Mesh)
36 #include CORBA_CLIENT_HEADER(GEOM_Gen)
37
38 #include "SALOME_GenericObj_i.hh"
39
40 class SMESH_Group;
41 class SMESHDS_GroupBase;
42
43 // ===========
44 // Group Base
45 // ===========
46 class SMESH_I_EXPORT SMESH_GroupBase_i:
47   public virtual POA_SMESH::SMESH_GroupBase,
48   public virtual SALOME::GenericObj_i
49 {
50  public:
51   SMESH_GroupBase_i(PortableServer::POA_ptr thePOA,
52                     SMESH_Mesh_i* theMeshServant,
53                     const int theLocalID );
54   virtual ~SMESH_GroupBase_i();
55
56   // CORBA interface implementation
57   void SetName(const char* name);
58   char* GetName();
59   SMESH::ElementType GetType();
60   CORBA::Long Size();
61   CORBA::Boolean IsEmpty();
62   CORBA::Boolean Contains(CORBA::Long elem_id);
63   CORBA::Long GetID(CORBA::Long elem_index);
64   SMESH::long_array* GetListOfID();
65   SMESH::SMESH_Mesh_ptr GetMesh();
66
67   /*!
68    * Returns statistic of mesh elements
69    * Result array of number enityties
70    * Inherited from SMESH_IDSource
71    */
72   virtual SMESH::long_array* GetMeshInfo();
73
74   // Inherited from SMESH_IDSource interface
75   virtual SMESH::long_array* GetIDs();
76
77   // Internal C++ interface
78   int GetLocalID() const { return myLocalID; }
79   SMESH_Mesh_i* GetMeshServant() const { return myMeshServant; }
80   SMESH_Group* GetSmeshGroup() const;
81   SMESHDS_GroupBase* GetGroupDS() const;
82
83   void SetColor(const SALOMEDS::Color& color);
84   SALOMEDS::Color GetColor();
85
86   void SetColorNumber(CORBA::Long color);
87   CORBA::Long GetColorNumber();
88
89 private:
90   SMESH_Mesh_i* myMeshServant;
91   int myLocalID;
92
93   void changeLocalId(int localId) { myLocalID = localId; }
94   friend void SMESH_Mesh_i::CheckGeomGroupModif();
95 };
96
97 // ======
98 // Group
99 // ======
100
101 class SMESH_I_EXPORT SMESH_Group_i:
102   public virtual POA_SMESH::SMESH_Group,
103   public SMESH_GroupBase_i
104 {
105  public:
106   SMESH_Group_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID );
107
108   // CORBA interface implementation
109   void Clear();
110   CORBA::Long Add( const SMESH::long_array& theIDs );
111   CORBA::Long Remove( const SMESH::long_array& theIDs );
112
113   CORBA::Long AddByPredicate( SMESH::Predicate_ptr thePredicate );
114   CORBA::Long RemoveByPredicate( SMESH::Predicate_ptr thePredicate );
115 };
116
117 // =========================
118 // Group linked to geometry
119 // =========================
120
121 class SMESH_I_EXPORT SMESH_GroupOnGeom_i:
122   public virtual POA_SMESH::SMESH_GroupOnGeom,
123   public SMESH_GroupBase_i
124 {
125  public:
126   SMESH_GroupOnGeom_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID );
127
128   // CORBA interface implementation
129   GEOM::GEOM_Object_ptr GetShape();
130 };
131 #endif