1 // Copyright (C) 2007-2013 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;
44 class SMESH_PreMeshInfo;
49 class SMESH_I_EXPORT SMESH_GroupBase_i:
50 public virtual POA_SMESH::SMESH_GroupBase,
51 public virtual SALOME::GenericObj_i
54 SMESH_GroupBase_i(PortableServer::POA_ptr thePOA,
55 SMESH_Mesh_i* theMeshServant,
56 const int theLocalID );
57 virtual ~SMESH_GroupBase_i();
59 // CORBA interface implementation
60 void SetName(const char* name);
62 SMESH::ElementType GetType();
64 CORBA::Boolean IsEmpty();
65 CORBA::Boolean Contains(CORBA::Long elem_id);
66 CORBA::Long GetID(CORBA::Long elem_index);
67 SMESH::long_array* GetListOfID();
68 SMESH::long_array* GetNodeIDs();
69 CORBA::Long GetNumberOfNodes();
70 CORBA::Boolean IsNodeInfoAvailable(); // for gui
72 virtual SMESH::SMESH_Mesh_ptr GetMesh();
75 * Returns number of mesh elements of each \a EntityType
76 * Result array of number of elements per \a EntityType
77 * Inherited from SMESH_IDSource
79 virtual SMESH::long_array* GetMeshInfo();
81 * Returns number of mesh elements of each \a ElementType
83 virtual SMESH::long_array* GetNbElementsByType();
85 * Returns a sequence of all element IDs
87 virtual SMESH::long_array* GetIDs();
89 * Returns types of elements it contains
90 * Inherited from SMESH_IDSource interface
92 virtual SMESH::array_of_ElementType* GetTypes();
94 * Returns false if GetMeshInfo() returns incorrect information that may
95 * happen if mesh data is not yet fully loaded from the file of study.
97 virtual bool IsMeshInfoCorrect();
99 // Internal C++ interface
100 int GetLocalID() const { return myLocalID; }
101 SMESH_Mesh_i* GetMeshServant() const { return myMeshServant; }
102 SMESH_Group* GetSmeshGroup() const;
103 SMESHDS_GroupBase* GetGroupDS() const;
105 void SetColor(const SALOMEDS::Color& color);
106 SALOMEDS::Color GetColor();
108 void SetColorNumber(CORBA::Long color);
109 CORBA::Long GetColorNumber();
113 SMESH_PreMeshInfo* & changePreMeshInfo() { return myPreMeshInfo; }
114 SMESH_PreMeshInfo* myPreMeshInfo; // mesh info before full loading from study file
115 friend class SMESH_PreMeshInfo;
117 int myNbNodes, myGroupDSTic;
120 SMESH_Mesh_i* myMeshServant;
123 void changeLocalId(int localId) { myLocalID = localId; }
124 friend class SMESH_Mesh_i;
131 class SMESH_I_EXPORT SMESH_Group_i:
132 public virtual POA_SMESH::SMESH_Group,
133 public SMESH_GroupBase_i
136 SMESH_Group_i( PortableServer::POA_ptr thePOA,
137 SMESH_Mesh_i* theMeshServant,
138 const int theLocalID );
139 // CORBA interface implementation
141 CORBA::Long Add( const SMESH::long_array& theIDs );
142 CORBA::Long Remove( const SMESH::long_array& theIDs );
144 CORBA::Long AddByPredicate( SMESH::Predicate_ptr thePredicate );
145 CORBA::Long RemoveByPredicate( SMESH::Predicate_ptr thePredicate );
147 CORBA::Long AddFrom( SMESH::SMESH_IDSource_ptr theSource );
150 // =========================
151 // Group linked to geometry
152 // =========================
154 class SMESH_I_EXPORT SMESH_GroupOnGeom_i:
155 public virtual POA_SMESH::SMESH_GroupOnGeom,
156 public SMESH_GroupBase_i
159 SMESH_GroupOnGeom_i( PortableServer::POA_ptr thePOA,
160 SMESH_Mesh_i* theMeshServant,
161 const int theLocalID );
162 // CORBA interface implementation
163 GEOM::GEOM_Object_ptr GetShape();
166 // =========================
167 // Group deined by filter
168 // =========================
170 class SMESH_I_EXPORT SMESH_GroupOnFilter_i:
171 public virtual POA_SMESH::SMESH_GroupOnFilter,
172 public SMESH_GroupBase_i,
173 public SMESH::Filter_i::TPredicateChangeWaiter
176 SMESH_GroupOnFilter_i( PortableServer::POA_ptr thePOA,
177 SMESH_Mesh_i* theMeshServant,
178 const int theLocalID );
179 ~SMESH_GroupOnFilter_i();
182 static SMESH::Filter_ptr StringToFilter(const std::string& thePersistentString );
183 std::string FilterToString() const;
185 static SMESH_PredicatePtr GetPredicate( SMESH::Filter_ptr );
187 // CORBA interface implementation
188 void SetFilter(SMESH::Filter_ptr theFilter);
189 SMESH::Filter_ptr GetFilter();
190 virtual SMESH::long_array* GetListOfID();
191 virtual SMESH::long_array* GetMeshInfo();
193 // method of SMESH::Filter_i::TPredicateChangeWaiter
194 virtual void PredicateChanged();
197 SMESH::Filter_var myFilter;