Salome HOME
Update copyright
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_VTKUtils.h
1 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, 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.
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 SMESHGUI : GUI for SMESH component
24 // File   : SMESHGUI_VTKUtils.h
25 // Author : Open CASCADE S.A.S.
26 //
27 #ifndef SMESHGUI_VTKUTILS_H
28 #define SMESHGUI_VTKUTILS_H
29
30 // SMESH includes
31 #include "SMESH_SMESHGUI.hxx"
32
33 #include "SMESHGUI_Utils.h"
34 #include <SMESH_Object.h>
35
36 // SALOME KERNEL includes
37 #include <SALOMEDSClient_definitions.hxx>
38
39 // SALOME GUI includes
40 #include <SALOME_InteractiveObject.hxx>
41 #include <VTKViewer_Filter.h>
42
43 class TColStd_IndexedMapOfInteger;
44
45 class SALOMEDSClient_Study;
46
47 class SUIT_ViewWindow;
48 class SUIT_ViewManager;
49
50 class SVTK_ViewWindow;
51 class SVTK_Selector;
52
53 class LightApp_SelectionMgr;
54 class SalomeApp_Module;
55
56 class SMESHGUI;
57 class SMESH_Actor;
58 class SALOME_Actor;
59
60 class vtkActor;
61
62 namespace SMESH
63 {
64   //----------------------------------------------------------------------------
65   typedef std::pair<int,std::string> TKeyOfVisualObj;
66   
67 SMESHGUI_EXPORT
68   TVisualObjPtr GetVisualObj( int, const char*, bool nulData =false );
69 SMESHGUI_EXPORT
70   void OnVisuException(); // PAL16631
71
72   //----------------------------------------------------------------------------
73 SMESHGUI_EXPORT
74   SVTK_ViewWindow* GetViewWindow( const SalomeApp_Module* = 0,
75                                   bool = false );
76 SMESHGUI_EXPORT
77   SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager*, SUIT_ViewWindow* );
78 SMESHGUI_EXPORT
79   SVTK_ViewWindow* GetVtkViewWindow( SUIT_ViewWindow* );
80
81 SMESHGUI_EXPORT
82   SVTK_ViewWindow* GetCurrentVtkView();
83
84   //----------------------------------------------------------------------------
85 SMESHGUI_EXPORT
86   void RepaintCurrentView();
87 SMESHGUI_EXPORT
88   void RepaintViewWindow( SVTK_ViewWindow* );
89 SMESHGUI_EXPORT
90   void RenderViewWindow( SVTK_ViewWindow* );
91 SMESHGUI_EXPORT
92   void FitAll();
93
94   //----------------------------------------------------------------------------
95 SMESHGUI_EXPORT
96   SMESH_Actor* FindActorByEntry( SUIT_ViewWindow*, const char* );
97 SMESHGUI_EXPORT
98   SMESH_Actor* FindActorByEntry( const char* );
99
100 SMESHGUI_EXPORT
101   SMESH_Actor* FindActorByObject( CORBA::Object_ptr );
102
103   //----------------------------------------------------------------------------
104 SMESHGUI_EXPORT  
105   SMESH_Actor* CreateActor( _PTR(Study), const char*, int = false );
106 SMESHGUI_EXPORT
107   void DisplayActor( SUIT_ViewWindow*, SMESH_Actor* );
108 SMESHGUI_EXPORT
109   void RemoveActor( SUIT_ViewWindow*, SMESH_Actor* );
110 SMESHGUI_EXPORT
111   void RemoveVisuData( int );
112
113   //----------------------------------------------------------------------------
114   enum EDisplaing { eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll };
115
116 SMESHGUI_EXPORT
117   bool UpdateView( SUIT_ViewWindow*, EDisplaing, const char* = "" );
118 SMESHGUI_EXPORT            
119   bool UpdateView( EDisplaing, const char* = "" );
120
121 SMESHGUI_EXPORT
122   void UpdateView();
123
124 SMESHGUI_EXPORT
125   bool UpdateNulData( const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay);
126
127 SMESHGUI_EXPORT
128   bool Update( const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay);
129
130   //----------------------------------------------------------------------------
131 SMESHGUI_EXPORT  
132   void SetPointRepresentation( bool );
133
134 SMESHGUI_EXPORT
135   void SetPickable( SMESH_Actor* = 0 );
136
137 SMESHGUI_EXPORT
138   void UpdateSelectionProp( SMESHGUI* );
139
140   //----------------------------------------------------------------------------
141 SMESHGUI_EXPORT
142   SVTK_Selector* GetSelector( SUIT_ViewWindow* = GetActiveWindow() );
143
144 SMESHGUI_EXPORT
145   void SetFilter( const Handle(VTKViewer_Filter)&, SVTK_Selector* = GetSelector() );
146 SMESHGUI_EXPORT
147   Handle(VTKViewer_Filter) GetFilter( int, SVTK_Selector* = GetSelector() );
148 SMESHGUI_EXPORT
149   bool IsFilterPresent( int, SVTK_Selector* = GetSelector() );
150 SMESHGUI_EXPORT
151   void RemoveFilter( int, SVTK_Selector* = GetSelector() );
152
153 SMESHGUI_EXPORT
154   void RemoveFilters( SVTK_Selector* = GetSelector());
155
156 SMESHGUI_EXPORT
157   bool IsValid( SALOME_Actor*, int, SVTK_Selector* = GetSelector() );
158
159   //----------------------------------------------------------------------------
160 SMESHGUI_EXPORT  
161   int GetNameOfSelectedNodes( SVTK_Selector*,
162                               const Handle(SALOME_InteractiveObject)&,
163                               QString& );
164 SMESHGUI_EXPORT
165   int GetNameOfSelectedElements( SVTK_Selector*,
166                                  const Handle(SALOME_InteractiveObject)&,
167                                  QString& );
168 SMESHGUI_EXPORT
169   int GetEdgeNodes( SVTK_Selector*, const TVisualObjPtr&, int&, int& );
170
171   //----------------------------------------------------------------------------
172 SMESHGUI_EXPORT  
173   int GetNameOfSelectedNodes( LightApp_SelectionMgr*,
174                               const Handle(SALOME_InteractiveObject)&,
175                               QString& );
176 SMESHGUI_EXPORT
177   int GetNameOfSelectedNodes( LightApp_SelectionMgr*, QString& );
178 SMESHGUI_EXPORT
179   int GetNameOfSelectedElements( LightApp_SelectionMgr*,
180                                  const Handle(SALOME_InteractiveObject)&,
181                                  QString& );
182 SMESHGUI_EXPORT
183   int GetNameOfSelectedElements( LightApp_SelectionMgr*, QString& );
184 SMESHGUI_EXPORT
185   int GetSelected( LightApp_SelectionMgr*, TColStd_IndexedMapOfInteger&, 
186                    const bool = true );
187
188 SMESHGUI_EXPORT
189   int GetEdgeNodes( LightApp_SelectionMgr*, int&, int& );
190
191 SMESHGUI_EXPORT
192   void SetControlsPrecision( const long );
193
194 #ifndef DISABLE_PLOT2DVIEWER
195 SMESHGUI_EXPORT
196   void ClearPlot2Viewers( SUIT_ViewWindow* theWindow );
197 #endif
198
199   //----------------------------------------------------------------------------
200 SMESHGUI_EXPORT
201   bool ComputeClippingPlaneParameters( std::list<vtkActor*> theActorList,
202                                        vtkFloatingPointType theNormal[3],
203                                        vtkFloatingPointType theDist,
204                                        vtkFloatingPointType theBounds[6],
205                                        vtkFloatingPointType theOrigin[3] );
206  SMESHGUI_EXPORT
207    void RemoveVisualObjectWithActors( const char* theEntry, bool fromAllViews = false );
208 };
209
210 #endif // SMESHGUI_VTKUTILS_H