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