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