Version: 9.12.0
SMESH_Group_i.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, 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, or (at your option) any later version.
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 
23 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
24 // File : SMESH_Group_i.hxx
25 // Author : Sergey ANIKIN, OCC
26 // Module : SMESH
27 //
28 #ifndef SMESH_Group_i_HeaderFile
29 #define SMESH_Group_i_HeaderFile
30 
31 #include "SMESH.hxx"
32 #include "SMESH_Mesh_i.hxx"
33 #include "SMESH_Filter_i.hxx"
34 
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)
39 
40 #include "SALOME_GenericObj_i.hh"
41 
42 class SMESH_Group;
43 class SMESHDS_GroupBase;
44 class SMESH_PreMeshInfo;
45 
46 // ===========
47 // Group Base
48 // ===========
50  public virtual POA_SMESH::SMESH_GroupBase,
51  public virtual SALOME::GenericObj_i,
52  public SMESH::NotifyerAndWaiter // defined in SMESH_Filter_i.hxx
53 {
54  public:
55  SMESH_GroupBase_i(PortableServer::POA_ptr thePOA,
56  SMESH_Mesh_i* theMeshServant,
57  const int theLocalID );
58  virtual ~SMESH_GroupBase_i();
59 
60  // CORBA interface implementation
61  void SetName(const char* name);
62  char* GetName();
63  SMESH::ElementType GetType();
64  SMESH::smIdType Size();
65  CORBA::Boolean IsEmpty();
66  CORBA::Boolean Contains(SMESH::smIdType elem_id);
67  SMESH::smIdType GetID(SMESH::smIdType elem_index);
68  SMESH::smIdType_array* GetListOfID();
69  SMESH::smIdType_array* GetNodeIDs();
70  SMESH::smIdType GetNumberOfNodes();
71  CORBA::Boolean IsNodeInfoAvailable(); // for gui
72 
73  virtual SMESH::SMESH_Mesh_ptr GetMesh();
74 
80  virtual SMESH::smIdType_array* GetMeshInfo();
84  virtual SMESH::smIdType_array* GetNbElementsByType();
88  virtual SMESH::smIdType_array* GetIDs();
93  virtual SMESH::array_of_ElementType* GetTypes();
98  virtual bool IsMeshInfoCorrect();
102  virtual SALOMEDS::TMPFile* GetVtkUgStream();
103 
108  virtual CORBA::Boolean IsInDependency( SMESH::SMESH_GroupBase_ptr other );
109 
110 
111  // Internal C++ interface
112  int GetLocalID() const { return myLocalID; } // return group persistent ID
113  SMESH_Mesh_i* GetMeshServant() const { return myMeshServant; }
114  SMESH_Group* GetSmeshGroup() const;
115  SMESHDS_GroupBase* GetGroupDS() const;
116 
117  void SetColor(const SALOMEDS::Color& color);
118  SALOMEDS::Color GetColor();
119 
120  void SetColorNumber(CORBA::Long color);
121  CORBA::Long GetColorNumber();
122 
123 protected:
124 
125  SMESH_PreMeshInfo* & changePreMeshInfo() { return myPreMeshInfo; }
126  SMESH_PreMeshInfo* myPreMeshInfo; // mesh info before full loading from study file
127  friend class SMESH_PreMeshInfo;
128 
130 
131 private:
134 
135  void changeLocalId(int localId) { myLocalID = localId; }
136  friend class SMESH_Mesh_i;
137 };
138 
139 // ======
140 // Group
141 // ======
142 
144  public virtual POA_SMESH::SMESH_Group,
145  public SMESH_GroupBase_i
146 {
147  public:
148  SMESH_Group_i( PortableServer::POA_ptr thePOA,
149  SMESH_Mesh_i* theMeshServant,
150  const int theLocalID );
151  // CORBA interface implementation
152  void Clear();
153  SMESH::smIdType Add( const SMESH::smIdType_array& theIDs );
154  SMESH::smIdType Remove( const SMESH::smIdType_array& theIDs );
155 
156  SMESH::smIdType AddByPredicate( SMESH::Predicate_ptr thePredicate );
157  SMESH::smIdType RemoveByPredicate( SMESH::Predicate_ptr thePredicate );
158 
159  SMESH::smIdType AddFrom( SMESH::SMESH_IDSource_ptr theSource );
160 };
161 
162 // =========================
163 // Group linked to geometry
164 // =========================
165 
167  public virtual POA_SMESH::SMESH_GroupOnGeom,
168  public SMESH_GroupBase_i
169 {
170  public:
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();
176 };
177 
178 // =========================
179 // Group denied by filter
180 // =========================
181 
183  public virtual POA_SMESH::SMESH_GroupOnFilter,
184  public SMESH_GroupBase_i
185 {
186  public:
187  SMESH_GroupOnFilter_i( PortableServer::POA_ptr thePOA,
188  SMESH_Mesh_i* theMeshServant,
189  const int theLocalID );
191 
192  // Persistence
193  static SMESH::Filter_ptr StringToFilter(const std::string& thePersistentString );
194  std::string FilterToString() const;
195 
196  static SMESH_PredicatePtr GetPredicate( SMESH::Filter_ptr );
197 
198  // CORBA interface implementation
199  void SetFilter(SMESH::Filter_ptr theFilter);
200  SMESH::Filter_ptr GetFilter();
201  virtual CORBA::Boolean IsUpToDate();
202  virtual SMESH::smIdType_array* GetListOfID();
203  virtual SMESH::smIdType_array* GetMeshInfo();
206  virtual bool IsMeshInfoCorrect();
207 
208  // method of SMESH::NotifyerAndWaiter to update self when myFilter changes
209  virtual void OnBaseObjModified(NotifyerAndWaiter* filter, bool);
210 
211  private:
212  SMESH::Filter_var myFilter;
213 };
214 #endif
#define SMESH_I_EXPORT
Definition: SMESH.hxx:39
SMESH::Controls::PredicatePtr SMESH_PredicatePtr
Definition: SMESH_Controls.hxx:81
smIdType myNbNodes
Definition: SMDS_MeshInfo.hxx:89
Definition: SMESHDS_GroupBase.hxx:42
Definition: SMESH_Group_i.hxx:53
SMESH_PreMeshInfo * myPreMeshInfo
Definition: SMESH_Group_i.hxx:126
SMESH_Mesh_i * myMeshServant
Definition: SMESH_Group_i.hxx:132
int myGroupDSTic
Definition: SMESH_Group_i.hxx:129
int myLocalID
Definition: SMESH_Group_i.hxx:133
SMESH_Mesh_i * GetMeshServant() const
Definition: SMESH_Group_i.hxx:113
void changeLocalId(int localId)
Definition: SMESH_Group_i.hxx:135
SMESH_PreMeshInfo *& changePreMeshInfo()
Definition: SMESH_Group_i.hxx:125
int GetLocalID() const
Definition: SMESH_Group_i.hxx:112
Definition: SMESH_Group_i.hxx:185
SMESH::Filter_var myFilter
Definition: SMESH_Group_i.hxx:212
Definition: SMESH_Group_i.hxx:169
Definition: SMESH_Group_i.hxx:146
Definition: SMESH_Group.hxx:43
Definition: SMESH_Mesh_i.hxx:57
Class loading and holding information of a mesh object (mesh, group, submesh) not yet loaded from HDF...
Definition: SMESH_PreMeshInfo.hxx:54
ENUM Add(ENUM v, int delta)
Return incremented enum value.
Definition: SMESH_TypeDefs.hxx:137
QString GetName(const Handle(SALOME_InteractiveObject)&theIO)
Definition: SMESHGUI_Utils.cxx:252
QColor GetColor(const QString &theSect, const QString &theName, const QColor &def)
Definition: SMESH_ActorUtils.cxx:97
Predicate_i * GetPredicate(Predicate_ptr thePredicate)
Definition: SMESH_Filter_i.cxx:70
sequence< ElementType > array_of_ElementType
Definition: SMESH_Mesh.idl:138
void SetFilter(const Handle(VTKViewer_Filter)&theFilter, SVTK_Selector *theSelector)
Definition: SMESHGUI_VTKUtils.cxx:1115
sequence< smIdType > smIdType_array
Definition: SMESH_Mesh.idl:45
ElementType
Enumeration for element type, like in SMDS.
Definition: SMESH_Mesh.idl:128
void SetName(_PTR(SObject) theSObject, const QString &theName)
Definition: SMESHGUI_Utils.cxx:134
Object notified on change of base objects and notifying dependent objects in its turn.
Definition: SMESH_Filter_i.hxx:57
virtual void OnBaseObjModified(NotifyerAndWaiter *, bool)
Definition: SMESH_Filter_i.hxx:58