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 "SALOME_InteractiveObject.hxx"
28 #include "VTKViewer_Filter.h"
32 class SALOME_Selection;
33 class VTKViewer_ViewFrame;
34 class VTKViewer_InteractorStyleSALOME;
38 #include "SALOMEconfig.h"
39 #include CORBA_CLIENT_HEADER(SALOMEDS)
41 #include <boost/shared_ptr.hpp>
42 #include "SMESH_Object.h"
49 //----------------------------------------------------------------------------
50 typedef pair<int,string> TKeyOfVisualObj;
52 TVisualObjPtr GetVisualObj(int theStudyId,
53 const char* theEntry);
56 //----------------------------------------------------------------------------
57 QAD_StudyFrame* GetActiveStudyFrame();
59 VTKViewer_ViewFrame* FindVtkViewFrame(QAD_Study* theStudy,
60 QAD_StudyFrame* theStudyFrame);
62 VTKViewer_ViewFrame* GetVtkViewFrame(QAD_StudyFrame* theStudyFrame);
64 VTKViewer_ViewFrame* GetCurrentVtkView();
66 void RepaintViewFrame(VTKViewer_ViewFrame* theFrame);
68 void RenderViewFrame(VTKViewer_ViewFrame* theFrame);
70 //----------------------------------------------------------------------------
71 SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame,
72 const char* theEntry);
73 SMESH_Actor* FindActorByEntry(const char* theEntry);
75 SMESH_Actor* FindActorByObject(CORBA::Object_ptr theObject);
78 //----------------------------------------------------------------------------
79 SMESH_Actor* CreateActor(SALOMEDS::Study_ptr theStudy,
81 int theIsClear = false);
83 void DisplayActor(QAD_StudyFrame *theStudyFrame,
84 SMESH_Actor* theActor);
85 void RemoveActor(QAD_StudyFrame *theStudyFrame,
86 SMESH_Actor* theActor);
89 //----------------------------------------------------------------------------
90 enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
91 void UpdateView(QAD_StudyFrame *theStudyFrame,
93 const char* theEntry = "");
94 void UpdateView(EDisplaing theAction,
95 const char* theEntry = "");
99 void Update(const Handle(SALOME_InteractiveObject)& theIO,
103 //----------------------------------------------------------------------------
106 void RepaintCurrentView();
108 vtkRenderer* GetCurrentRenderer();
111 //----------------------------------------------------------------------------
112 void SetPointRepresentation(bool theIsVisible);
114 void SetPickable(SMESH_Actor* theActor = NULL);
116 void UpdateSelectionProp();
119 //----------------------------------------------------------------------------
120 VTKViewer_InteractorStyleSALOME*
121 GetInteractorStyle(QAD_StudyFrame *theStudyFrame = GetActiveStudyFrame());
123 void SetFilter(const Handle(VTKViewer_Filter)& theFilter,
124 VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
126 Handle(VTKViewer_Filter)
127 GetFilter(int theId, VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
129 bool IsFilterPresent(int theId,
130 VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
132 void RemoveFilter(int theId,
133 VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
135 void RemoveFilters(VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
137 bool IsValid(SALOME_Actor* theActor, int theCellId,
138 VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
140 //----------------------------------------------------------------------------
141 int GetNameOfSelectedNodes(SALOME_Selection *theSel,
142 const Handle(SALOME_InteractiveObject)& theIO,
145 int GetNameOfSelectedNodes(SALOME_Selection *theSel,
148 int GetNameOfSelectedElements(SALOME_Selection *theSel,
149 const Handle(SALOME_InteractiveObject)& theIO,
152 int GetNameOfSelectedElements(SALOME_Selection *theSel,
155 int GetSelected(SALOME_Selection* theSel,
156 TColStd_IndexedMapOfInteger& theMap,
157 const bool theIsElement = true );
159 int GetEdgeNodes(SALOME_Selection* theSel, int& theId1, int& theId2);
161 void SetControlsPrecision( const long theVal );