1 // VISU VISUGUI : GUI of VISU component
3 // Copyright (C) 2005 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : VisuGUI_Tools.h
25 // Author : Sergey Anikin
28 #ifndef VisuGUI_Tools_HeaderFile
29 #define VisuGUI_Tools_HeaderFile
31 #include "SALOME_InteractiveObject.hxx"
33 #include "VISUConfig.hh"
35 #include "SALOMEDSClient_Study.hxx"
37 #include "SALOMEconfig.h"
38 #include CORBA_SERVER_HEADER(MED_Gen)
43 class SUIT_ViewWindow;
45 class SVTK_ViewWindow;
48 class Plot2d_ViewFrame;
50 class LightApp_SelectionMgr;
51 class SalomeApp_Module;
52 class SalomeApp_Study;
62 typedef std::vector<SVTK_ViewWindow*> TViewWindows;
64 SUIT_Desktop* GetDesktop(const CAM_Module* theModule);
65 SalomeApp_Study* GetAppStudy(const CAM_Module* theModule);
66 _PTR(Study) GetCStudy(const SalomeApp_Study* theStudy);
68 bool IsStudyLocked( _PTR(Study) theStudy );
69 bool CheckLock( _PTR(Study) theStudy,
72 void UpdateObjBrowser(SalomeApp_Module* theModule,
73 bool theIsUpdateDataModel = true,
74 _PTR(SObject) theSObject = _PTR(SObject)());
76 VISU_Gen_i* GetVisuGen(const CAM_Module* theModule);
77 SALOME_MED::MED_Gen_var GetMEDEngine();
79 VISU::Storable::TRestoringMap getMapOfValue(_PTR(SObject) theSObject);
80 QString getValue(_PTR(SObject) theSObject, QString theKey);
83 LightApp_SelectionMgr* GetSelectionMgr(const SalomeApp_Module* theModule);
84 CORBA::Object_var GetSelectedObj(const SalomeApp_Study* theStudy,
85 const QString& theEntry,
86 VISU::Storable::TRestoringMap* theMap = NULL);
87 CORBA::Object_var GetSelectedObj(const SalomeApp_Module* theModule,
88 Handle(SALOME_InteractiveObject)* theIO = NULL,
89 VISU::Storable::TRestoringMap* theMap = NULL);
90 VISU::Prs3d_i* GetPrsToModify(const SalomeApp_Module* theModule,
91 Handle(SALOME_InteractiveObject)* theIO = NULL,
92 VISU::Storable::TRestoringMap* theMap = NULL);
94 void Add(LightApp_SelectionMgr* theSelectionMgr,
95 const Handle(SALOME_InteractiveObject)& theIO);
96 void Remove(LightApp_SelectionMgr* theSelectionMgr,
97 const Handle(SALOME_InteractiveObject)& theIO);
99 bool IsRemovableSelected(const SalomeApp_Module* theModule);
101 void DeleteSObject(VisuGUI* theModule,
102 _PTR(Study) theStudy,
103 _PTR(SObject) theSObject);
104 void DeletePrs3d(VisuGUI* theModule,
105 VISU::Prs3d_i* thePrs,
106 const Handle(SALOME_InteractiveObject)& theIO);
108 // Presentation management
109 void ChangeRepresentation (const SalomeApp_Module* theModule,
110 VISU::PresentationType theType);
112 void SetShading ( const SalomeApp_Module* theModule, bool theOn = true );
115 bool CheckTimeStamp(const SalomeApp_Module* theModule,
116 _PTR(SObject)& theSObject,
117 Handle(SALOME_InteractiveObject)* theIO = NULL);
118 VISU::Result_i* CheckResult(const SalomeApp_Module* theModule,
119 _PTR(SObject) theSource,
120 VISU::Result_var& theResult);
121 bool IsSObjectTable(_PTR(SObject) theSObject);
123 /*! Display mesh presentation in given VTK view window
125 VISU_Actor* PublishMeshInView(const SalomeApp_Module* theModule,
126 VISU::Prs3d_i* thePrs,
127 SVTK_ViewWindow* theViewWindow);
130 * \brief Repaint all SVTK view windows, where the given object is displayed.
131 * \param theModule - is used to access application.
132 * \param theIObject - is supposed to be selected (is highlighted in this method).
134 void RepaintViewWindows(const SalomeApp_Module* theModule,
135 const Handle(SALOME_InteractiveObject)& theIObject);
137 VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow,
138 const char* theEntry);
139 VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow,
140 VISU::Prs3d_i* thePrs);
141 void RecreateActor(const SalomeApp_Module* theModule,
142 VISU::Prs3d_i* thePrs);
145 * \brief Advanced FitAll, sets view projection in accordance with current view contents
147 * If common bounding box of all actors in \a theViewWindow has
148 * at least one small side, then corresponding projection will be set
149 * (Top, Left or Front), else 3D projection will be used.
151 * \param theViewWindow - the view to perform FitAll in.
153 void SetFitAll(SVTK_ViewWindow* theViewWindow);
156 SPlot2d_Viewer* GetPlot2dViewer(const SalomeApp_Module* theModule,
157 const bool theCreate = false);
158 void PlotTable( const SalomeApp_Module* theModule,
159 VISU::Table_i* table,
161 void PlotCurve( const SalomeApp_Module* theModule,
162 VISU::Curve_i* curve,
164 void PlotContainer( const SalomeApp_Module* theModule,
165 VISU::Container_i* container,
167 void CreatePlot( SalomeApp_Module* theModule,
168 _PTR(SObject) theSobj );
170 /*! Display/Erase/Update a curve presentation.
171 * Parameter \a frame may be NULL, in this case there is only update without display/erase
173 void UpdateCurve( VISU::Curve_i*,
174 Plot2d_ViewFrame* frame,
178 /*! Create mesh presentation and display it in \a theViewWindow.
179 * If \a theViewWindow is NULL, no displaying will be done.
181 void CreateMesh (const SalomeApp_Module* theModule,
182 const Handle(SALOME_InteractiveObject)& theIO,
183 SVTK_ViewWindow* theViewWindow = NULL);
186 std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
187 const Handle(SALOME_InteractiveObject)& theIO);
188 std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
189 _PTR(SObject) theObject);
191 int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow);
192 void AddScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
193 VISU::Prs3d_i* thePrs3d, int pos);
194 void RemoveScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
195 VISU::Prs3d_i* thePrs3d);