]> SALOME platform Git repositories - modules/visu.git/blob - src/VISUGUI/VisuGUI_TimeAnimation.h
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / VISUGUI / VisuGUI_TimeAnimation.h
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
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. 
8 // 
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. 
13 // 
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 
17 // 
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //  File   : VisuGUI_TimeAnimation.h
21 //  Author : Vitaly SMETANNIKOV
22 //  Module : VISU
23
24 #ifndef VISUGUI_TIMEANIMATION_H
25 #define VISUGUI_TIMEANIMATION_H
26
27 #include "QtxDblSpinBox.h"
28 #include "SALOMEDSClient_Study.hxx"
29
30 #include "VTKViewer.h"
31
32 // IDL headers
33 #include "SALOMEconfig.h"
34 #include CORBA_SERVER_HEADER(VISU_Gen)
35
36 #include <qdialog.h>
37 #include <qbuttongroup.h>
38 #include <qwidgetstack.h>
39
40 #include <vector>
41 #include <map>
42
43 class VisuGUI;
44 class SalomeApp_Module;
45 class VISU_TimeAnimation;
46
47 namespace VISU 
48 {
49   class Prs3d_i;
50 }
51
52 class SVTK_ViewWindow;
53
54 class QtxDblSpinBox;
55
56 class QLabel;
57 class QSlider;
58 class QListBox;
59 class QLineEdit;
60 class QCheckBox;
61 class QComboBox;
62 class QGroupBox;
63 class QToolButton;
64
65 /*!
66  * Auxilliary class for presentations definition
67  */
68 class ArrangeDlg: public QDialog
69 {
70   Q_OBJECT
71  public:
72   enum { AutoMode, ManualMode };
73   enum { XAxis, YAxis, ZAxis };
74
75   ArrangeDlg(QWidget* theParent, 
76              VISU_TimeAnimation* theAnimator);
77
78   ArrangeDlg(QWidget* theParent, 
79              const SalomeApp_Module* theModule,
80              SVTK_ViewWindow* theViewWindow);
81
82   ~ArrangeDlg() {};
83
84   int getMode() const { return  myStackWgt->id(myStackWgt->visibleWidget()); }
85   double getDistance() const { return myDistVal->value(); }
86   int getAxis() const { return myAxisGrp->id(myAxisGrp->selected()); }
87
88  protected slots:
89   virtual void accept();
90   void onFieldChange(int);
91
92  private:
93   struct Offset {
94     vtkFloatingPointType myOffset[3];
95   };
96
97
98   void init();
99   void acceptAnimation();
100   void acceptViewWindow();
101
102   VISU_TimeAnimation* myAnimator;
103   SVTK_ViewWindow   * myViewWindow;
104
105   QWidgetStack*       myStackWgt;
106   QButtonGroup*       myAxisGrp;
107   QtxDblSpinBox*      myDistVal;
108   QListBox*           myFieldLst;
109   QtxDblSpinBox*      myCoord[3];
110   QValueList<Offset>  myOffsets;
111
112   QCheckBox*          mySaveChk;
113
114   int               myCurrent;
115   QMap<VISU::Prs3d_i*, int> myPrsMap;
116 };
117
118
119 class SetupDlg: public QDialog {
120   Q_OBJECT
121
122  public:
123   SetupDlg(QWidget* theParent,
124            VisuGUI* theModule, 
125            VISU_TimeAnimation* theAnimator);
126   ~SetupDlg() {};
127
128  public:
129   void initialize();
130
131   bool isRegenerate() const { return myIsRegenerate; }
132   void setIsRegenerate( const bool on ) { myIsRegenerate = on; }
133
134  private slots:
135   void onClose();
136   void onFieldChange(int theIndex);
137   void onTypeChanged(int theIndex);
138   //  void onScalarBarDlg();
139   void onPreferencesDlg();
140   void onRangeCheck(bool theCheck);
141   void onMinValue(double theVal);
142   void onMaxValue(double theVal);
143   void onSequenceCheck(bool theCheck);
144   void onIndicesChanged(const QString& theIndices);
145   void onValuesChanged();
146   void onArrangeDlg();
147
148  private:
149   VisuGUI* myModule;
150   VISU_TimeAnimation* myAnimator;
151
152   bool myIsRegenerate;
153
154   QListBox* myFieldLst;
155   QComboBox* myTypeCombo;
156   std::vector<int> myComboId2TypeId;
157   std::map<int,int> myTypeId2ComboId;
158
159   QPushButton* myPropBtn;
160   QPushButton* myArrangeBtn;
161
162   QGroupBox* myUseRangeBox;
163   QtxDblSpinBox* myMinVal;
164   QtxDblSpinBox* myMaxVal;
165
166   QGroupBox* myUseSequenceBox;
167   QLineEdit* myIndices;
168   QListBox* myValues;
169 };
170
171
172 class VisuGUI_TimeAnimationDlg: public QDialog
173 {
174     Q_OBJECT
175  public:
176     VisuGUI_TimeAnimationDlg(VisuGUI* theModule,
177                              _PTR(Study) theStudy, 
178                              VISU::Animation::AnimationMode theMode = VISU::Animation::PARALLEL);
179     ~VisuGUI_TimeAnimationDlg();
180
181     bool addField(_PTR(SObject) theField);
182     void clearView();
183
184     void restoreFromStudy(_PTR(SObject) theAnimation);
185
186  protected:
187     virtual void closeEvent(QCloseEvent* theEvent);
188     virtual void showEvent(QShowEvent* theEvent);
189     virtual void keyPressEvent(QKeyEvent* theEvent);
190     void stopAnimation();
191     
192  private slots:
193    void onTypeChange(int index);
194    void onPlayPressed();
195    void onBackPressed();
196    void onForvardPressed();
197    void onLastPressed();
198    void onFirstPressed();
199    void onSetupDlg();
200    void onWindowChanged(int index);
201    void createFrames();
202    void onSpeedChange(double theSpeed);
203    void onExecution(long theNewFrame, double theTime);
204    void onBrowse();
205    void onBrowseAVI();
206    void onCheckDump(bool);
207    void onStop();
208    void onHelp();
209    void saveToStudy();
210    void publishToStudy();
211    /*!Sets dump format for myAnimator (setDumpFormat(...)), from myPicsFormat.*/
212    void onPicsFormatChanged();
213    /*!Sets path for myAnimator (dumpTo(...)), from myPathEdit.*/
214    void onPathChanged();
215
216  private:
217     // Data
218     VisuGUI* myModule;
219     VISU_TimeAnimation* myAnimator;
220
221     // widgets
222     QSlider* mySlider;
223     QComboBox* myTypeCombo;
224     QPushButton* myPropBtn;
225     QToolButton* myPlayBtn;
226     QLabel* myTimeLbl;
227     QPushButton* mySetupBtn;
228     QPushButton* myGenBtn;
229
230     QFrame* myPlayFrame;
231     SetupDlg* mySetupDlg;
232
233     QCheckBox* mySaveCheck;
234     QComboBox* myPicsFormat;
235     QLineEdit* myPathEdit;
236
237     QCheckBox*   mySaveAVICheck;
238     QLineEdit*   myPathAVIEdit;
239     QLabel*      myPathAVILbl;
240     QPushButton* myBrowseAVIBtn;
241
242     QPushButton* myPublishBtn;
243     QPushButton* mySaveBtn;
244 };
245
246 #endif  //VISUGUI_TIMEANIMATION_H