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 "SALOMEDSClient_definitions.hxx"
24 #include "SALOME_InteractiveObject.hxx"
25 #include "VTKViewer_Filter.h"
27 #include "SMESH_Object.h"
28 #include "SMESHGUI_Utils.h"
32 #include "SALOMEconfig.h"
33 #include CORBA_CLIENT_HEADER(SALOMEDS)
35 #include <boost/shared_ptr.hpp>
39 class TColStd_IndexedMapOfInteger;
41 class SALOMEDSClient_Study;
44 class SUIT_ViewWindow;
45 class SUIT_ViewManager;
47 class SVTK_ViewWindow;
50 class LightApp_SelectionMgr;
51 class SalomeApp_Module;
59 //----------------------------------------------------------------------------
60 typedef pair<int,string> TKeyOfVisualObj;
62 TVisualObjPtr GetVisualObj(int theStudyId,
63 const char* theEntry);
64 void OnVisuException(); // PAL16631
66 //----------------------------------------------------------------------------
67 SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule = NULL,
68 bool createIfNotFound = false);
70 SVTK_ViewWindow* FindVtkViewWindow(SUIT_ViewManager*, SUIT_ViewWindow*);
72 SVTK_ViewWindow* GetVtkViewWindow(SUIT_ViewWindow*);
74 SVTK_ViewWindow* GetCurrentVtkView();
76 //----------------------------------------------------------------------------
77 void RepaintCurrentView();
78 void RepaintViewWindow(SVTK_ViewWindow*);
79 void RenderViewWindow(SVTK_ViewWindow*);
83 //----------------------------------------------------------------------------
84 SMESH_Actor* FindActorByEntry (SUIT_ViewWindow*, const char* theEntry);
85 SMESH_Actor* FindActorByEntry (const char* theEntry);
87 SMESH_Actor* FindActorByObject (CORBA::Object_ptr theObject);
89 //----------------------------------------------------------------------------
90 SMESH_Actor* CreateActor (_PTR(Study), const char*, int = false);
91 void DisplayActor (SUIT_ViewWindow*, SMESH_Actor* theActor);
92 void RemoveActor (SUIT_ViewWindow*, SMESH_Actor* theActor);
93 void RemoveVisuData(int studyID);
95 //----------------------------------------------------------------------------
96 enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
97 bool UpdateView (SUIT_ViewWindow*,
99 const char* theEntry = "");
100 bool UpdateView (EDisplaing theAction,
101 const char* theEntry = "");
105 bool Update(const Handle(SALOME_InteractiveObject)& theIO,
109 //----------------------------------------------------------------------------
110 void SetPointRepresentation(bool theIsVisible);
112 void SetPickable(SMESH_Actor* theActor = NULL);
114 void UpdateSelectionProp( SMESHGUI* );
117 //----------------------------------------------------------------------------
118 SVTK_Selector* GetSelector (SUIT_ViewWindow* = GetActiveWindow());
120 void SetFilter (const Handle(VTKViewer_Filter)& theFilter,
121 SVTK_Selector* theSelector = GetSelector());
123 Handle(VTKViewer_Filter) GetFilter (int theId, SVTK_Selector* theSelector = GetSelector());
125 bool IsFilterPresent (int theId, SVTK_Selector* theSelector = GetSelector());
127 void RemoveFilter (int theId, SVTK_Selector* theSelector = GetSelector());
129 void RemoveFilters (SVTK_Selector* theSelector = GetSelector());
131 bool IsValid (SALOME_Actor* theActor, int theCellId,
132 SVTK_Selector* theSelector = GetSelector());
134 //----------------------------------------------------------------------------
135 int GetNameOfSelectedNodes(SVTK_Selector* theSelector,
136 const Handle(SALOME_InteractiveObject)& theIO,
139 int GetNameOfSelectedElements(SVTK_Selector* theSelector,
140 const Handle(SALOME_InteractiveObject)& theIO,
143 int GetEdgeNodes(SVTK_Selector* theSelector,
144 const TVisualObjPtr& theVisualObj,
148 //----------------------------------------------------------------------------
149 int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
150 const Handle(SALOME_InteractiveObject)& theIO,
153 int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
156 int GetNameOfSelectedElements (LightApp_SelectionMgr*,
157 const Handle(SALOME_InteractiveObject)& theIO,
160 int GetNameOfSelectedElements (LightApp_SelectionMgr*,
163 int GetSelected (LightApp_SelectionMgr*,
164 TColStd_IndexedMapOfInteger& theMap,
165 const bool theIsElement = true );
167 int GetEdgeNodes (LightApp_SelectionMgr*, int& theId1, int& theId2);
169 void SetControlsPrecision (const long theVal);