]> SALOME platform Git repositories - modules/visu.git/blob - src/VISUGUI/VisuGUI_TimeAnimation.h
Salome HOME
Merge with branch V2_2_0_VISU_improvement
[modules/visu.git] / src / VISUGUI / VisuGUI_TimeAnimation.h
1 //  VISU VISUGUI : GUI of VISU component
2 //
3 //  Copyright (C) 2003  CEA/DEN, EDF R&D
4 //
5 //
6 //
7 //  File   : VisuGUI_TimeAnimation.h
8 //  Author : Vitaly SMETANNIKOV
9 //  Module : VISU
10
11 #ifndef VISUGUI_TIMEANIMATION_H
12 #define VISUGUI_TIMEANIMATION_H
13
14 #include "QtxDblSpinBox.h"
15
16 #include "SALOMEDSClient_Study.hxx"
17
18 #include "SALOMEconfig.h"
19 #include CORBA_SERVER_HEADER(SALOMEDS)
20
21 #include <qdialog.h>
22 #include <qbuttongroup.h> 
23 #include <qwidgetstack.h> 
24
25 class VisuGUI;
26 class VISU_TimeAnimation;
27
28 namespace VISU {
29   class Prs3d_i;
30 }
31
32 class SVTK_ViewWindow;
33
34 class QtxDblSpinBox;
35
36 class QLabel;
37 class QSlider;
38 class QListBox;
39 class QCheckBox;
40 class QComboBox;
41 class QToolButton;
42
43 /*!
44  * Auxilliary class for presentations definition
45  */
46 class ArrangeDlg: public QDialog
47 {
48   Q_OBJECT
49  public:
50   enum { AutoMode, ManualMode };
51   enum { XAxis, YAxis, ZAxis };
52
53   ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator);
54   ArrangeDlg(QWidget* theParent, SVTK_ViewWindow* theViewWindow);
55   ~ArrangeDlg() {};
56
57   int getMode() const { return  myStackWgt->id(myStackWgt->visibleWidget()); }
58   double getDistance() const { return myDistVal->value(); }
59   int getAxis() const { return myAxisGrp->id(myAxisGrp->selected()); }
60
61  protected slots:
62   virtual void accept();
63   void onFieldChange(int);
64
65  private:
66   struct Offset {
67     float myOffset[3];
68   };
69
70
71   void init();
72   void acceptAnimation();
73   void acceptViewWindow();
74
75   VISU_TimeAnimation* myAnimator;
76   SVTK_ViewWindow   * myViewWindow;
77
78   QWidgetStack*       myStackWgt;
79   QButtonGroup*       myAxisGrp;
80   QtxDblSpinBox*      myDistVal;
81   QListBox*           myFieldLst;
82   QtxDblSpinBox*      myCoord[3];
83   QValueList<Offset>  myOffsets;
84
85   QCheckBox*          mySaveChk;
86
87   int               myCurrent;
88   QMap<VISU::Prs3d_i*, int> myPrsMap;
89 };
90
91
92 class SetupDlg: public QDialog {
93   Q_OBJECT
94
95  public:
96   SetupDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator);
97   ~SetupDlg() {};
98   
99  private slots:
100   void onFieldChange(int theIndex);
101   void onTypeChanged(int theIndex); 
102   //  void onScalarBarDlg();
103   void onPreferencesDlg();
104   void onRangeCheck(bool theCheck);
105   void onMinValue(double theVal);
106   void onMaxValue(double theVal);
107   void onArrangeDlg();
108
109  private:
110   VISU_TimeAnimation* myAnimator;
111   QListBox* myFieldLst;
112   QComboBox* myTypeCombo;
113   QPushButton* myPropBtn;
114   QPushButton* myArrangeBtn;
115   QCheckBox* myUseRangeChk;
116   QtxDblSpinBox* myMinVal;
117   QtxDblSpinBox* myMaxVal;
118 };
119
120
121 class VisuGUI_TimeAnimationDlg: public QDialog
122
123     Q_OBJECT
124  public:
125     //VisuGUI_TimeAnimationDlg(QWidget* parent, _PTR(Study) theStudy);
126     VisuGUI_TimeAnimationDlg(VisuGUI* theModule, _PTR(Study) theStudy);
127     ~VisuGUI_TimeAnimationDlg();
128
129     void addField(_PTR(SObject) theField);
130     void clearView();
131
132     void restoreFromStudy(SALOMEDS::SObject_var theAnimation);
133
134  protected:
135     virtual void closeEvent(QCloseEvent* theEvent);
136     void stopAnimation();
137
138  private slots:
139    void onTypeChange(int index);
140    void onPlayPressed();
141    void onBackPressed();
142    void onForvardPressed();
143    void onLastPressed();
144    void onFirstPressed();
145    void onSetupDlg();
146    void onWindowChanged(int index);
147    void createFrames();
148    void onSpeedChange(double theSpeed);
149    void onExecution(long theNewFrame, double theTime);
150    void onBrowse();
151    void onStop();
152    void saveToStudy();
153    void publishToStudy();
154
155  private:
156     QSlider* mySlider;
157     QComboBox* myTypeCombo;
158     QPushButton* myPropBtn;
159     QToolButton* myPlayBtn;
160     QLabel* myTimeLbl;
161     QPushButton* mySetupBtn;
162     QPushButton* myGenBtn;
163
164     QFrame* myPlayFrame;
165     _PTR(Study) myStudy;
166     VisuGUI* myModule;
167
168     VISU_TimeAnimation* myAnimator;
169     QCheckBox* mySaveCheck;
170     QLineEdit* myPathEdit;
171     bool isClosing;
172     QCloseEvent* myEvent;
173
174     QPushButton* myPublishBtn;
175     QPushButton* mySaveBtn;
176 };
177
178 #endif  //VISUGUI_TIMEANIMATION_H