Salome HOME
PR: merged from V5_1_4rc1
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_VTKUtils.h
1 //  Copyright (C) 2007-2010  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 namespace SMESH
61 {
62   //----------------------------------------------------------------------------
63   typedef std::pair<int,std::string> TKeyOfVisualObj;
64   
65 SMESHGUI_EXPORT
66   TVisualObjPtr GetVisualObj( int, const char*, bool nulData =false );
67 SMESHGUI_EXPORT
68   void OnVisuException(); // PAL16631
69
70   //----------------------------------------------------------------------------
71 SMESHGUI_EXPORT
72   SVTK_ViewWindow* GetViewWindow( const SalomeApp_Module* = 0,
73                                   bool = false );
74 SMESHGUI_EXPORT
75   SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager*, SUIT_ViewWindow* );
76 SMESHGUI_EXPORT
77   SVTK_ViewWindow* GetVtkViewWindow( SUIT_ViewWindow* );
78
79 SMESHGUI_EXPORT
80   SVTK_ViewWindow* GetCurrentVtkView();
81
82   //----------------------------------------------------------------------------
83 SMESHGUI_EXPORT
84   void RepaintCurrentView();
85 SMESHGUI_EXPORT
86   void RepaintViewWindow( SVTK_ViewWindow* );
87 SMESHGUI_EXPORT
88   void RenderViewWindow( SVTK_ViewWindow* );
89 SMESHGUI_EXPORT
90   void FitAll();
91
92   //----------------------------------------------------------------------------
93 SMESHGUI_EXPORT
94   SMESH_Actor* FindActorByEntry( SUIT_ViewWindow*, const char* );
95 SMESHGUI_EXPORT
96   SMESH_Actor* FindActorByEntry( const char* );
97
98 SMESHGUI_EXPORT
99   SMESH_Actor* FindActorByObject( CORBA::Object_ptr );
100
101   //----------------------------------------------------------------------------
102 SMESHGUI_EXPORT  
103   SMESH_Actor* CreateActor( _PTR(Study), const char*, int = false );
104 SMESHGUI_EXPORT
105   void DisplayActor( SUIT_ViewWindow*, SMESH_Actor* );
106 SMESHGUI_EXPORT
107   void RemoveActor( SUIT_ViewWindow*, SMESH_Actor* );
108 SMESHGUI_EXPORT
109   void RemoveVisuData( int );
110
111   //----------------------------------------------------------------------------
112   enum EDisplaing { eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll };
113
114 SMESHGUI_EXPORT
115   bool UpdateView( SUIT_ViewWindow*, EDisplaing, const char* = "" );
116 SMESHGUI_EXPORT            
117   bool UpdateView( EDisplaing, const char* = "" );
118
119 SMESHGUI_EXPORT
120   void UpdateView();
121
122 SMESHGUI_EXPORT
123   bool UpdateNulData( const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay);
124
125 SMESHGUI_EXPORT
126   bool Update( const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay);
127
128   //----------------------------------------------------------------------------
129 SMESHGUI_EXPORT  
130   void SetPointRepresentation( bool );
131
132 SMESHGUI_EXPORT
133   void SetPickable( SMESH_Actor* = 0 );
134
135 SMESHGUI_EXPORT
136   void UpdateSelectionProp( SMESHGUI* );
137
138   //----------------------------------------------------------------------------
139 SMESHGUI_EXPORT
140   SVTK_Selector* GetSelector( SUIT_ViewWindow* = GetActiveWindow() );
141
142 SMESHGUI_EXPORT
143   void SetFilter( const Handle(VTKViewer_Filter)&, SVTK_Selector* = GetSelector() );
144 SMESHGUI_EXPORT
145   Handle(VTKViewer_Filter) GetFilter( int, SVTK_Selector* = GetSelector() );
146 SMESHGUI_EXPORT
147   bool IsFilterPresent( int, SVTK_Selector* = GetSelector() );
148 SMESHGUI_EXPORT
149   void RemoveFilter( int, SVTK_Selector* = GetSelector() );
150
151 SMESHGUI_EXPORT
152   void RemoveFilters( SVTK_Selector* = GetSelector());
153
154 SMESHGUI_EXPORT
155   bool IsValid( SALOME_Actor*, int, SVTK_Selector* = GetSelector() );
156
157   //----------------------------------------------------------------------------
158 SMESHGUI_EXPORT  
159   int GetNameOfSelectedNodes( SVTK_Selector*,
160                               const Handle(SALOME_InteractiveObject)&,
161                               QString& );
162 SMESHGUI_EXPORT
163   int GetNameOfSelectedElements( SVTK_Selector*,
164                                  const Handle(SALOME_InteractiveObject)&,
165                                  QString& );
166 SMESHGUI_EXPORT
167   int GetEdgeNodes( SVTK_Selector*, const TVisualObjPtr&, int&, int& );
168
169   //----------------------------------------------------------------------------
170 SMESHGUI_EXPORT  
171   int GetNameOfSelectedNodes( LightApp_SelectionMgr*,
172                               const Handle(SALOME_InteractiveObject)&,
173                               QString& );
174 SMESHGUI_EXPORT
175   int GetNameOfSelectedNodes( LightApp_SelectionMgr*, QString& );
176 SMESHGUI_EXPORT
177   int GetNameOfSelectedElements( LightApp_SelectionMgr*,
178                                  const Handle(SALOME_InteractiveObject)&,
179                                  QString& );
180 SMESHGUI_EXPORT
181   int GetNameOfSelectedElements( LightApp_SelectionMgr*, QString& );
182 SMESHGUI_EXPORT
183   int GetSelected( LightApp_SelectionMgr*, TColStd_IndexedMapOfInteger&, 
184                    const bool = true );
185
186 SMESHGUI_EXPORT
187   int GetEdgeNodes( LightApp_SelectionMgr*, int&, int& );
188
189 SMESHGUI_EXPORT
190   void SetControlsPrecision( const long );
191 };
192
193 #endif // SMESHGUI_VTKUTILS_H