1 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
24 // File : SMESH_Group_i.hxx
25 // Author : Sergey ANIKIN, OCC
28 #ifndef SMESH_Group_i_HeaderFile
29 #define SMESH_Group_i_HeaderFile
32 #include "SMESH_Mesh_i.hxx"
33 #include "SMESH_Filter_i.hxx"
35 #include <SALOMEconfig.h>
36 #include CORBA_SERVER_HEADER(SMESH_Group)
37 #include CORBA_SERVER_HEADER(SMESH_Mesh)
38 #include CORBA_CLIENT_HEADER(GEOM_Gen)
40 #include "SALOME_GenericObj_i.hh"
43 class SMESHDS_GroupBase;
48 class SMESH_I_EXPORT SMESH_GroupBase_i:
49 public virtual POA_SMESH::SMESH_GroupBase,
50 public virtual SALOME::GenericObj_i
53 SMESH_GroupBase_i(PortableServer::POA_ptr thePOA,
54 SMESH_Mesh_i* theMeshServant,
55 const int theLocalID );
56 virtual ~SMESH_GroupBase_i();
58 // CORBA interface implementation
59 void SetName(const char* name);
61 SMESH::ElementType GetType();
63 CORBA::Boolean IsEmpty();
64 CORBA::Boolean Contains(CORBA::Long elem_id);
65 CORBA::Long GetID(CORBA::Long elem_index);
66 SMESH::long_array* GetListOfID();
67 SMESH::long_array* GetNodeIDs();
68 CORBA::Long GetNumberOfNodes();
69 CORBA::Boolean IsNodeInfoAvailable(); // for gui
70 SMESH::SMESH_Mesh_ptr GetMesh();
73 * Returns statistic of mesh elements
74 * Result array of number enityties
75 * Inherited from SMESH_IDSource
77 virtual SMESH::long_array* GetMeshInfo();
79 // Inherited from SMESH_IDSource interface
80 virtual SMESH::long_array* GetIDs();
83 * Returns types of elements it contains
84 * Inherited from SMESH_IDSource interface
86 virtual SMESH::array_of_ElementType* GetTypes();
88 // Internal C++ interface
89 int GetLocalID() const { return myLocalID; }
90 SMESH_Mesh_i* GetMeshServant() const { return myMeshServant; }
91 SMESH_Group* GetSmeshGroup() const;
92 SMESHDS_GroupBase* GetGroupDS() const;
94 void SetColor(const SALOMEDS::Color& color);
95 SALOMEDS::Color GetColor();
97 void SetColorNumber(CORBA::Long color);
98 CORBA::Long GetColorNumber();
101 SMESH_Mesh_i* myMeshServant;
104 void changeLocalId(int localId) { myLocalID = localId; }
105 friend class SMESH_Mesh_i;
107 int myNbNodes, myGroupDSTic;
114 class SMESH_I_EXPORT SMESH_Group_i:
115 public virtual POA_SMESH::SMESH_Group,
116 public SMESH_GroupBase_i
119 SMESH_Group_i( PortableServer::POA_ptr thePOA,
120 SMESH_Mesh_i* theMeshServant,
121 const int theLocalID );
122 // CORBA interface implementation
124 CORBA::Long Add( const SMESH::long_array& theIDs );
125 CORBA::Long Remove( const SMESH::long_array& theIDs );
127 CORBA::Long AddByPredicate( SMESH::Predicate_ptr thePredicate );
128 CORBA::Long RemoveByPredicate( SMESH::Predicate_ptr thePredicate );
130 CORBA::Long AddFrom( SMESH::SMESH_IDSource_ptr theSource );
133 // =========================
134 // Group linked to geometry
135 // =========================
137 class SMESH_I_EXPORT SMESH_GroupOnGeom_i:
138 public virtual POA_SMESH::SMESH_GroupOnGeom,
139 public SMESH_GroupBase_i
142 SMESH_GroupOnGeom_i( PortableServer::POA_ptr thePOA,
143 SMESH_Mesh_i* theMeshServant,
144 const int theLocalID );
145 // CORBA interface implementation
146 GEOM::GEOM_Object_ptr GetShape();
149 // =========================
150 // Group deined by filter
151 // =========================
153 class SMESH_I_EXPORT SMESH_GroupOnFilter_i:
154 public virtual POA_SMESH::SMESH_GroupOnFilter,
155 public SMESH_GroupBase_i,
156 public SMESH::Filter_i::TPredicateChangeWaiter
159 SMESH_GroupOnFilter_i( PortableServer::POA_ptr thePOA,
160 SMESH_Mesh_i* theMeshServant,
161 const int theLocalID );
162 ~SMESH_GroupOnFilter_i();
165 static SMESH::Filter_ptr StringToFilter(const std::string& thePersistentString );
166 std::string FilterToString() const;
168 static SMESH_PredicatePtr GetPredicate( SMESH::Filter_ptr );
170 // CORBA interface implementation
171 void SetFilter(SMESH::Filter_ptr theFilter);
172 SMESH::Filter_ptr GetFilter();
174 // method of SMESH::Filter_i::TPredicateChangeWaiter
175 virtual void PredicateChanged();
178 SMESH::Filter_var myFilter;