Salome HOME
PAL16834 (smesh Prism don't work with NETGEN_2D algorithm)
[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 #ifndef SMESHGUI_VTKUtils_HeaderFile
21 #define SMESHGUI_VTKUtils_HeaderFile
22
23 #include "SMESH_SMESHGUI.hxx"
24
25 #include "SALOMEDSClient_definitions.hxx"
26 #include "SALOME_InteractiveObject.hxx"
27 #include "VTKViewer_Filter.h"
28
29 #include "SMESH_Object.h"
30 #include "SMESHGUI_Utils.h"
31
32 #include <CORBA.h>
33
34 #include "SALOMEconfig.h"
35 #include CORBA_CLIENT_HEADER(SALOMEDS)
36
37 #include <boost/shared_ptr.hpp>
38
39 class QString;
40
41 class TColStd_IndexedMapOfInteger;
42
43 class SALOMEDSClient_Study;
44
45 class SUIT_Study;
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 pair<int,string> TKeyOfVisualObj;
63   
64 SMESHGUI_EXPORT
65   TVisualObjPtr GetVisualObj(int theStudyId, 
66                              const char* theEntry);
67
68   //----------------------------------------------------------------------------
69 SMESHGUI_EXPORT
70   SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule = NULL,
71                                  bool createIfNotFound = false);
72 SMESHGUI_EXPORT
73   SVTK_ViewWindow* FindVtkViewWindow(SUIT_ViewManager*, SUIT_ViewWindow*);
74 SMESHGUI_EXPORT
75   SVTK_ViewWindow* GetVtkViewWindow(SUIT_ViewWindow*);
76
77 SMESHGUI_EXPORT
78   SVTK_ViewWindow* GetCurrentVtkView();
79
80   //----------------------------------------------------------------------------
81 SMESHGUI_EXPORT
82   void RepaintCurrentView();
83 SMESHGUI_EXPORT
84   void RepaintViewWindow(SVTK_ViewWindow*);
85 SMESHGUI_EXPORT
86   void RenderViewWindow(SVTK_ViewWindow*);
87 SMESHGUI_EXPORT
88   void FitAll();
89
90   //----------------------------------------------------------------------------
91 SMESHGUI_EXPORT
92   SMESH_Actor* FindActorByEntry (SUIT_ViewWindow*, const char* theEntry);
93 SMESHGUI_EXPORT
94   SMESH_Actor* FindActorByEntry (const char* theEntry);
95
96 SMESHGUI_EXPORT
97   SMESH_Actor* FindActorByObject (CORBA::Object_ptr theObject);
98
99   //----------------------------------------------------------------------------
100 SMESHGUI_EXPORT  
101   SMESH_Actor* CreateActor (_PTR(Study), const char*, int = false);
102 SMESHGUI_EXPORT
103   void DisplayActor (SUIT_ViewWindow*, SMESH_Actor* theActor);
104 SMESHGUI_EXPORT
105   void RemoveActor  (SUIT_ViewWindow*, SMESH_Actor* theActor);
106
107   //----------------------------------------------------------------------------
108   enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
109 SMESHGUI_EXPORT
110   void UpdateView (SUIT_ViewWindow*,
111                    EDisplaing theAction,
112                    const char* theEntry = "" );
113 SMESHGUI_EXPORT            
114   void UpdateView (EDisplaing theAction,
115                    const char* theEntry = "");
116
117 SMESHGUI_EXPORT
118   void UpdateView();
119
120 SMESHGUI_EXPORT
121   void Update(const Handle(SALOME_InteractiveObject)& theIO,
122               bool theDisplay);
123
124
125   //----------------------------------------------------------------------------
126 SMESHGUI_EXPORT  
127   void SetPointRepresentation(bool theIsVisible);
128
129 SMESHGUI_EXPORT
130   void SetPickable(SMESH_Actor* theActor = NULL);
131
132 SMESHGUI_EXPORT
133   void UpdateSelectionProp( SMESHGUI* );
134
135
136   //----------------------------------------------------------------------------
137 SMESHGUI_EXPORT
138   SVTK_Selector* GetSelector (SUIT_ViewWindow* = GetActiveWindow());
139
140 SMESHGUI_EXPORT
141   void SetFilter (const Handle(VTKViewer_Filter)& theFilter,
142                   SVTK_Selector* theSelector = GetSelector());
143 SMESHGUI_EXPORT
144   Handle(VTKViewer_Filter) GetFilter (int theId, SVTK_Selector* theSelector = GetSelector());
145 SMESHGUI_EXPORT
146   bool IsFilterPresent (int theId, SVTK_Selector* theSelector = GetSelector());
147 SMESHGUI_EXPORT
148   void RemoveFilter (int theId, SVTK_Selector* theSelector = GetSelector());
149
150 SMESHGUI_EXPORT
151   void RemoveFilters (SVTK_Selector* theSelector = GetSelector());
152
153 SMESHGUI_EXPORT
154   bool IsValid (SALOME_Actor* theActor, int theCellId,
155                 SVTK_Selector* theSelector = GetSelector());
156
157   //----------------------------------------------------------------------------
158 SMESHGUI_EXPORT  
159   int GetNameOfSelectedNodes(SVTK_Selector* theSelector,
160                              const Handle(SALOME_InteractiveObject)& theIO,
161                              QString& theName);
162 SMESHGUI_EXPORT
163   int GetNameOfSelectedElements(SVTK_Selector* theSelector,
164                                 const Handle(SALOME_InteractiveObject)& theIO,
165                                 QString& theName);
166 SMESHGUI_EXPORT
167   int GetEdgeNodes(SVTK_Selector* theSelector,
168                    const TVisualObjPtr& theVisualObj,
169                    int& theId1,
170                    int& theId2);
171
172   //----------------------------------------------------------------------------
173 SMESHGUI_EXPORT  
174   int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
175                               const Handle(SALOME_InteractiveObject)& theIO,
176                               QString& theName);
177 SMESHGUI_EXPORT
178   int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
179                               QString& aName);
180 SMESHGUI_EXPORT
181   int GetNameOfSelectedElements (LightApp_SelectionMgr*,
182                                  const Handle(SALOME_InteractiveObject)& theIO,
183                                  QString& theName);
184 SMESHGUI_EXPORT
185   int GetNameOfSelectedElements (LightApp_SelectionMgr*,
186                                  QString& aName);
187 SMESHGUI_EXPORT
188   int GetSelected (LightApp_SelectionMgr*,
189                    TColStd_IndexedMapOfInteger& theMap,
190                    const bool theIsElement = true );
191
192 SMESHGUI_EXPORT
193   int GetEdgeNodes (LightApp_SelectionMgr*, int& theId1, int& theId2);
194
195 SMESHGUI_EXPORT
196   void SetControlsPrecision (const long theVal);
197 };
198
199 #endif