1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #ifndef SMESHGUI_VTKUtils_HeaderFile
23 #define SMESHGUI_VTKUtils_HeaderFile
25 #include "SMESH_SMESHGUI.hxx"
27 #include "SALOMEDSClient_definitions.hxx"
28 #include "SALOME_InteractiveObject.hxx"
29 #include "VTKViewer_Filter.h"
31 #include "SMESH_Object.h"
32 #include "SMESHGUI_Utils.h"
36 #include "SALOMEconfig.h"
37 #include CORBA_CLIENT_HEADER(SALOMEDS)
39 #include <boost/shared_ptr.hpp>
43 class TColStd_IndexedMapOfInteger;
45 class SALOMEDSClient_Study;
48 class SUIT_ViewWindow;
49 class SUIT_ViewManager;
51 class SVTK_ViewWindow;
54 class LightApp_SelectionMgr;
55 class SalomeApp_Module;
63 //----------------------------------------------------------------------------
64 typedef std::pair<int,std::string> TKeyOfVisualObj;
67 TVisualObjPtr GetVisualObj(int theStudyId,
68 const char* theEntry);
70 void OnVisuException(); // PAL16631
72 //----------------------------------------------------------------------------
74 SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule = NULL,
75 bool createIfNotFound = false);
77 SVTK_ViewWindow* FindVtkViewWindow(SUIT_ViewManager*, SUIT_ViewWindow*);
79 SVTK_ViewWindow* GetVtkViewWindow(SUIT_ViewWindow*);
82 SVTK_ViewWindow* GetCurrentVtkView();
84 //----------------------------------------------------------------------------
86 void RepaintCurrentView();
88 void RepaintViewWindow(SVTK_ViewWindow*);
90 void RenderViewWindow(SVTK_ViewWindow*);
94 //----------------------------------------------------------------------------
96 SMESH_Actor* FindActorByEntry (SUIT_ViewWindow*, const char* theEntry);
98 SMESH_Actor* FindActorByEntry (const char* theEntry);
101 SMESH_Actor* FindActorByObject (CORBA::Object_ptr theObject);
103 //----------------------------------------------------------------------------
105 SMESH_Actor* CreateActor (_PTR(Study), const char*, int = false);
107 void DisplayActor (SUIT_ViewWindow*, SMESH_Actor* theActor);
109 void RemoveActor (SUIT_ViewWindow*, SMESH_Actor* theActor);
111 void RemoveVisuData(int studyID);
113 //----------------------------------------------------------------------------
114 enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
116 bool UpdateView (SUIT_ViewWindow*,
117 EDisplaing theAction,
118 const char* theEntry = "" );
120 bool UpdateView (EDisplaing theAction,
121 const char* theEntry = "");
127 bool Update(const Handle(SALOME_InteractiveObject)& theIO,
131 //----------------------------------------------------------------------------
133 void SetPointRepresentation(bool theIsVisible);
136 void SetPickable(SMESH_Actor* theActor = NULL);
139 void UpdateSelectionProp( SMESHGUI* );
142 //----------------------------------------------------------------------------
144 SVTK_Selector* GetSelector (SUIT_ViewWindow* = GetActiveWindow());
147 void SetFilter (const Handle(VTKViewer_Filter)& theFilter,
148 SVTK_Selector* theSelector = GetSelector());
150 Handle(VTKViewer_Filter) GetFilter (int theId, SVTK_Selector* theSelector = GetSelector());
152 bool IsFilterPresent (int theId, SVTK_Selector* theSelector = GetSelector());
154 void RemoveFilter (int theId, SVTK_Selector* theSelector = GetSelector());
157 void RemoveFilters (SVTK_Selector* theSelector = GetSelector());
160 bool IsValid (SALOME_Actor* theActor, int theCellId,
161 SVTK_Selector* theSelector = GetSelector());
163 //----------------------------------------------------------------------------
165 int GetNameOfSelectedNodes(SVTK_Selector* theSelector,
166 const Handle(SALOME_InteractiveObject)& theIO,
169 int GetNameOfSelectedElements(SVTK_Selector* theSelector,
170 const Handle(SALOME_InteractiveObject)& theIO,
173 int GetEdgeNodes(SVTK_Selector* theSelector,
174 const TVisualObjPtr& theVisualObj,
178 //----------------------------------------------------------------------------
180 int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
181 const Handle(SALOME_InteractiveObject)& theIO,
184 int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
187 int GetNameOfSelectedElements (LightApp_SelectionMgr*,
188 const Handle(SALOME_InteractiveObject)& theIO,
191 int GetNameOfSelectedElements (LightApp_SelectionMgr*,
194 int GetSelected (LightApp_SelectionMgr*,
195 TColStd_IndexedMapOfInteger& theMap,
196 const bool theIsElement = true );
199 int GetEdgeNodes (LightApp_SelectionMgr*, int& theId1, int& theId2);
202 void SetControlsPrecision (const long theVal);