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;
45 #include "SALOMEconfig.h"
46 #include CORBA_CLIENT_HEADER(SALOMEDS)
48 #include <boost/shared_ptr.hpp>
49 #include "SMESH_Object.h"
53 class SVTK_ViewWindow;
54 class SalomeApp_Module;
58 //----------------------------------------------------------------------------
59 typedef pair<int,string> TKeyOfVisualObj;
61 TVisualObjPtr GetVisualObj(int theStudyId,
62 const char* theEntry);
64 //----------------------------------------------------------------------------
65 SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule);
67 SUIT_ViewWindow* GetActiveWindow();
69 SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager*,
72 SVTK_ViewWindow* GetVtkViewWindow( SUIT_ViewWindow* );
74 SVTK_ViewWindow* GetCurrentVtkView();
76 void RepaintViewWindow(SVTK_ViewWindow*);
77 void RenderViewWindow(SVTK_ViewWindow*);
79 //----------------------------------------------------------------------------
80 SMESH_Actor* FindActorByEntry (SUIT_ViewWindow*, const char* theEntry);
81 SMESH_Actor* FindActorByEntry (const char* theEntry);
83 SMESH_Actor* FindActorByObject (CORBA::Object_ptr theObject);
85 //----------------------------------------------------------------------------
86 SMESH_Actor* CreateActor (_PTR(Study), const char*, int = false);
87 void DisplayActor (SUIT_ViewWindow*, SMESH_Actor* theActor);
88 void RemoveActor (SUIT_ViewWindow*, SMESH_Actor* theActor);
90 //----------------------------------------------------------------------------
91 enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
92 void UpdateView (SUIT_ViewWindow*,
94 const char* theEntry = "");
95 void UpdateView (EDisplaing theAction,
96 const char* theEntry = "");
100 void Update(const Handle(SALOME_InteractiveObject)& theIO,
104 //----------------------------------------------------------------------------
107 void RepaintCurrentView();
109 vtkRenderer* GetCurrentRenderer();
112 //----------------------------------------------------------------------------
113 void SetPointRepresentation(bool theIsVisible);
115 void SetPickable(SMESH_Actor* theActor = NULL);
117 void UpdateSelectionProp();
120 //----------------------------------------------------------------------------
121 SVTK_InteractorStyle*
122 GetInteractorStyle (SUIT_ViewWindow* = GetActiveWindow());
124 void SetFilter (const Handle(VTKViewer_Filter)& theFilter,
125 SVTK_InteractorStyle* theStyle = GetInteractorStyle());
127 Handle(VTKViewer_Filter)
128 GetFilter (int theId, SVTK_InteractorStyle* theStyle = GetInteractorStyle());
130 bool IsFilterPresent (int theId,
131 SVTK_InteractorStyle* theStyle = GetInteractorStyle());
133 void RemoveFilter (int theId,
134 SVTK_InteractorStyle* theStyle = GetInteractorStyle());
136 void RemoveFilters (SVTK_InteractorStyle* theStyle = GetInteractorStyle());
138 bool IsValid (SALOME_Actor* theActor, int theCellId,
139 SVTK_InteractorStyle* theStyle = GetInteractorStyle());
141 //----------------------------------------------------------------------------
142 int GetNameOfSelectedNodes(SVTK_Selector* theSelector,
143 const Handle(SALOME_InteractiveObject)& theIO,
146 int GetNameOfSelectedElements(SVTK_Selector* theSelector,
147 const Handle(SALOME_InteractiveObject)& theIO,
150 int GetEdgeNodes(SVTK_Selector* theSelector,
151 const TVisualObjPtr& theVisualObj,
155 //----------------------------------------------------------------------------
156 int GetNameOfSelectedNodes (SalomeApp_SelectionMgr*,
157 const Handle(SALOME_InteractiveObject)& theIO,
160 int GetNameOfSelectedNodes (SalomeApp_SelectionMgr*,
163 int GetNameOfSelectedElements (SalomeApp_SelectionMgr*,
164 const Handle(SALOME_InteractiveObject)& theIO,
167 int GetNameOfSelectedElements (SalomeApp_SelectionMgr*,
170 int GetSelected (SalomeApp_SelectionMgr*,
171 TColStd_IndexedMapOfInteger& theMap,
172 const bool theIsElement = true );
174 int GetEdgeNodes (SalomeApp_SelectionMgr*, int& theId1, int& theId2);
176 void SetControlsPrecision (const long theVal);