]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESHGUI/SMESHGUI_VTKUtils.h
Salome HOME
Implementation of the Point 2 of the 20948: EDF 1468 SMESH: Histogram of the quality...
[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 #ifndef DISABLE_PLOT2DVIEWER
44 class SPlot2d_Histogram;
45 #endif
46
47
48 class TColStd_IndexedMapOfInteger;
49
50 class SALOMEDSClient_Study;
51
52 class SUIT_ViewWindow;
53 class SUIT_ViewManager;
54
55 class SVTK_ViewWindow;
56 class SVTK_Selector;
57
58 class LightApp_SelectionMgr;
59 class SalomeApp_Module;
60
61 class SMESHGUI;
62 class SMESH_Actor;
63 class SALOME_Actor;
64
65 class vtkActor;
66
67 namespace SMESH
68 {
69   //----------------------------------------------------------------------------
70   typedef std::pair<int,std::string> TKeyOfVisualObj;
71   
72 SMESHGUI_EXPORT
73   TVisualObjPtr GetVisualObj( int, const char*, bool nulData =false );
74 SMESHGUI_EXPORT
75   void OnVisuException(); // PAL16631
76
77   //----------------------------------------------------------------------------
78 SMESHGUI_EXPORT
79   SVTK_ViewWindow* GetViewWindow( const SalomeApp_Module* = 0,
80                                   bool = false );
81 SMESHGUI_EXPORT
82   SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager*, SUIT_ViewWindow* );
83 SMESHGUI_EXPORT
84   SVTK_ViewWindow* GetVtkViewWindow( SUIT_ViewWindow* );
85
86 SMESHGUI_EXPORT
87   SVTK_ViewWindow* GetCurrentVtkView();
88
89   //----------------------------------------------------------------------------
90 SMESHGUI_EXPORT
91   void RepaintCurrentView();
92 SMESHGUI_EXPORT
93   void RepaintViewWindow( SVTK_ViewWindow* );
94 SMESHGUI_EXPORT
95   void RenderViewWindow( SVTK_ViewWindow* );
96 SMESHGUI_EXPORT
97   void FitAll();
98
99   //----------------------------------------------------------------------------
100 SMESHGUI_EXPORT
101   SMESH_Actor* FindActorByEntry( SUIT_ViewWindow*, const char* );
102 SMESHGUI_EXPORT
103   SMESH_Actor* FindActorByEntry( const char* );
104
105 SMESHGUI_EXPORT
106   SMESH_Actor* FindActorByObject( CORBA::Object_ptr );
107
108   //----------------------------------------------------------------------------
109 SMESHGUI_EXPORT  
110   SMESH_Actor* CreateActor( _PTR(Study), const char*, int = false );
111 SMESHGUI_EXPORT
112   void DisplayActor( SUIT_ViewWindow*, SMESH_Actor* );
113 SMESHGUI_EXPORT
114   void RemoveActor( SUIT_ViewWindow*, SMESH_Actor* );
115 SMESHGUI_EXPORT
116   void RemoveVisuData( int );
117
118   //----------------------------------------------------------------------------
119   enum EDisplaing { eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll };
120
121 SMESHGUI_EXPORT
122   bool UpdateView( SUIT_ViewWindow*, EDisplaing, const char* = "" );
123 SMESHGUI_EXPORT            
124   bool UpdateView( EDisplaing, const char* = "" );
125
126 SMESHGUI_EXPORT
127   void UpdateView();
128
129 SMESHGUI_EXPORT
130   bool UpdateNulData( const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay);
131
132 SMESHGUI_EXPORT
133   bool Update( const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay);
134
135   //----------------------------------------------------------------------------
136 SMESHGUI_EXPORT  
137   void SetPointRepresentation( bool );
138
139 SMESHGUI_EXPORT
140   void SetPickable( SMESH_Actor* = 0 );
141
142 SMESHGUI_EXPORT
143   void UpdateSelectionProp( SMESHGUI* );
144
145   //----------------------------------------------------------------------------
146 SMESHGUI_EXPORT
147   SVTK_Selector* GetSelector( SUIT_ViewWindow* = GetActiveWindow() );
148
149 SMESHGUI_EXPORT
150   void SetFilter( const Handle(VTKViewer_Filter)&, SVTK_Selector* = GetSelector() );
151 SMESHGUI_EXPORT
152   Handle(VTKViewer_Filter) GetFilter( int, SVTK_Selector* = GetSelector() );
153 SMESHGUI_EXPORT
154   bool IsFilterPresent( int, SVTK_Selector* = GetSelector() );
155 SMESHGUI_EXPORT
156   void RemoveFilter( int, SVTK_Selector* = GetSelector() );
157
158 SMESHGUI_EXPORT
159   void RemoveFilters( SVTK_Selector* = GetSelector());
160
161 SMESHGUI_EXPORT
162   bool IsValid( SALOME_Actor*, int, SVTK_Selector* = GetSelector() );
163
164   //----------------------------------------------------------------------------
165 SMESHGUI_EXPORT  
166   int GetNameOfSelectedNodes( SVTK_Selector*,
167                               const Handle(SALOME_InteractiveObject)&,
168                               QString& );
169 SMESHGUI_EXPORT
170   int GetNameOfSelectedElements( SVTK_Selector*,
171                                  const Handle(SALOME_InteractiveObject)&,
172                                  QString& );
173 SMESHGUI_EXPORT
174   int GetEdgeNodes( SVTK_Selector*, const TVisualObjPtr&, int&, int& );
175
176   //----------------------------------------------------------------------------
177 SMESHGUI_EXPORT  
178   int GetNameOfSelectedNodes( LightApp_SelectionMgr*,
179                               const Handle(SALOME_InteractiveObject)&,
180                               QString& );
181 SMESHGUI_EXPORT
182   int GetNameOfSelectedNodes( LightApp_SelectionMgr*, QString& );
183 SMESHGUI_EXPORT
184   int GetNameOfSelectedElements( LightApp_SelectionMgr*,
185                                  const Handle(SALOME_InteractiveObject)&,
186                                  QString& );
187 SMESHGUI_EXPORT
188   int GetNameOfSelectedElements( LightApp_SelectionMgr*, QString& );
189 SMESHGUI_EXPORT
190   int GetSelected( LightApp_SelectionMgr*, TColStd_IndexedMapOfInteger&, 
191                    const bool = true );
192
193 SMESHGUI_EXPORT
194   int GetEdgeNodes( LightApp_SelectionMgr*, int&, int& );
195
196 SMESHGUI_EXPORT
197   void SetControlsPrecision( const long );
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
207 #ifndef DISABLE_PLOT2DVIEWER
208  
209  typedef enum {UpdateIn2dViewer = 0, RemoveFrom2dViewer } Viewer2dActionType;
210  
211  SMESHGUI_EXPORT
212    void ProcessIn2DViewers( SMESH_Actor* theActor, Viewer2dActionType = UpdateIn2dViewer );
213  
214 #endif
215
216 };
217
218 #endif // SMESHGUI_VTKUTILS_H