1 // Copyright (C) 2007-2019 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 OBJECT : interactive object for SMESH visualization
24 // File : SMESH_Object.h
25 // Author : Nicolas REJNERI
28 #ifndef SMESH_OBJECTDEF_H
29 #define SMESH_OBJECTDEF_H
31 #include "SMESH_Controls.hxx"
32 #include "SMESH_Object.h"
33 #include "SMESH_Client.hxx"
34 #include "SMESH_Actor.h"
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(SMESH_Mesh)
39 #include CORBA_SERVER_HEADER(SMESH_Group)
45 class SALOME_ExtractUnstructuredGrid;
48 class SMDS_MeshElement;
51 Class : SMESH_VisualObj
52 Description : Base class for all mesh objects to be visuilised
54 class SMESHOBJECT_EXPORT SMESH_VisualObjDef: public SMESH_VisualObj
57 typedef std::list<const SMDS_MeshElement*> TEntityList;
58 typedef std::map<vtkIdType,vtkIdType> TMapOfIds;
61 virtual ~SMESH_VisualObjDef();
63 virtual bool Update( int theIsClear = true ) = 0;
64 virtual bool NulData() {return 0; };
65 virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0;
66 virtual int GetElemDimension( const int theObjId ) = 0;
68 virtual int GetNbEntities( const SMDSAbs_ElementType theType) const = 0;
69 virtual int GetEntities( const SMDSAbs_ElementType, TEntityList& ) const = 0;
70 virtual bool IsNodePrs() const = 0;
71 virtual SMDS_Mesh* GetMesh() const = 0;
72 virtual SMESH::SMESH_Mesh_ptr GetMeshServer() = 0;
74 virtual bool IsValid() const;
76 virtual bool GetEdgeNodes( const int theElemId,
79 int& theNodeId2 ) const;
81 virtual vtkUnstructuredGrid* GetUnstructuredGrid();
83 virtual vtkIdType GetNodeObjId( int theVTKID );
84 virtual vtkIdType GetNodeVTKId( int theObjID );
85 virtual vtkIdType GetElemObjId( int theVTKID );
86 virtual vtkIdType GetElemVTKId( int theObjID );
88 virtual void ClearEntitiesFlags();
89 virtual bool GetEntitiesFlag();
90 virtual unsigned int GetEntitiesState();
94 void createPoints( vtkPoints* );
95 void buildPrs(bool buildGrid = false);
98 void updateEntitiesFlags();
101 TMapOfIds mySMDS2VTKNodes;
102 TMapOfIds myVTK2SMDSNodes;
103 TMapOfIds mySMDS2VTKElems;
104 TMapOfIds myVTK2SMDSElems;
108 unsigned int myEntitiesState;
110 vtkUnstructuredGrid* myGrid;
111 std::map<SMDSAbs_ElementType,int> myEntitiesCache;
116 Class : SMESH_MeshObj
117 Description : Class for visualisation of mesh
120 class SMESHOBJECT_EXPORT SMESH_MeshObj: public SMESH_VisualObjDef
124 SMESH_MeshObj( SMESH::SMESH_Mesh_ptr );
125 virtual ~SMESH_MeshObj();
127 virtual bool Update( int theIsClear = true );
128 virtual bool NulData();
130 virtual int GetNbEntities( const SMDSAbs_ElementType) const;
131 virtual int GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
132 virtual bool IsNodePrs() const;
134 virtual int GetElemDimension( const int theObjId );
136 virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
138 virtual SMESH::SMESH_Mesh_ptr GetMeshServer() { return myClient.GetMeshServer(); }
139 virtual SMDS_Mesh* GetMesh() const { return myClient.GetMesh(); }
143 SMESH_Client myClient;
144 vtkUnstructuredGrid* myEmptyGrid;
149 Class : SMESH_SubMeshObj
150 Description : Base class for visualisation of submeshes and groups
153 class SMESHOBJECT_EXPORT SMESH_SubMeshObj: public SMESH_VisualObjDef
157 SMESH_SubMeshObj(SMESH_MeshObj* theMeshObj);
158 virtual ~SMESH_SubMeshObj();
160 virtual bool Update( int theIsClear = true );
162 virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
163 virtual int GetElemDimension( const int theObjId );
164 virtual SMDS_Mesh* GetMesh() const { return myMeshObj->GetMesh(); }
165 virtual SMESH::SMESH_Mesh_ptr GetMeshServer() { return myMeshObj->GetMeshServer(); }
169 SMESH_MeshObj* myMeshObj;
174 Class : SMESH_GroupObj
175 Description : Class for visualisation of groups
178 class SMESHOBJECT_EXPORT SMESH_GroupObj: public SMESH_SubMeshObj
181 SMESH_GroupObj( SMESH::SMESH_GroupBase_ptr, SMESH_MeshObj* );
182 virtual ~SMESH_GroupObj();
184 virtual int GetNbEntities( const SMDSAbs_ElementType) const;
185 virtual int GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
186 virtual bool IsNodePrs() const;
188 virtual SMDSAbs_ElementType GetElementType() const;
192 SMESH::SMESH_GroupBase_var myGroupServer;
197 Class : SMESH_subMeshObj
198 Description : Class for visualisation of submeshes
201 class SMESHOBJECT_EXPORT SMESH_subMeshObj : public SMESH_SubMeshObj
205 SMESH_subMeshObj( SMESH::SMESH_subMesh_ptr,
207 virtual ~SMESH_subMeshObj();
209 virtual int GetNbEntities( const SMDSAbs_ElementType) const;
210 virtual int GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
211 virtual bool IsNodePrs() const;
215 SMESH::SMESH_subMesh_var mySubMeshServer;