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.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef SMESHGUI_VTKUtils_HeaderFile
21 #define SMESHGUI_VTKUtils_HeaderFile
23 #include "SMESH_SMESHGUI.hxx"
25 #include "SALOMEDSClient_definitions.hxx"
26 #include "SALOME_InteractiveObject.hxx"
27 #include "VTKViewer_Filter.h"
29 #include "SMESH_Object.h"
30 #include "SMESHGUI_Utils.h"
34 #include "SALOMEconfig.h"
35 #include CORBA_CLIENT_HEADER(SALOMEDS)
37 #include <boost/shared_ptr.hpp>
41 class TColStd_IndexedMapOfInteger;
43 class SALOMEDSClient_Study;
46 class SUIT_ViewWindow;
47 class SUIT_ViewManager;
49 class SVTK_ViewWindow;
52 class LightApp_SelectionMgr;
53 class SalomeApp_Module;
61 //----------------------------------------------------------------------------
62 typedef pair<int,string> TKeyOfVisualObj;
65 TVisualObjPtr GetVisualObj(int theStudyId,
66 const char* theEntry);
68 //----------------------------------------------------------------------------
70 SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule = NULL,
71 bool createIfNotFound = false);
73 SVTK_ViewWindow* FindVtkViewWindow(SUIT_ViewManager*, SUIT_ViewWindow*);
75 SVTK_ViewWindow* GetVtkViewWindow(SUIT_ViewWindow*);
78 SVTK_ViewWindow* GetCurrentVtkView();
80 //----------------------------------------------------------------------------
82 void RepaintCurrentView();
84 void RepaintViewWindow(SVTK_ViewWindow*);
86 void RenderViewWindow(SVTK_ViewWindow*);
90 //----------------------------------------------------------------------------
92 SMESH_Actor* FindActorByEntry (SUIT_ViewWindow*, const char* theEntry);
94 SMESH_Actor* FindActorByEntry (const char* theEntry);
97 SMESH_Actor* FindActorByObject (CORBA::Object_ptr theObject);
99 //----------------------------------------------------------------------------
101 SMESH_Actor* CreateActor (_PTR(Study), const char*, int = false);
103 void DisplayActor (SUIT_ViewWindow*, SMESH_Actor* theActor);
105 void RemoveActor (SUIT_ViewWindow*, SMESH_Actor* theActor);
107 //----------------------------------------------------------------------------
108 enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
110 void UpdateView (SUIT_ViewWindow*,
111 EDisplaing theAction,
112 const char* theEntry = "" );
114 void UpdateView (EDisplaing theAction,
115 const char* theEntry = "");
121 void Update(const Handle(SALOME_InteractiveObject)& theIO,
125 //----------------------------------------------------------------------------
127 void SetPointRepresentation(bool theIsVisible);
130 void SetPickable(SMESH_Actor* theActor = NULL);
133 void UpdateSelectionProp( SMESHGUI* );
136 //----------------------------------------------------------------------------
138 SVTK_Selector* GetSelector (SUIT_ViewWindow* = GetActiveWindow());
141 void SetFilter (const Handle(VTKViewer_Filter)& theFilter,
142 SVTK_Selector* theSelector = GetSelector());
144 Handle(VTKViewer_Filter) GetFilter (int theId, SVTK_Selector* theSelector = GetSelector());
146 bool IsFilterPresent (int theId, SVTK_Selector* theSelector = GetSelector());
148 void RemoveFilter (int theId, SVTK_Selector* theSelector = GetSelector());
151 void RemoveFilters (SVTK_Selector* theSelector = GetSelector());
154 bool IsValid (SALOME_Actor* theActor, int theCellId,
155 SVTK_Selector* theSelector = GetSelector());
157 //----------------------------------------------------------------------------
159 int GetNameOfSelectedNodes(SVTK_Selector* theSelector,
160 const Handle(SALOME_InteractiveObject)& theIO,
163 int GetNameOfSelectedElements(SVTK_Selector* theSelector,
164 const Handle(SALOME_InteractiveObject)& theIO,
167 int GetEdgeNodes(SVTK_Selector* theSelector,
168 const TVisualObjPtr& theVisualObj,
172 //----------------------------------------------------------------------------
174 int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
175 const Handle(SALOME_InteractiveObject)& theIO,
178 int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
181 int GetNameOfSelectedElements (LightApp_SelectionMgr*,
182 const Handle(SALOME_InteractiveObject)& theIO,
185 int GetNameOfSelectedElements (LightApp_SelectionMgr*,
188 int GetSelected (LightApp_SelectionMgr*,
189 TColStd_IndexedMapOfInteger& theMap,
190 const bool theIsElement = true );
193 int GetEdgeNodes (LightApp_SelectionMgr*, int& theId1, int& theId2);
196 void SetControlsPrecision (const long theVal);