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::SMESH_Mesh_ptr GetMesh();
70 * Returns statistic of mesh elements
71 * Result array of number enityties
72 * Inherited from SMESH_IDSource
74 virtual SMESH::long_array* GetMeshInfo();
76 // Inherited from SMESH_IDSource interface
77 virtual SMESH::long_array* GetIDs();
80 * Returns types of elements it contains
81 * Inherited from SMESH_IDSource interface
83 virtual SMESH::array_of_ElementType* GetTypes();
85 // Internal C++ interface
86 int GetLocalID() const { return myLocalID; }
87 SMESH_Mesh_i* GetMeshServant() const { return myMeshServant; }
88 SMESH_Group* GetSmeshGroup() const;
89 SMESHDS_GroupBase* GetGroupDS() const;
91 void SetColor(const SALOMEDS::Color& color);
92 SALOMEDS::Color GetColor();
94 void SetColorNumber(CORBA::Long color);
95 CORBA::Long GetColorNumber();
98 SMESH_Mesh_i* myMeshServant;
101 void changeLocalId(int localId) { myLocalID = localId; }
102 friend class SMESH_Mesh_i;
109 class SMESH_I_EXPORT SMESH_Group_i:
110 public virtual POA_SMESH::SMESH_Group,
111 public SMESH_GroupBase_i
114 SMESH_Group_i( PortableServer::POA_ptr thePOA,
115 SMESH_Mesh_i* theMeshServant,
116 const int theLocalID );
117 // CORBA interface implementation
119 CORBA::Long Add( const SMESH::long_array& theIDs );
120 CORBA::Long Remove( const SMESH::long_array& theIDs );
122 CORBA::Long AddByPredicate( SMESH::Predicate_ptr thePredicate );
123 CORBA::Long RemoveByPredicate( SMESH::Predicate_ptr thePredicate );
125 CORBA::Long AddFrom( SMESH::SMESH_IDSource_ptr theSource );
128 // =========================
129 // Group linked to geometry
130 // =========================
132 class SMESH_I_EXPORT SMESH_GroupOnGeom_i:
133 public virtual POA_SMESH::SMESH_GroupOnGeom,
134 public SMESH_GroupBase_i
137 SMESH_GroupOnGeom_i( PortableServer::POA_ptr thePOA,
138 SMESH_Mesh_i* theMeshServant,
139 const int theLocalID );
140 // CORBA interface implementation
141 GEOM::GEOM_Object_ptr GetShape();
144 // =========================
145 // Group deined by filter
146 // =========================
148 class SMESH_I_EXPORT SMESH_GroupOnFilter_i:
149 public virtual POA_SMESH::SMESH_GroupOnFilter,
150 public SMESH_GroupBase_i,
151 public SMESH::Filter_i::TPredicateChangeWaiter
154 SMESH_GroupOnFilter_i( PortableServer::POA_ptr thePOA,
155 SMESH_Mesh_i* theMeshServant,
156 const int theLocalID );
157 ~SMESH_GroupOnFilter_i();
160 static SMESH::Filter_ptr StringToFilter(const std::string& thePersistentString );
161 std::string FilterToString() const;
163 static SMESH_PredicatePtr GetPredicate( SMESH::Filter_ptr );
165 // CORBA interface implementation
166 void SetFilter(SMESH::Filter_ptr theFilter);
167 SMESH::Filter_ptr GetFilter();
169 // method of SMESH::Filter_i::TPredicateChangeWaiter
170 virtual void PredicateChanged();
173 SMESH::Filter_var myFilter;