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