1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
20 #ifndef SMESHGUI_VTKUtils_HeaderFile
21 #define SMESHGUI_VTKUtils_HeaderFile
25 class TColStd_IndexedMapOfInteger;
27 #include "SALOMEDSClient_definitions.hxx"
28 #include "SALOME_InteractiveObject.hxx"
29 #include "VTKViewer_Filter.h"
31 class SALOMEDSClient_Study;
34 class SUIT_ViewWindow;
35 class SUIT_ViewManager;
37 class SVTK_InteractorStyle;
38 class SVTK_ViewWindow;
41 class SalomeApp_SelectionMgr;
46 #include "SALOMEconfig.h"
47 #include CORBA_CLIENT_HEADER(SALOMEDS)
49 #include <boost/shared_ptr.hpp>
50 #include "SMESH_Object.h"
54 class SVTK_ViewWindow;
55 class SalomeApp_Module;
59 //----------------------------------------------------------------------------
60 typedef pair<int,string> TKeyOfVisualObj;
62 TVisualObjPtr GetVisualObj(int theStudyId,
63 const char* theEntry);
65 //----------------------------------------------------------------------------
66 SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule);
68 SUIT_ViewWindow* GetActiveWindow();
70 SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager*,
73 SVTK_ViewWindow* GetVtkViewWindow( SUIT_ViewWindow* );
75 SVTK_ViewWindow* GetCurrentVtkView();
77 void RepaintViewWindow(SVTK_ViewWindow*);
78 void RenderViewWindow(SVTK_ViewWindow*);
80 //----------------------------------------------------------------------------
81 SMESH_Actor* FindActorByEntry (SUIT_ViewWindow*, const char* theEntry);
82 SMESH_Actor* FindActorByEntry (const char* theEntry);
84 SMESH_Actor* FindActorByObject (CORBA::Object_ptr theObject);
86 //----------------------------------------------------------------------------
87 SMESH_Actor* CreateActor (_PTR(Study), const char*, int = false);
88 void DisplayActor (SUIT_ViewWindow*, SMESH_Actor* theActor);
89 void RemoveActor (SUIT_ViewWindow*, SMESH_Actor* theActor);
91 //----------------------------------------------------------------------------
92 enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
93 void UpdateView (SUIT_ViewWindow*,
95 const char* theEntry = "");
96 void UpdateView (EDisplaing theAction,
97 const char* theEntry = "");
101 void Update(const Handle(SALOME_InteractiveObject)& theIO,
105 //----------------------------------------------------------------------------
108 void RepaintCurrentView();
110 vtkRenderer* GetCurrentRenderer();
113 //----------------------------------------------------------------------------
114 void SetPointRepresentation(bool theIsVisible);
116 void SetPickable(SMESH_Actor* theActor = NULL);
118 void UpdateSelectionProp( SMESHGUI* );
121 //----------------------------------------------------------------------------
122 SVTK_InteractorStyle*
123 GetInteractorStyle (SUIT_ViewWindow* = GetActiveWindow());
125 void SetFilter (const Handle(VTKViewer_Filter)& theFilter,
126 SVTK_InteractorStyle* theStyle = GetInteractorStyle());
128 Handle(VTKViewer_Filter)
129 GetFilter (int theId, SVTK_InteractorStyle* theStyle = GetInteractorStyle());
131 bool IsFilterPresent (int theId,
132 SVTK_InteractorStyle* theStyle = GetInteractorStyle());
134 void RemoveFilter (int theId,
135 SVTK_InteractorStyle* theStyle = GetInteractorStyle());
137 void RemoveFilters (SVTK_InteractorStyle* theStyle = GetInteractorStyle());
139 bool IsValid (SALOME_Actor* theActor, int theCellId,
140 SVTK_InteractorStyle* theStyle = GetInteractorStyle());
142 //----------------------------------------------------------------------------
143 int GetNameOfSelectedNodes(SVTK_Selector* theSelector,
144 const Handle(SALOME_InteractiveObject)& theIO,
147 int GetNameOfSelectedElements(SVTK_Selector* theSelector,
148 const Handle(SALOME_InteractiveObject)& theIO,
151 int GetEdgeNodes(SVTK_Selector* theSelector,
152 const TVisualObjPtr& theVisualObj,
156 //----------------------------------------------------------------------------
157 int GetNameOfSelectedNodes (SalomeApp_SelectionMgr*,
158 const Handle(SALOME_InteractiveObject)& theIO,
161 int GetNameOfSelectedNodes (SalomeApp_SelectionMgr*,
164 int GetNameOfSelectedElements (SalomeApp_SelectionMgr*,
165 const Handle(SALOME_InteractiveObject)& theIO,
168 int GetNameOfSelectedElements (SalomeApp_SelectionMgr*,
171 int GetSelected (SalomeApp_SelectionMgr*,
172 TColStd_IndexedMapOfInteger& theMap,
173 const bool theIsElement = true );
175 int GetEdgeNodes (SalomeApp_SelectionMgr*, int& theId1, int& theId2);
177 void SetControlsPrecision (const long theVal);