1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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,
52 public SMESH::NotifyerAndWaiter // defined in SMESH_Filter_i.hxx
55 SMESH_GroupBase_i(PortableServer::POA_ptr thePOA,
56 SMESH_Mesh_i* theMeshServant,
57 const int theLocalID );
58 virtual ~SMESH_GroupBase_i();
60 // CORBA interface implementation
61 void SetName(const char* name);
63 SMESH::ElementType GetType();
65 CORBA::Boolean IsEmpty();
66 CORBA::Boolean Contains(CORBA::Long elem_id);
67 CORBA::Long GetID(CORBA::Long elem_index);
68 SMESH::long_array* GetListOfID();
69 SMESH::long_array* GetNodeIDs();
70 CORBA::Long GetNumberOfNodes();
71 CORBA::Boolean IsNodeInfoAvailable(); // for gui
73 virtual SMESH::SMESH_Mesh_ptr GetMesh();
76 * Returns number of mesh elements of each \a EntityType
77 * Result array of number of elements per \a EntityType
78 * Inherited from SMESH_IDSource
80 virtual SMESH::long_array* GetMeshInfo();
82 * Returns number of mesh elements of each \a ElementType
84 virtual SMESH::long_array* GetNbElementsByType();
86 * Returns a sequence of all element IDs
88 virtual SMESH::long_array* GetIDs();
90 * Returns types of elements it contains
91 * Inherited from SMESH_IDSource interface
93 virtual SMESH::array_of_ElementType* GetTypes();
95 * Returns false if GetMeshInfo() returns incorrect information that may
96 * happen if mesh data is not yet fully loaded from the file of study.
98 virtual bool IsMeshInfoCorrect();
100 * Returns mesh unstructed grid information.
102 virtual SALOMEDS::TMPFile* GetVtkUgStream();
105 * Returns \c true if \c this group depends on the \a other via
106 * FT_BelongToMeshGroup predicate or vice versa
108 virtual CORBA::Boolean IsInDependency( SMESH::SMESH_GroupBase_ptr other );
111 // Internal C++ interface
112 int GetLocalID() const { return myLocalID; }
113 SMESH_Mesh_i* GetMeshServant() const { return myMeshServant; }
114 SMESH_Group* GetSmeshGroup() const;
115 SMESHDS_GroupBase* GetGroupDS() const;
117 void SetColor(const SALOMEDS::Color& color);
118 SALOMEDS::Color GetColor();
120 void SetColorNumber(CORBA::Long color);
121 CORBA::Long GetColorNumber();
125 SMESH_PreMeshInfo* & changePreMeshInfo() { return myPreMeshInfo; }
126 SMESH_PreMeshInfo* myPreMeshInfo; // mesh info before full loading from study file
127 friend class SMESH_PreMeshInfo;
129 int myNbNodes, myGroupDSTic;
132 SMESH_Mesh_i* myMeshServant;
135 void changeLocalId(int localId) { myLocalID = localId; }
136 friend class SMESH_Mesh_i;
143 class SMESH_I_EXPORT SMESH_Group_i:
144 public virtual POA_SMESH::SMESH_Group,
145 public SMESH_GroupBase_i
148 SMESH_Group_i( PortableServer::POA_ptr thePOA,
149 SMESH_Mesh_i* theMeshServant,
150 const int theLocalID );
151 // CORBA interface implementation
153 CORBA::Long Add( const SMESH::long_array& theIDs );
154 CORBA::Long Remove( const SMESH::long_array& theIDs );
156 CORBA::Long AddByPredicate( SMESH::Predicate_ptr thePredicate );
157 CORBA::Long RemoveByPredicate( SMESH::Predicate_ptr thePredicate );
159 CORBA::Long AddFrom( SMESH::SMESH_IDSource_ptr theSource );
162 // =========================
163 // Group linked to geometry
164 // =========================
166 class SMESH_I_EXPORT SMESH_GroupOnGeom_i:
167 public virtual POA_SMESH::SMESH_GroupOnGeom,
168 public SMESH_GroupBase_i
171 SMESH_GroupOnGeom_i( PortableServer::POA_ptr thePOA,
172 SMESH_Mesh_i* theMeshServant,
173 const int theLocalID );
174 // CORBA interface implementation
175 GEOM::GEOM_Object_ptr GetShape();
178 // =========================
179 // Group deined by filter
180 // =========================
182 class SMESH_I_EXPORT SMESH_GroupOnFilter_i:
183 public virtual POA_SMESH::SMESH_GroupOnFilter,
184 public SMESH_GroupBase_i
187 SMESH_GroupOnFilter_i( PortableServer::POA_ptr thePOA,
188 SMESH_Mesh_i* theMeshServant,
189 const int theLocalID );
190 ~SMESH_GroupOnFilter_i();
193 static SMESH::Filter_ptr StringToFilter(const std::string& thePersistentString );
194 std::string FilterToString() const;
196 static SMESH_PredicatePtr GetPredicate( SMESH::Filter_ptr );
198 // CORBA interface implementation
199 void SetFilter(SMESH::Filter_ptr theFilter) throw (SALOME::SALOME_Exception);
200 SMESH::Filter_ptr GetFilter();
201 virtual SMESH::long_array* GetListOfID();
202 virtual SMESH::long_array* GetMeshInfo();
204 // method of SMESH::NotifyerAndWaiter to update self when myFilter changes
205 virtual void OnBaseObjModified(NotifyerAndWaiter* filter, bool);
208 SMESH::Filter_var myFilter;