Salome HOME
Merging with WPdev
[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.salome-platform.org/ or email : webmaster.salome@opencascade.com
19
20 #ifndef SMESHGUI_VTKUtils_HeaderFile
21 #define SMESHGUI_VTKUtils_HeaderFile
22
23 #include "SMESH_SMESHGUI.hxx"
24
25 class QString;
26 class vtkRenderer;
27 class TColStd_IndexedMapOfInteger;
28
29 #include "SALOMEDSClient_definitions.hxx"
30 #include "SALOME_InteractiveObject.hxx"
31 #include "VTKViewer_Filter.h"
32
33 class SALOMEDSClient_Study;
34
35 class SUIT_Study;
36 class SUIT_ViewWindow;
37 class SUIT_ViewManager;
38
39 class SVTK_ViewWindow;
40 class SVTK_Selector;
41
42 class LightApp_SelectionMgr;
43 class SMESHGUI;
44
45 #include <omniORB4/CORBA.h>
46
47 #include "SALOMEconfig.h"
48 #include CORBA_CLIENT_HEADER(SALOMEDS)
49
50 #include <boost/shared_ptr.hpp>
51 #include "SMESH_Object.h"
52
53 class SMESH_Actor;
54 class SALOME_Actor;
55 class SVTK_ViewWindow;
56 class SalomeApp_Module;
57
58 namespace SMESH{
59
60   //----------------------------------------------------------------------------
61   typedef pair<int,string> TKeyOfVisualObj;
62   
63 SMESHGUI_EXPORT
64   TVisualObjPtr GetVisualObj(int theStudyId, 
65                              const char* theEntry);
66
67   //----------------------------------------------------------------------------
68 SMESHGUI_EXPORT
69   SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule);
70
71 SMESHGUI_EXPORT
72   SUIT_ViewWindow* GetActiveWindow();
73
74 SMESHGUI_EXPORT
75   SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager*,
76                                       SUIT_ViewWindow* );
77
78 SMESHGUI_EXPORT
79   SVTK_ViewWindow* GetVtkViewWindow( SUIT_ViewWindow* );
80
81 SMESHGUI_EXPORT
82   SVTK_ViewWindow* GetCurrentVtkView();
83
84 SMESHGUI_EXPORT
85   void RepaintViewWindow(SVTK_ViewWindow*);
86 SMESHGUI_EXPORT
87   void RenderViewWindow(SVTK_ViewWindow*);
88
89   //----------------------------------------------------------------------------
90 SMESHGUI_EXPORT
91   SMESH_Actor* FindActorByEntry (SUIT_ViewWindow*, const char* theEntry);
92 SMESHGUI_EXPORT
93   SMESH_Actor* FindActorByEntry (const char* theEntry);
94
95 SMESHGUI_EXPORT
96   SMESH_Actor* FindActorByObject (CORBA::Object_ptr theObject);
97
98   //----------------------------------------------------------------------------
99 SMESHGUI_EXPORT  
100   SMESH_Actor* CreateActor (_PTR(Study), const char*, int = false);
101 SMESHGUI_EXPORT
102   void DisplayActor (SUIT_ViewWindow*, SMESH_Actor* theActor);
103 SMESHGUI_EXPORT
104   void RemoveActor  (SUIT_ViewWindow*, SMESH_Actor* theActor);
105
106   //----------------------------------------------------------------------------
107   enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
108 SMESHGUI_EXPORT
109   void UpdateView (SUIT_ViewWindow*, 
110                    EDisplaing theAction, 
111                    const char* theEntry = "");
112 SMESHGUI_EXPORT
113   void UpdateView (EDisplaing theAction, 
114                    const char* theEntry = "");
115
116 SMESHGUI_EXPORT
117   void UpdateView();
118
119 SMESHGUI_EXPORT
120   void Update(const Handle(SALOME_InteractiveObject)& theIO,
121               bool theDisplay);
122
123
124   //----------------------------------------------------------------------------
125 SMESHGUI_EXPORT
126   void FitAll();
127
128 SMESHGUI_EXPORT
129   void RepaintCurrentView();
130
131 SMESHGUI_EXPORT
132   vtkRenderer* GetCurrentRenderer();
133
134
135   //----------------------------------------------------------------------------
136 SMESHGUI_EXPORT
137   void SetPointRepresentation(bool theIsVisible);
138
139 SMESHGUI_EXPORT
140   void SetPickable(SMESH_Actor* theActor = NULL);
141
142 SMESHGUI_EXPORT
143   void UpdateSelectionProp( SMESHGUI* );
144
145
146   //----------------------------------------------------------------------------
147 SMESHGUI_EXPORT
148   SVTK_Selector* 
149     GetSelector(SUIT_ViewWindow* = GetActiveWindow());
150
151 SMESHGUI_EXPORT
152   void SetFilter (const Handle(VTKViewer_Filter)& theFilter,
153                   SVTK_Selector* theSelector = GetSelector());
154
155 SMESHGUI_EXPORT
156   Handle(VTKViewer_Filter) 
157     GetFilter (int theId, SVTK_Selector* theSelector = GetSelector());
158
159 SMESHGUI_EXPORT
160   bool IsFilterPresent (int theId, 
161                         SVTK_Selector* theSelector = GetSelector());
162
163 SMESHGUI_EXPORT
164   void RemoveFilter (int theId, 
165                      SVTK_Selector* theSelector = GetSelector());
166
167 SMESHGUI_EXPORT
168   void RemoveFilters (SVTK_Selector* theSelector = GetSelector());
169
170 SMESHGUI_EXPORT
171   bool IsValid (SALOME_Actor* theActor, int theCellId,
172                 SVTK_Selector* theSelector = GetSelector());
173
174   //----------------------------------------------------------------------------
175 SMESHGUI_EXPORT
176   int GetNameOfSelectedNodes(SVTK_Selector* theSelector, 
177                              const Handle(SALOME_InteractiveObject)& theIO, 
178                              QString& theName);
179   
180 SMESHGUI_EXPORT
181   int GetNameOfSelectedElements(SVTK_Selector* theSelector, 
182                                 const Handle(SALOME_InteractiveObject)& theIO, 
183                                 QString& theName);
184   
185 SMESHGUI_EXPORT
186   int GetEdgeNodes(SVTK_Selector* theSelector, 
187                    const TVisualObjPtr& theVisualObj,
188                    int& theId1, 
189                    int& theId2);
190
191   //----------------------------------------------------------------------------
192 SMESHGUI_EXPORT
193   int GetNameOfSelectedNodes (LightApp_SelectionMgr*, 
194                               const Handle(SALOME_InteractiveObject)& theIO, 
195                               QString& theName);
196
197 SMESHGUI_EXPORT
198   int GetNameOfSelectedNodes (LightApp_SelectionMgr*, 
199                               QString& aName);
200
201 SMESHGUI_EXPORT
202   int GetNameOfSelectedElements (LightApp_SelectionMgr*, 
203                                  const Handle(SALOME_InteractiveObject)& theIO, 
204                                  QString& theName);
205
206 SMESHGUI_EXPORT
207   int GetNameOfSelectedElements (LightApp_SelectionMgr*, 
208                                  QString& aName);
209
210 SMESHGUI_EXPORT
211   int GetSelected (LightApp_SelectionMgr*, 
212                    TColStd_IndexedMapOfInteger& theMap, 
213                    const bool theIsElement = true );
214
215 SMESHGUI_EXPORT
216   int GetEdgeNodes (LightApp_SelectionMgr*, int& theId1, int& theId2);
217
218 SMESHGUI_EXPORT
219   void SetControlsPrecision (const long theVal);
220 };
221
222 #endif