Salome HOME
Merge with version on tag OCC-V2_1_0d
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_VTKUtils.h
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
4 //  This library is free software; you can redistribute it and/or 
5 //  modify it under the terms of the GNU Lesser General Public 
6 //  License as published by the Free Software Foundation; either 
7 //  version 2.1 of the License. 
8 // 
9 //  This library is distributed in the hope that it will be useful, 
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 //  Lesser General Public License for more details. 
13 // 
14 //  You should have received a copy of the GNU Lesser General Public 
15 //  License along with this library; if not, write to the Free Software 
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17 // 
18 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
19
20 #ifndef SMESHGUI_VTKUtils_HeaderFile
21 #define SMESHGUI_VTKUtils_HeaderFile
22
23 class QString;
24 class vtkRenderer;  
25 class TColStd_IndexedMapOfInteger;
26
27 #include "SALOME_InteractiveObject.hxx"
28 #include "VTKViewer_Filter.h"
29
30 class QAD_Study;
31 class QAD_StudyFrame;
32 class SALOME_Selection;
33 class VTKViewer_ViewFrame;
34 class VTKViewer_InteractorStyleSALOME;
35
36 #include <CORBA.h>
37
38 #include "SALOMEconfig.h"
39 #include CORBA_CLIENT_HEADER(SALOMEDS)
40
41 #include <boost/shared_ptr.hpp>
42 #include "SMESH_Object.h"
43
44 class SALOME_Actor;
45 class SMESH_Actor;
46
47 namespace SMESH{
48
49   //----------------------------------------------------------------------------
50   typedef pair<int,string> TKeyOfVisualObj;
51   
52   TVisualObjPtr GetVisualObj(int theStudyId, 
53                              const char* theEntry);
54
55
56   //----------------------------------------------------------------------------
57   QAD_StudyFrame* GetActiveStudyFrame();
58
59   VTKViewer_ViewFrame* FindVtkViewFrame(QAD_Study* theStudy,
60                                         QAD_StudyFrame* theStudyFrame);
61
62   VTKViewer_ViewFrame* GetVtkViewFrame(QAD_StudyFrame* theStudyFrame);
63
64   VTKViewer_ViewFrame* GetCurrentVtkView();
65
66
67   //----------------------------------------------------------------------------
68   SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame, 
69                                 const char* theEntry);
70   SMESH_Actor* FindActorByEntry(const char* theEntry);
71
72   SMESH_Actor* FindActorByObject(CORBA::Object_ptr theObject);
73
74
75   //----------------------------------------------------------------------------
76   SMESH_Actor* CreateActor(SALOMEDS::Study_ptr theStudy,
77                            const char* theEntry,
78                            int theIsClear = false);
79
80   void DisplayActor(QAD_StudyFrame *theStudyFrame, 
81                     SMESH_Actor* theActor);
82   void RemoveActor(QAD_StudyFrame *theStudyFrame, 
83                    SMESH_Actor* theActor);
84
85
86   //----------------------------------------------------------------------------
87   enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
88   void UpdateView(QAD_StudyFrame *theStudyFrame, 
89                   EDisplaing theAction, 
90                   const char* theEntry = "");
91   void UpdateView(EDisplaing theAction, 
92                   const char* theEntry = "");
93
94   void UpdateView();
95
96   void Update(const Handle(SALOME_InteractiveObject)& theIO,
97               bool theDisplay);
98
99
100   //----------------------------------------------------------------------------
101   void FitAll();
102
103   void RepaintCurrentView();
104
105   vtkRenderer* GetCurrentRenderer();
106
107
108   //----------------------------------------------------------------------------
109   void SetPointRepresentation(bool theIsVisible);
110
111   void SetPickable(SMESH_Actor* theActor = NULL);
112
113   void UpdateSelectionProp();
114
115
116   //----------------------------------------------------------------------------
117   VTKViewer_InteractorStyleSALOME* 
118     GetInteractorStyle(QAD_StudyFrame *theStudyFrame = GetActiveStudyFrame());
119
120   void SetFilter(const Handle(VTKViewer_Filter)& theFilter,
121                  VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
122
123   Handle(VTKViewer_Filter) 
124     GetFilter(int theId, VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
125
126   bool IsFilterPresent(int theId, 
127                        VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
128
129   void RemoveFilter(int theId, 
130                     VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
131
132   bool IsValid(SALOME_Actor* theActor, int theCellId,
133                VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
134
135   //----------------------------------------------------------------------------
136   int GetNameOfSelectedNodes(SALOME_Selection *theSel, 
137                              const Handle(SALOME_InteractiveObject)& theIO, 
138                              QString& theName);
139
140   int GetNameOfSelectedNodes(SALOME_Selection *theSel, 
141                              QString& aName);
142
143   int GetNameOfSelectedElements(SALOME_Selection *theSel, 
144                                 const Handle(SALOME_InteractiveObject)& theIO, 
145                                 QString& theName);
146
147   int GetNameOfSelectedElements(SALOME_Selection *theSel, 
148                                 QString& aName);
149
150   int GetSelected(SALOME_Selection* theSel, 
151                   TColStd_IndexedMapOfInteger& theMap, 
152                   const bool theIsElement = true );
153
154   int GetEdgeNodes(SALOME_Selection* theSel, int& theId1, int& theId2);
155
156   void SetControlsPrecision( const long theVal );
157
158 };
159
160
161 #endif
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189