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();
67 //----------------------------------------------------------------------------
68 SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame,
69 const char* theEntry);
70 SMESH_Actor* FindActorByEntry(const char* theEntry);
72 SMESH_Actor* FindActorByObject(CORBA::Object_ptr theObject);
75 //----------------------------------------------------------------------------
76 SMESH_Actor* CreateActor(SALOMEDS::Study_ptr theStudy,
78 int theIsClear = false);
80 void DisplayActor(QAD_StudyFrame *theStudyFrame,
81 SMESH_Actor* theActor);
82 void RemoveActor(QAD_StudyFrame *theStudyFrame,
83 SMESH_Actor* theActor);
86 //----------------------------------------------------------------------------
87 enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
88 void UpdateView(QAD_StudyFrame *theStudyFrame,
90 const char* theEntry = "");
91 void UpdateView(EDisplaing theAction,
92 const char* theEntry = "");
96 void Update(const Handle(SALOME_InteractiveObject)& theIO,
100 //----------------------------------------------------------------------------
103 void RepaintCurrentView();
105 vtkRenderer* GetCurrentRenderer();
108 //----------------------------------------------------------------------------
109 void SetPointRepresentation(bool theIsVisible);
111 void SetPickable(SMESH_Actor* theActor = NULL);
113 void UpdateSelectionProp();
116 //----------------------------------------------------------------------------
117 VTKViewer_InteractorStyleSALOME*
118 GetInteractorStyle(QAD_StudyFrame *theStudyFrame = GetActiveStudyFrame());
120 void SetFilter(const Handle(VTKViewer_Filter)& theFilter,
121 VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
123 Handle(VTKViewer_Filter)
124 GetFilter(int theId, VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
126 bool IsFilterPresent(int theId,
127 VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
129 void RemoveFilter(int theId,
130 VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
132 bool IsValid(SALOME_Actor* theActor, int theCellId,
133 VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
135 //----------------------------------------------------------------------------
136 int GetNameOfSelectedNodes(SALOME_Selection *theSel,
137 const Handle(SALOME_InteractiveObject)& theIO,
140 int GetNameOfSelectedNodes(SALOME_Selection *theSel,
143 int GetNameOfSelectedElements(SALOME_Selection *theSel,
144 const Handle(SALOME_InteractiveObject)& theIO,
147 int GetNameOfSelectedElements(SALOME_Selection *theSel,
150 int GetSelected(SALOME_Selection* theSel,
151 TColStd_IndexedMapOfInteger& theMap,
152 const bool theIsElement = true );
154 int GetEdgeNodes(SALOME_Selection* theSel, int& theId1, int& theId2);
156 void SetControlsPrecision( const long theVal );