Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/visu.git] / src / VISUGUI / VisuGUI.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  VISU VISUGUI : GUI of VISU component
23 //  File   : VisuGUI.h
24 //  Author : Laurent CORNABE & Hubert ROLLAND
25 //  Module : VISU
26
27 #ifndef VisuGUI_HeaderFile
28 #define VisuGUI_HeaderFile
29
30 #include <SalomeApp_Module.h>
31
32 #include <SVTK_ViewWindow.h>
33 #include <VISU_Prs3d_i.hh>
34
35 #include "VisuGUI_Panel.h"
36
37 #include <map>
38 #include <set>
39
40 class SUIT_ViewManager;
41 class VisuGUI_Slider;
42 class VisuGUI_Sweep;
43
44 namespace VISU
45 {
46   class Prs3d_i;
47   typedef std::pair<Prs3d_i*,int> TPrs3dToInd; // prs pointer and default index of scalar bar placement
48   typedef std::set<TPrs3dToInd> TSetPrs3d;
49   typedef std::map<SVTK_ViewWindow*,TSetPrs3d> TViewToPrs3d;
50 }
51
52 class VisuGUI: public SalomeApp_Module
53 {
54   Q_OBJECT;
55
56 public:
57   enum PanelId { SelectionPanelId = 0,
58                  FeatureEdgesPanelId,
59                  ClippingPlanesPanelId };
60
61 public:
62   VisuGUI();
63   virtual ~VisuGUI();
64
65   virtual LightApp_Displayer*    displayer();
66   virtual void initialize( CAM_Application* );
67   virtual void windows( QMap<int, int>& ) const;
68   virtual void viewManagers( QStringList& ) const;
69
70   virtual QString engineIOR() const;
71
72   virtual void  studyActivated();
73
74   virtual void  contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle );
75
76   virtual void createPreferences();
77   virtual void preferencesChanged( const QString&, const QString& );
78
79   virtual
80   SUIT_ViewManager*
81   getViewManager(const QString& theType, 
82                  const bool theIsCreate);
83
84   VISU::TViewToPrs3d&
85   getScalarBarsMap();
86
87 signals:
88   void moduleDeactivated();
89   void moduleActivated();
90   void presentationCreated(VISU::Prs3d_i* thePrs);
91   void beforeObjectDelete(QString theEntry);
92
93 public slots:
94   virtual bool deactivateModule( SUIT_Study* );
95   virtual bool activateModule( SUIT_Study* );
96   virtual void OnEraseAll();
97
98 protected slots:
99   void OnImportFromFile();
100   void OnImportTableFromFile();
101   void OnExportTableToFile();
102   void OnImportMedField();
103
104   void OnLoadComponentData();
105
106   void OnCreateMesh();
107   void OnCreateScalarMap();
108   void OnCreateDeformedShape();
109   void OnCreateVectors();
110   void OnCreateIsoSurfaces();
111   void OnCreateCutPlanes();
112   void OnCreateCutLines();
113   void OnCreateStreamLines();
114   void OnCreatePlot3D();
115   void OnCreateManyMesh();
116   void OnCreatePlot2dView();
117   void OnCreateDeformedShapeAndScalarMap();
118
119   void OnEditScalarMap();
120   void OnEditDeformedShape();
121   void OnEditCutPlanes();
122   void OnEditCutLines();
123   void OnEditIsoSurfaces();
124   void OnEditVectors();
125   void OnEditStreamLines();
126   void OnEditPlot3D();
127   void OnEditDeformedShapeAndScalarMap();
128
129   virtual void OnDisplayPrs();
130   virtual void OnDisplayOnlyPrs();
131   virtual void OnErasePrs();
132   //  virtual void OnEraseAll();
133
134   void OnToggleSelectionPanel();
135   void OnSwitchSelectionMode();
136   void OnSwitchSelectionMode( int );
137
138   void OnMakeSurfaceframe();
139   void OnMakeInsideframe();
140   void OnMakeWireframe();
141   void OnMakeSurface();
142   void OnMakePoints();
143   void OnMakeShrink();
144
145   void OnMakeFeatureEdges();
146
147   void OnSetShadingOn();
148   void OnSetShadingOff();
149
150   void OnChangeColor();
151   void OnChangeWireframeColor();
152   void OnChangeOpacity();
153   void OnChangeLines();
154
155   void OnShowTable();
156   void OnShowTablePlot();
157   void OnShowScalarBar();
158   void OnHideScalarBar();
159   void OnCreateTable();
160   void OnDeleteObjects();
161   void OnPlotData();
162   void OnCurveProperties();
163   void OnClearContainer();
164   void OnEditContainer();
165
166   void OnMergeScalarBars();
167   void OnFreeScalarBars();
168
169   virtual void OnSaveViewParams();
170   virtual void OnRestoreViewParams();
171
172   void OnRename();
173   void OnClippingPlanes();
174   void OnSweep();
175   void OnParallelTimeAnimation();
176   void OnSucccessiveTimeAnimation();
177   void OnShowAnimation();
178
179   void OnCopyPresentation();
180
181   void OnTranslatePrs();
182   void OnArrangeActors();
183   void OnPlot3dFromCutPlane();
184
185   void OnManageCache();
186
187   void OnFilterScalars();
188   
189   void OnValuesLabeling();
190   void OnValuesLabelingParams();
191
192   // MULTIPR
193   void OnMultiprViewFullRes();
194   void OnMultiprViewMediumRes();
195   void OnMultiprViewLowRes();
196   void OnMultiprViewHide();
197   void OnMultiprChangeRes(VISU::Result::Resolution theResolution);
198
199   void OnFileInfo();
200   void OnExportMED();
201
202 protected:
203   virtual LightApp_Selection* createSelection() const;
204
205   void OnTimeAnimation(VISU::Animation::AnimationMode theMode);
206
207 private:
208   void createActions();
209   void createMenus();
210   void createToolBars();
211   void createPopupMenus();
212   void createPanels();
213   void SetScalarBarVisibility( bool );
214   void activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO );
215   int  addVtkFontPref( const QString& label, const int pId, const QString& param, const bool useSize );
216
217 private:
218   QMap< PanelId, VisuGUI_Panel* > myPanels;
219   VisuGUI_Slider*         mySlider;
220   VisuGUI_Sweep*          mySweep; 
221
222   LightApp_Displayer*     myDisplayer;
223   VISU::TViewToPrs3d      myScalarBarsMap;
224 };
225
226 #endif