Salome HOME
NPAL17241: EDF590: Keyboard shortcuts for removing and renaming an object.
[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 SMESHGUI_EXPORT
68   void OnVisuException(); // PAL16631
69
70   //----------------------------------------------------------------------------
71 SMESHGUI_EXPORT
72   SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule = NULL,
73                                  bool createIfNotFound = 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* theEntry);
95 SMESHGUI_EXPORT
96   SMESH_Actor* FindActorByEntry (const char* theEntry);
97
98 SMESHGUI_EXPORT
99   SMESH_Actor* FindActorByObject (CORBA::Object_ptr theObject);
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* theActor);
106 SMESHGUI_EXPORT
107   void RemoveActor  (SUIT_ViewWindow*, SMESH_Actor* theActor);
108
109   //----------------------------------------------------------------------------
110   enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
111 SMESHGUI_EXPORT
112   void UpdateView (SUIT_ViewWindow*,
113                    EDisplaing theAction,
114                    const char* theEntry = "" );
115 SMESHGUI_EXPORT            
116   void UpdateView (EDisplaing theAction,
117                    const char* theEntry = "");
118
119 SMESHGUI_EXPORT
120   void UpdateView();
121
122 SMESHGUI_EXPORT
123   bool Update(const Handle(SALOME_InteractiveObject)& theIO,
124               bool theDisplay);
125
126
127   //----------------------------------------------------------------------------
128 SMESHGUI_EXPORT  
129   void SetPointRepresentation(bool theIsVisible);
130
131 SMESHGUI_EXPORT
132   void SetPickable(SMESH_Actor* theActor = NULL);
133
134 SMESHGUI_EXPORT
135   void UpdateSelectionProp( SMESHGUI* );
136
137
138   //----------------------------------------------------------------------------
139 SMESHGUI_EXPORT
140   SVTK_Selector* GetSelector (SUIT_ViewWindow* = GetActiveWindow());
141
142 SMESHGUI_EXPORT
143   void SetFilter (const Handle(VTKViewer_Filter)& theFilter,
144                   SVTK_Selector* theSelector = GetSelector());
145 SMESHGUI_EXPORT
146   Handle(VTKViewer_Filter) GetFilter (int theId, SVTK_Selector* theSelector = GetSelector());
147 SMESHGUI_EXPORT
148   bool IsFilterPresent (int theId, SVTK_Selector* theSelector = GetSelector());
149 SMESHGUI_EXPORT
150   void RemoveFilter (int theId, SVTK_Selector* theSelector = GetSelector());
151
152 SMESHGUI_EXPORT
153   void RemoveFilters (SVTK_Selector* theSelector = GetSelector());
154
155 SMESHGUI_EXPORT
156   bool IsValid (SALOME_Actor* theActor, int theCellId,
157                 SVTK_Selector* theSelector = GetSelector());
158
159   //----------------------------------------------------------------------------
160 SMESHGUI_EXPORT  
161   int GetNameOfSelectedNodes(SVTK_Selector* theSelector,
162                              const Handle(SALOME_InteractiveObject)& theIO,
163                              QString& theName);
164 SMESHGUI_EXPORT
165   int GetNameOfSelectedElements(SVTK_Selector* theSelector,
166                                 const Handle(SALOME_InteractiveObject)& theIO,
167                                 QString& theName);
168 SMESHGUI_EXPORT
169   int GetEdgeNodes(SVTK_Selector* theSelector,
170                    const TVisualObjPtr& theVisualObj,
171                    int& theId1,
172                    int& theId2);
173
174   //----------------------------------------------------------------------------
175 SMESHGUI_EXPORT  
176   int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
177                               const Handle(SALOME_InteractiveObject)& theIO,
178                               QString& theName);
179 SMESHGUI_EXPORT
180   int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
181                               QString& aName);
182 SMESHGUI_EXPORT
183   int GetNameOfSelectedElements (LightApp_SelectionMgr*,
184                                  const Handle(SALOME_InteractiveObject)& theIO,
185                                  QString& theName);
186 SMESHGUI_EXPORT
187   int GetNameOfSelectedElements (LightApp_SelectionMgr*,
188                                  QString& aName);
189 SMESHGUI_EXPORT
190   int GetSelected (LightApp_SelectionMgr*,
191                    TColStd_IndexedMapOfInteger& theMap,
192                    const bool theIsElement = true );
193
194 SMESHGUI_EXPORT
195   int GetEdgeNodes (LightApp_SelectionMgr*, int& theId1, int& theId2);
196
197 SMESHGUI_EXPORT
198   void SetControlsPrecision (const long theVal);
199 };
200
201 #endif