Version: 6.3.1

src/VISUGUI/VisuGUI_TimeAnimation.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  File   : VisuGUI_TimeAnimation.h
00024 //  Author : Vitaly SMETANNIKOV
00025 //  Module : VISU
00026 //
00027 #ifndef VISUGUI_TIMEANIMATION_H
00028 #define VISUGUI_TIMEANIMATION_H
00029 
00030 #include <SalomeApp_DoubleSpinBox.h>
00031 #include "SALOMEDSClient_Study.hxx"
00032 
00033 #include "VTKViewer.h"
00034 
00035 #include <QDialog>
00036 #include <QButtonGroup>
00037 #include <QStackedWidget>
00038 #include <QMap>
00039 
00040 // IDL headers
00041 #include "SALOMEconfig.h"
00042 #include CORBA_SERVER_HEADER(VISU_Gen)
00043 
00044 #include <vector>
00045 #include <map>
00046 
00047 class VisuGUI;
00048 class SalomeApp_Module;
00049 class SalomeApp_IntSpinBox;
00050 class VISU_TimeAnimation;
00051 
00052 namespace VISU
00053 {
00054   class Prs3d_i;
00055   class PointMap3d_i;
00056 }
00057 
00058 class SVTK_ViewWindow;
00059 
00060 class QLabel;
00061 class QSlider;
00062 class QListWidget;
00063 class QLineEdit;
00064 class QCheckBox;
00065 class QComboBox;
00066 class QGroupBox;
00067 class QToolButton;
00068 
00072 class ArrangeDlg: public QDialog
00073 {
00074   Q_OBJECT
00075  public:
00076   enum { AutoMode, ManualMode };
00077   enum { XAxis, YAxis, ZAxis };
00078 
00079   ArrangeDlg(QWidget* theParent,
00080              VISU_TimeAnimation* theAnimator);
00081 
00082   ArrangeDlg(QWidget* theParent,
00083              const SalomeApp_Module* theModule,
00084              SVTK_ViewWindow* theViewWindow);
00085 
00086   ~ArrangeDlg() {};
00087 
00088   int getMode() const { return  myStackWgt->indexOf(myStackWgt->currentWidget()); }
00089   double getDistance() const { return myDistVal->value(); }
00090   int getAxis() const { return myAxisGrp->id(myAxisGrp->checkedButton()); }
00091 
00092  protected slots:
00093   virtual void accept();
00094   void onFieldChange(int);
00095 
00096  private:
00097   struct Offset {
00098     vtkFloatingPointType myOffset[3];
00099   };
00100 
00101 
00102   void init();
00103   void acceptAnimation();
00104   void acceptViewWindow();
00105 
00106   VISU_TimeAnimation* myAnimator;
00107   SVTK_ViewWindow   * myViewWindow;
00108 
00109   QStackedWidget*     myStackWgt;
00110   QButtonGroup*       myAxisGrp;
00111   SalomeApp_DoubleSpinBox*    myDistVal;
00112   QListWidget*        myFieldLst;
00113   SalomeApp_DoubleSpinBox*    myCoord[3];
00114   QList<Offset>       myOffsets;
00115 
00116   QCheckBox*          mySaveChk;
00117 
00118   int               myCurrent;
00119   QMap<VISU::Prs3d_i*, int> myPrsMap;
00120   QMap<VISU::PointMap3d_i*, int> myPointMapPrsMap;
00121 };
00122 
00123 
00124 class SetupDlg : public QDialog
00125 {
00126   Q_OBJECT
00127 
00128  class LineEdit;
00129 
00130  public:
00131   SetupDlg( QWidget* theParent, VisuGUI* theModule,
00132             VISU_TimeAnimation* theAnimator );
00133   ~SetupDlg() {};
00134 
00135  public:
00136   void initialize();
00137 
00138   bool isRegenerate() const { return myIsRegenerate; }
00139   void setIsRegenerate( const bool on ) { myIsRegenerate = on; }
00140 
00141  private slots:
00142   void onClose();
00143   void onFieldChange(int theIndex);
00144   void onTypeChanged(int theIndex);
00145   //  void onScalarBarDlg();
00146   void onPreferencesDlg();
00147   void onRangeCheck(bool theCheck);
00148   //  void onMinValue(double theVal);
00149   //  void onMaxValue(double theVal);
00150   void onMinValue();
00151   void onMaxValue();
00152   void onMinValueEdit(const QString&);
00153   void onMaxValueEdit(const QString&);
00154   void onSequenceCheck(bool theCheck);
00155   void onIndicesChanged(const QString& theIndices);
00156   void onValuesChanged();
00157   void onArrangeDlg();
00158 
00159  private:
00160   VisuGUI* myModule;
00161   VISU_TimeAnimation* myAnimator;
00162 
00163   bool myIsRegenerate;
00164 
00165   QListWidget* myFieldLst;
00166   QComboBox* myTypeCombo;
00167   std::vector<int> myComboId2TypeId;
00168   std::map<int,int> myTypeId2ComboId;
00169 
00170   QPushButton* myPropBtn;
00171   QPushButton* myArrangeBtn;
00172   QGroupBox* myUseRangeBox;
00173   //  SalomeApp_DoubleSpinBox* myMinVal;
00174   //  SalomeApp_DoubleSpinBox* myMaxVal;
00175   QLineEdit* myMinVal;
00176   QLineEdit* myMaxVal;
00177 
00178   QGroupBox* myUseSequenceBox;
00179   QLineEdit* myIndices;
00180   QListWidget* myValues;
00181 };
00182 
00183 class VisuGUI_TimeAnimationDlg: public QDialog
00184 {
00185     Q_OBJECT
00186  public:
00187     VisuGUI_TimeAnimationDlg(VisuGUI* theModule,
00188                              _PTR(Study) theStudy,
00189                              VISU::Animation::AnimationMode theMode = VISU::Animation::PARALLEL);
00190     ~VisuGUI_TimeAnimationDlg();
00191 
00192     bool addField(_PTR(SObject) theField);
00193     void clearView();
00194 
00195     void restoreFromStudy(_PTR(SObject) theAnimation);
00196 
00197  protected:
00198     virtual void closeEvent(QCloseEvent* theEvent);
00199     virtual void showEvent(QShowEvent* theEvent);
00200     virtual void keyPressEvent(QKeyEvent* theEvent);
00201     void stopAnimation();
00202 
00203  private slots:
00204    void onTypeChange(int index);
00205    void onPlayPressed();
00206    void onBackPressed();
00207    void onForvardPressed();
00208    void onLastPressed();
00209    void onFirstPressed();
00210    void onSetupDlg();
00211    void onWindowChanged(int index);
00212    void createFrames();
00213    void onSpeedChange(double theSpeed);
00214    void onExecution(long theNewFrame, double theTime);
00215    void onBrowse();
00216    void onBrowseAVI();
00217    void onCheckDump(bool);
00218    void onStop();
00219    void onHelp();
00220    void saveToStudy();
00221    void publishToStudy();
00223    void onPicsFormatChanged();
00225    void onPathChanged();
00226 
00227  private:
00228     // Data
00229     VisuGUI* myModule;
00230     VISU_TimeAnimation* myAnimator;
00231 
00232     // widgets
00233     QSlider* mySlider;
00234     QComboBox* myTypeCombo;
00235     QPushButton* myPropBtn;
00236     QPushButton* myPlayBtn;
00237     QLabel* myTimeLbl;
00238     QPushButton* mySetupBtn;
00239     QPushButton* myGenBtn;
00240 
00241     QFrame* myPlayFrame;
00242     SetupDlg* mySetupDlg;
00243 
00244     QCheckBox* mySaveCheck;
00245     QComboBox* myPicsFormat;
00246     QLineEdit* myPathEdit;
00247 
00248     QCheckBox*   mySaveAVICheck;
00249     QLineEdit*   myPathAVIEdit;
00250     QLabel*      myPathAVILbl;
00251     QPushButton* myBrowseAVIBtn;
00252     QLabel*      myFrequencyLbl;
00253     SalomeApp_IntSpinBox* myFrequencySpin;
00254 
00255     QPushButton* myPublishBtn;
00256     QPushButton* mySaveBtn;
00257 };
00258 
00259 #endif  //VISUGUI_TIMEANIMATION_H
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS