1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : VisuGUI_TimeAnimation.h
21 // Author : Vitaly SMETANNIKOV
24 #ifndef VISUGUI_TIMEANIMATION_H
25 #define VISUGUI_TIMEANIMATION_H
27 #include "QtxDblSpinBox.h"
28 #include "SALOMEDSClient_Study.hxx"
30 #include "VTKViewer.h"
33 #include "SALOMEconfig.h"
34 #include CORBA_SERVER_HEADER(VISU_Gen)
37 #include <qbuttongroup.h>
38 #include <qwidgetstack.h>
44 class SalomeApp_Module;
45 class VISU_TimeAnimation;
52 class SVTK_ViewWindow;
66 * Auxilliary class for presentations definition
68 class ArrangeDlg: public QDialog
72 enum { AutoMode, ManualMode };
73 enum { XAxis, YAxis, ZAxis };
75 ArrangeDlg(QWidget* theParent,
76 VISU_TimeAnimation* theAnimator);
78 ArrangeDlg(QWidget* theParent,
79 const SalomeApp_Module* theModule,
80 SVTK_ViewWindow* theViewWindow);
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()); }
89 virtual void accept();
90 void onFieldChange(int);
94 vtkFloatingPointType myOffset[3];
99 void acceptAnimation();
100 void acceptViewWindow();
102 VISU_TimeAnimation* myAnimator;
103 SVTK_ViewWindow * myViewWindow;
105 QWidgetStack* myStackWgt;
106 QButtonGroup* myAxisGrp;
107 QtxDblSpinBox* myDistVal;
108 QListBox* myFieldLst;
109 QtxDblSpinBox* myCoord[3];
110 QValueList<Offset> myOffsets;
112 QCheckBox* mySaveChk;
115 QMap<VISU::Prs3d_i*, int> myPrsMap;
119 class SetupDlg: public QDialog {
123 SetupDlg(QWidget* theParent,
125 VISU_TimeAnimation* theAnimator);
131 bool isRegenerate() const { return myIsRegenerate; }
132 void setIsRegenerate( const bool on ) { myIsRegenerate = on; }
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();
150 VISU_TimeAnimation* myAnimator;
154 QListBox* myFieldLst;
155 QComboBox* myTypeCombo;
156 std::vector<int> myComboId2TypeId;
157 std::map<int,int> myTypeId2ComboId;
159 QPushButton* myPropBtn;
160 QPushButton* myArrangeBtn;
162 QGroupBox* myUseRangeBox;
163 QtxDblSpinBox* myMinVal;
164 QtxDblSpinBox* myMaxVal;
166 QGroupBox* myUseSequenceBox;
167 QLineEdit* myIndices;
172 class VisuGUI_TimeAnimationDlg: public QDialog
176 VisuGUI_TimeAnimationDlg(VisuGUI* theModule,
177 _PTR(Study) theStudy,
178 VISU::Animation::AnimationMode theMode = VISU::Animation::PARALLEL);
179 ~VisuGUI_TimeAnimationDlg();
181 bool addField(_PTR(SObject) theField);
184 void restoreFromStudy(_PTR(SObject) theAnimation);
187 virtual void closeEvent(QCloseEvent* theEvent);
188 virtual void showEvent(QShowEvent* theEvent);
189 virtual void keyPressEvent(QKeyEvent* theEvent);
190 void stopAnimation();
193 void onTypeChange(int index);
194 void onPlayPressed();
195 void onBackPressed();
196 void onForvardPressed();
197 void onLastPressed();
198 void onFirstPressed();
200 void onWindowChanged(int index);
202 void onSpeedChange(double theSpeed);
203 void onExecution(long theNewFrame, double theTime);
206 void onCheckDump(bool);
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();
219 VISU_TimeAnimation* myAnimator;
223 QComboBox* myTypeCombo;
224 QPushButton* myPropBtn;
225 QToolButton* myPlayBtn;
227 QPushButton* mySetupBtn;
228 QPushButton* myGenBtn;
231 SetupDlg* mySetupDlg;
233 QCheckBox* mySaveCheck;
234 QComboBox* myPicsFormat;
235 QLineEdit* myPathEdit;
237 QCheckBox* mySaveAVICheck;
238 QLineEdit* myPathAVIEdit;
239 QLabel* myPathAVILbl;
240 QPushButton* myBrowseAVIBtn;
242 QPushButton* myPublishBtn;
243 QPushButton* mySaveBtn;
246 #endif //VISUGUI_TIMEANIMATION_H