1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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
23 // File : VisuGUI_TimeAnimation.h
24 // Author : Vitaly SMETANNIKOV
27 #ifndef VISUGUI_TIMEANIMATION_H
28 #define VISUGUI_TIMEANIMATION_H
30 #include <SalomeApp_DoubleSpinBox.h>
31 #include "SALOMEDSClient_Study.hxx"
33 #include "VTKViewer.h"
36 #include <QButtonGroup>
37 #include <QStackedWidget>
41 #include "SALOMEconfig.h"
42 #include CORBA_SERVER_HEADER(VISU_Gen)
48 class SalomeApp_Module;
49 class SalomeApp_IntSpinBox;
50 class VISU_TimeAnimation;
58 class SVTK_ViewWindow;
70 * Auxilliary class for presentations definition
72 class ArrangeDlg: public QDialog
76 enum { AutoMode, ManualMode };
77 enum { XAxis, YAxis, ZAxis };
79 ArrangeDlg(QWidget* theParent,
80 VISU_TimeAnimation* theAnimator);
82 ArrangeDlg(QWidget* theParent,
83 const SalomeApp_Module* theModule,
84 SVTK_ViewWindow* theViewWindow);
88 int getMode() const { return myStackWgt->indexOf(myStackWgt->currentWidget()); }
89 double getDistance() const { return myDistVal->value(); }
90 int getAxis() const { return myAxisGrp->id(myAxisGrp->checkedButton()); }
93 virtual void accept();
94 void onFieldChange(int);
98 vtkFloatingPointType myOffset[3];
103 void acceptAnimation();
104 void acceptViewWindow();
106 VISU_TimeAnimation* myAnimator;
107 SVTK_ViewWindow * myViewWindow;
109 QStackedWidget* myStackWgt;
110 QButtonGroup* myAxisGrp;
111 SalomeApp_DoubleSpinBox* myDistVal;
112 QListWidget* myFieldLst;
113 SalomeApp_DoubleSpinBox* myCoord[3];
114 QList<Offset> myOffsets;
116 QCheckBox* mySaveChk;
119 QMap<VISU::Prs3d_i*, int> myPrsMap;
120 QMap<VISU::PointMap3d_i*, int> myPointMapPrsMap;
124 class SetupDlg : public QDialog
131 SetupDlg( QWidget* theParent, VisuGUI* theModule,
132 VISU_TimeAnimation* theAnimator );
138 bool isRegenerate() const { return myIsRegenerate; }
139 void setIsRegenerate( const bool on ) { myIsRegenerate = on; }
143 void onFieldChange(int theIndex);
144 void onTypeChanged(int theIndex);
145 // void onScalarBarDlg();
146 void onPreferencesDlg();
147 void onRangeCheck(bool theCheck);
148 // void onMinValue(double theVal);
149 // void onMaxValue(double theVal);
152 void onMinValueEdit(const QString&);
153 void onMaxValueEdit(const QString&);
154 void onSequenceCheck(bool theCheck);
155 void onIndicesChanged(const QString& theIndices);
156 void onValuesChanged();
161 VISU_TimeAnimation* myAnimator;
165 QListWidget* myFieldLst;
166 QComboBox* myTypeCombo;
167 std::vector<int> myComboId2TypeId;
168 std::map<int,int> myTypeId2ComboId;
170 QPushButton* myPropBtn;
171 QPushButton* myArrangeBtn;
172 QGroupBox* myUseRangeBox;
173 // SalomeApp_DoubleSpinBox* myMinVal;
174 // SalomeApp_DoubleSpinBox* myMaxVal;
178 QGroupBox* myUseSequenceBox;
179 QLineEdit* myIndices;
180 QListWidget* myValues;
183 class VisuGUI_TimeAnimationDlg: public QDialog
187 VisuGUI_TimeAnimationDlg(VisuGUI* theModule,
188 _PTR(Study) theStudy,
189 VISU::Animation::AnimationMode theMode = VISU::Animation::PARALLEL);
190 ~VisuGUI_TimeAnimationDlg();
192 bool addField(_PTR(SObject) theField);
195 void restoreFromStudy(_PTR(SObject) theAnimation);
198 virtual void closeEvent(QCloseEvent* theEvent);
199 virtual void showEvent(QShowEvent* theEvent);
200 virtual void keyPressEvent(QKeyEvent* theEvent);
201 void stopAnimation();
204 void onTypeChange(int index);
205 void onPlayPressed();
206 void onBackPressed();
207 void onForvardPressed();
208 void onLastPressed();
209 void onFirstPressed();
211 void onWindowChanged(int index);
213 void onSpeedChange(double theSpeed);
214 void onExecution(long theNewFrame, double theTime);
217 void onCheckDump(bool);
221 void publishToStudy();
222 /*!Sets dump format for myAnimator (setDumpFormat(...)), from myPicsFormat.*/
223 void onPicsFormatChanged();
224 /*!Sets path for myAnimator (dumpTo(...)), from myPathEdit.*/
225 void onPathChanged();
230 VISU_TimeAnimation* myAnimator;
234 QComboBox* myTypeCombo;
235 QPushButton* myPropBtn;
236 QPushButton* myPlayBtn;
238 QPushButton* mySetupBtn;
239 QPushButton* myGenBtn;
242 SetupDlg* mySetupDlg;
244 QCheckBox* mySaveCheck;
245 QComboBox* myPicsFormat;
246 QLineEdit* myPathEdit;
248 QCheckBox* mySaveAVICheck;
249 QLineEdit* myPathAVIEdit;
250 QLabel* myPathAVILbl;
251 QPushButton* myBrowseAVIBtn;
252 QLabel* myFrequencyLbl;
253 SalomeApp_IntSpinBox* myFrequencySpin;
255 QPushButton* myPublishBtn;
256 QPushButton* mySaveBtn;
259 #endif //VISUGUI_TIMEANIMATION_H