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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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"
34 #include "VISU_ColoredPrs3d_i.hh"
36 #include "SALOMEDSClient_Study.hxx"
38 #include "SALOMEconfig.h"
39 #include CORBA_SERVER_HEADER(MED_Gen)
45 class SUIT_ViewWindow;
47 class SVTK_ViewWindow;
50 class Plot2d_ViewFrame;
52 class LightApp_SelectionMgr;
53 class SalomeApp_Module;
54 class SalomeApp_Study;
69 typedef std::vector<SVTK_ViewWindow*> TViewWindows;
71 //----------------------------------------------------------------------------
72 SUIT_Desktop* GetDesktop(const CAM_Module* theModule);
73 SalomeApp_Study* GetAppStudy(const CAM_Module* theModule);
74 _PTR(Study) GetCStudy(const SalomeApp_Study* theStudy);
76 bool IsStudyLocked( _PTR(Study) theStudy );
77 bool CheckLock( _PTR(Study) theStudy,
80 //----------------------------------------------------------------------------
81 int runAndWait( QDialog* dlg, const bool modal );
83 void UpdateObjBrowser(SalomeApp_Module* theModule,
84 bool theIsUpdateDataModel = true,
85 _PTR(SObject) theSObject = _PTR(SObject)());
87 //----------------------------------------------------------------------------
88 VISU_Gen_i* GetVisuGen(const CAM_Module* theModule);
89 SALOME_MED::MED_Gen_var GetMEDEngine();
92 LightApp_SelectionMgr* GetSelectionMgr(const SalomeApp_Module* theModule);
94 //----------------------------------------------------------------------------
98 _PTR(SObject) mySObject;
104 struct TSelectionItem
106 TObjectInfo myObjectInfo;
107 Handle(SALOME_InteractiveObject) myIO;
110 typedef std::vector<TSelectionItem> TSelectionInfo;
112 TSelectionInfo GetSelectedObjects(const SalomeApp_Module* theModule);
114 TObjectInfo GetObjectByEntry(const SalomeApp_Study* theStudy,
115 const std::string& theEntry);
117 VISU::Prs3d_i* GetPrs3dToModify(const SalomeApp_Module* theModule,
120 VISU::Prs3d_i* GetPrs3dFromBase(Base_i* theBase);
122 //----------------------------------------------------------------------------
123 void Add(LightApp_SelectionMgr* theSelectionMgr,
124 const Handle(SALOME_InteractiveObject)& theIO);
125 void Remove(LightApp_SelectionMgr* theSelectionMgr,
126 const Handle(SALOME_InteractiveObject)& theIO);
128 bool IsRemovableSelected(const SalomeApp_Module* theModule);
130 void DeleteSObject(VisuGUI* theModule,
131 _PTR(Study) theStudy,
132 _PTR(SObject) theSObject);
133 void DeletePrs3d(VisuGUI* theModule,
134 VISU::Prs3d_i* thePrs);
136 // Presentation management
137 void ChangeRepresentation (const SalomeApp_Module* theModule,
138 VISU::PresentationType theType);
140 void SetShading ( const SalomeApp_Module* theModule, bool theOn = true );
143 bool CheckTimeStamp(const SalomeApp_Module* theModule,
144 _PTR(SObject)& theSObject,
145 Handle(SALOME_InteractiveObject)& theIO,
146 ColoredPrs3d_i::EPublishInStudyMode& thePublishInStudyMode);
147 VISU::Result_i* CheckResult(const SalomeApp_Module* theModule,
148 _PTR(SObject) theSource,
149 VISU::Result_var& theResult);
150 bool IsSObjectTable(_PTR(SObject) theSObject);
152 /*! Display mesh presentation in given VTK view window
154 VISU_Actor* PublishMeshInView(const SalomeApp_Module* theModule,
155 VISU::Prs3d_i* thePrs,
156 SVTK_ViewWindow* theViewWindow);
159 * \brief Repaint all SVTK view windows, where the given object is displayed.
160 * \param theModule - is used to access application.
161 * \param theIObject - is supposed to be selected (is highlighted in this method).
163 void RepaintViewWindows(const SalomeApp_Module* theModule,
164 const Handle(SALOME_InteractiveObject)& theIObject);
166 VISU_Actor* FindActor(const SalomeApp_Study* theStudy,
167 SVTK_ViewWindow* theViewWindow,
168 const QString& theEntry);
169 void RecreateActor(const SalomeApp_Module* theModule,
170 VISU::Prs3d_i* thePrs);
173 * \brief Advanced FitAll, sets view projection in accordance with current view contents
175 * If common bounding box of all actors in \a theViewWindow has
176 * at least one small side, then corresponding projection will be set
177 * (Top, Left or Front), else 3D projection will be used.
179 * \param theViewWindow - the view to perform FitAll in.
181 void SetFitAll(SVTK_ViewWindow* theViewWindow);
184 SPlot2d_Viewer* GetPlot2dViewer(const SalomeApp_Module* theModule,
185 const bool theCreate = false);
186 void PlotTable( const SalomeApp_Module* theModule,
187 VISU::Table_i* table,
189 void PlotCurve( const SalomeApp_Module* theModule,
190 VISU::Curve_i* curve,
192 void PlotRemoveCurve(const SalomeApp_Module* theModule,
193 VISU::Curve_i* curve);
194 void PlotContainer( const SalomeApp_Module* theModule,
195 VISU::Container_i* container,
197 void CreatePlot( SalomeApp_Module* theModule,
198 _PTR(SObject) theSobj );
200 /*! Display/Erase/Update a curve presentation.
201 * Parameter \a frame may be NULL, in this case there is only update without display/erase
203 void UpdateCurve( VISU::Curve_i*,
204 Plot2d_ViewFrame* frame,
208 /*! Create mesh presentation and display it in \a theViewWindow.
209 * If \a theViewWindow is NULL, no displaying will be done.
211 void CreateMesh(VisuGUI* theModule,
212 const Handle(SALOME_InteractiveObject)& theIO,
213 SVTK_ViewWindow* theViewWindow);
216 std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
217 const Handle(SALOME_InteractiveObject)& theIO);
218 std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
219 _PTR(SObject) theObject);
221 int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow);
222 void AddScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
223 VISU::Prs3d_i* thePrs3d, int pos);
224 void RemoveScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
225 VISU::Prs3d_i* thePrs3d);