Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[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.salome-platform.org/ or email : webmaster.salome@opencascade.com
19
20 using namespace std;
21
22 #ifndef SMESHGUI_VTKUtils_HeaderFile
23 #define SMESHGUI_VTKUtils_HeaderFile
24
25 #include "SMESH_SMESHGUI.hxx"
26
27 #include "SALOMEDSClient_definitions.hxx"
28 #include "SALOME_InteractiveObject.hxx"
29 #include "VTKViewer_Filter.h"
30
31 #include "SMESH_Object.h"
32 #include "SMESHGUI_Utils.h"
33
34 #include <CORBA.h>
35
36 #include "SALOMEconfig.h"
37 #include CORBA_CLIENT_HEADER(SALOMEDS)
38
39 #include <boost/shared_ptr.hpp>
40
41 class QString;
42
43 class TColStd_IndexedMapOfInteger;
44
45 class SALOMEDSClient_Study;
46
47 class SUIT_Study;
48 class SUIT_ViewWindow;
49 class SUIT_ViewManager;
50
51 class SVTK_ViewWindow;
52 class SVTK_Selector;
53
54 class LightApp_SelectionMgr;
55 class SalomeApp_Module;
56
57 class SMESHGUI;
58 class SMESH_Actor;
59 class SALOME_Actor;
60
61 namespace SMESH {
62
63   //----------------------------------------------------------------------------
64   typedef pair<int,string> TKeyOfVisualObj;
65   
66 SMESHGUI_EXPORT
67   TVisualObjPtr GetVisualObj(int theStudyId, 
68                              const char* theEntry);
69 SMESHGUI_EXPORT
70   void OnVisuException(); // PAL16631
71
72   //----------------------------------------------------------------------------
73 SMESHGUI_EXPORT
74   SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule = NULL,
75                                  bool createIfNotFound = 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* theEntry);
97 SMESHGUI_EXPORT
98   SMESH_Actor* FindActorByEntry (const char* theEntry);
99
100 SMESHGUI_EXPORT
101   SMESH_Actor* FindActorByObject (CORBA::Object_ptr theObject);
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* theActor);
108 SMESHGUI_EXPORT
109   void RemoveActor  (SUIT_ViewWindow*, SMESH_Actor* theActor);
110 SMESHGUI_EXPORT
111   void RemoveVisuData(int studyID);
112
113   //----------------------------------------------------------------------------
114   enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
115 SMESHGUI_EXPORT
116   bool UpdateView (SUIT_ViewWindow*,
117                    EDisplaing theAction,
118                    const char* theEntry = "" );
119 SMESHGUI_EXPORT            
120   bool UpdateView (EDisplaing theAction,
121                    const char* theEntry = "");
122
123 SMESHGUI_EXPORT
124   void UpdateView();
125
126 SMESHGUI_EXPORT
127   bool Update(const Handle(SALOME_InteractiveObject)& theIO,
128               bool theDisplay);
129
130
131   //----------------------------------------------------------------------------
132 SMESHGUI_EXPORT  
133   void SetPointRepresentation(bool theIsVisible);
134
135 SMESHGUI_EXPORT
136   void SetPickable(SMESH_Actor* theActor = NULL);
137
138 SMESHGUI_EXPORT
139   void UpdateSelectionProp( SMESHGUI* );
140
141
142   //----------------------------------------------------------------------------
143 SMESHGUI_EXPORT
144   SVTK_Selector* GetSelector (SUIT_ViewWindow* = GetActiveWindow());
145
146 SMESHGUI_EXPORT
147   void SetFilter (const Handle(VTKViewer_Filter)& theFilter,
148                   SVTK_Selector* theSelector = GetSelector());
149 SMESHGUI_EXPORT
150   Handle(VTKViewer_Filter) GetFilter (int theId, SVTK_Selector* theSelector = GetSelector());
151 SMESHGUI_EXPORT
152   bool IsFilterPresent (int theId, SVTK_Selector* theSelector = GetSelector());
153 SMESHGUI_EXPORT
154   void RemoveFilter (int theId, SVTK_Selector* theSelector = GetSelector());
155
156 SMESHGUI_EXPORT
157   void RemoveFilters (SVTK_Selector* theSelector = GetSelector());
158
159 SMESHGUI_EXPORT
160   bool IsValid (SALOME_Actor* theActor, int theCellId,
161                 SVTK_Selector* theSelector = GetSelector());
162
163   //----------------------------------------------------------------------------
164 SMESHGUI_EXPORT  
165   int GetNameOfSelectedNodes(SVTK_Selector* theSelector,
166                              const Handle(SALOME_InteractiveObject)& theIO,
167                              QString& theName);
168 SMESHGUI_EXPORT
169   int GetNameOfSelectedElements(SVTK_Selector* theSelector,
170                                 const Handle(SALOME_InteractiveObject)& theIO,
171                                 QString& theName);
172 SMESHGUI_EXPORT
173   int GetEdgeNodes(SVTK_Selector* theSelector,
174                    const TVisualObjPtr& theVisualObj,
175                    int& theId1,
176                    int& theId2);
177
178   //----------------------------------------------------------------------------
179 SMESHGUI_EXPORT  
180   int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
181                               const Handle(SALOME_InteractiveObject)& theIO,
182                               QString& theName);
183 SMESHGUI_EXPORT
184   int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
185                               QString& aName);
186 SMESHGUI_EXPORT
187   int GetNameOfSelectedElements (LightApp_SelectionMgr*,
188                                  const Handle(SALOME_InteractiveObject)& theIO,
189                                  QString& theName);
190 SMESHGUI_EXPORT
191   int GetNameOfSelectedElements (LightApp_SelectionMgr*,
192                                  QString& aName);
193 SMESHGUI_EXPORT
194   int GetSelected (LightApp_SelectionMgr*,
195                    TColStd_IndexedMapOfInteger& theMap,
196                    const bool theIsElement = true );
197
198 SMESHGUI_EXPORT
199   int GetEdgeNodes (LightApp_SelectionMgr*, int& theId1, int& theId2);
200
201 SMESHGUI_EXPORT
202   void SetControlsPrecision (const long theVal);
203 };
204
205 #endif