]> SALOME platform Git repositories - modules/visu.git/blobdiff - src/VISUGUI/VisuGUI_TimeAnimation.h
Salome HOME
Merge from V5_1_main 14/05/2010
[modules/visu.git] / src / VISUGUI / VisuGUI_TimeAnimation.h
index 53191604996c1c1bcef7932a7b47877367954435..86be3c6cada4d2304981db70eb9c28c492f47cde 100644 (file)
@@ -1,40 +1,69 @@
-//  VISU VISUGUI : GUI of VISU component
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
 //
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
 //
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
 //  File   : VisuGUI_TimeAnimation.h
 //  Author : Vitaly SMETANNIKOV
 //  Module : VISU
-
+//
 #ifndef VISUGUI_TIMEANIMATION_H
 #define VISUGUI_TIMEANIMATION_H
 
-#include "QtxDblSpinBox.h"
-
+#include <SalomeApp_DoubleSpinBox.h>
 #include "SALOMEDSClient_Study.hxx"
 
-#include <qdialog.h>
-#include <qbuttongroup.h>
-#include <qwidgetstack.h>
+#include "VTKViewer.h"
+
+#include <QDialog>
+#include <QButtonGroup>
+#include <QStackedWidget>
+#include <QMap>
+
+// IDL headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(VISU_Gen)
+
+#include <vector>
+#include <map>
 
 class VisuGUI;
+class SalomeApp_Module;
+class SalomeApp_IntSpinBox;
 class VISU_TimeAnimation;
 
-namespace VISU {
+namespace VISU
+{
   class Prs3d_i;
+  class PointMap3d_i;
 }
 
 class SVTK_ViewWindow;
 
-class QtxDblSpinBox;
-
 class QLabel;
 class QSlider;
-class QListBox;
+class QListWidget;
+class QLineEdit;
 class QCheckBox;
 class QComboBox;
+class QGroupBox;
 class QToolButton;
 
 /*!
@@ -47,13 +76,18 @@ class ArrangeDlg: public QDialog
   enum { AutoMode, ManualMode };
   enum { XAxis, YAxis, ZAxis };
 
-  ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator);
-  ArrangeDlg(QWidget* theParent, SVTK_ViewWindow* theViewWindow);
+  ArrangeDlg(QWidget* theParent,
+             VISU_TimeAnimation* theAnimator);
+
+  ArrangeDlg(QWidget* theParent,
+             const SalomeApp_Module* theModule,
+             SVTK_ViewWindow* theViewWindow);
+
   ~ArrangeDlg() {};
 
-  int getMode() const { return  myStackWgt->id(myStackWgt->visibleWidget()); }
+  int getMode() const { return  myStackWgt->indexOf(myStackWgt->currentWidget()); }
   double getDistance() const { return myDistVal->value(); }
-  int getAxis() const { return myAxisGrp->id(myAxisGrp->selected()); }
+  int getAxis() const { return myAxisGrp->id(myAxisGrp->checkedButton()); }
 
  protected slots:
   virtual void accept();
@@ -61,7 +95,7 @@ class ArrangeDlg: public QDialog
 
  private:
   struct Offset {
-    float myOffset[3];
+    vtkFloatingPointType myOffset[3];
   };
 
 
@@ -72,64 +106,90 @@ class ArrangeDlg: public QDialog
   VISU_TimeAnimation* myAnimator;
   SVTK_ViewWindow   * myViewWindow;
 
-  QWidgetStack*       myStackWgt;
+  QStackedWidget*     myStackWgt;
   QButtonGroup*       myAxisGrp;
-  QtxDblSpinBox*      myDistVal;
-  QListBox*           myFieldLst;
-  QtxDblSpinBox*      myCoord[3];
-  QValueList<Offset>  myOffsets;
+  SalomeApp_DoubleSpinBox*    myDistVal;
+  QListWidget*        myFieldLst;
+  SalomeApp_DoubleSpinBox*    myCoord[3];
+  QList<Offset>       myOffsets;
 
   QCheckBox*          mySaveChk;
 
   int               myCurrent;
   QMap<VISU::Prs3d_i*, int> myPrsMap;
+  QMap<VISU::PointMap3d_i*, int> myPointMapPrsMap;
 };
 
 
-class SetupDlg: public QDialog {
+class SetupDlg : public QDialog
+{
   Q_OBJECT
 
+ class LineEdit;
+
  public:
-  SetupDlg(QWidget* theParent,
-          VisuGUI* theModule, 
-          VISU_TimeAnimation* theAnimator);
+  SetupDlg( QWidget* theParent, VisuGUI* theModule,
+            VISU_TimeAnimation* theAnimator );
   ~SetupDlg() {};
 
+ public:
+  void initialize();
+
+  bool isRegenerate() const { return myIsRegenerate; }
+  void setIsRegenerate( const bool on ) { myIsRegenerate = on; }
+
  private slots:
+  void onClose();
   void onFieldChange(int theIndex);
   void onTypeChanged(int theIndex);
   //  void onScalarBarDlg();
   void onPreferencesDlg();
   void onRangeCheck(bool theCheck);
-  void onMinValue(double theVal);
-  void onMaxValue(double theVal);
+  //  void onMinValue(double theVal);
+  //  void onMaxValue(double theVal);
+  void onMinValue();
+  void onMaxValue();
+  void onMinValueEdit(const QString&);
+  void onMaxValueEdit(const QString&);
+  void onSequenceCheck(bool theCheck);
+  void onIndicesChanged(const QString& theIndices);
+  void onValuesChanged();
   void onArrangeDlg();
 
  private:
   VisuGUI* myModule;
   VISU_TimeAnimation* myAnimator;
 
-  QListBox* myFieldLst;
+  bool myIsRegenerate;
+
+  QListWidget* myFieldLst;
   QComboBox* myTypeCombo;
   std::vector<int> myComboId2TypeId;
   std::map<int,int> myTypeId2ComboId;
 
   QPushButton* myPropBtn;
   QPushButton* myArrangeBtn;
-  QCheckBox* myUseRangeChk;
-  QtxDblSpinBox* myMinVal;
-  QtxDblSpinBox* myMaxVal;
+  QGroupBox* myUseRangeBox;
+  //  SalomeApp_DoubleSpinBox* myMinVal;
+  //  SalomeApp_DoubleSpinBox* myMaxVal;
+  QLineEdit* myMinVal;
+  QLineEdit* myMaxVal;
+
+  QGroupBox* myUseSequenceBox;
+  QLineEdit* myIndices;
+  QListWidget* myValues;
 };
 
-
 class VisuGUI_TimeAnimationDlg: public QDialog
 {
     Q_OBJECT
  public:
-    VisuGUI_TimeAnimationDlg(VisuGUI* theModule, _PTR(Study) theStudy);
+    VisuGUI_TimeAnimationDlg(VisuGUI* theModule,
+                             _PTR(Study) theStudy,
+                             VISU::Animation::AnimationMode theMode = VISU::Animation::PARALLEL);
     ~VisuGUI_TimeAnimationDlg();
 
-    void addField(_PTR(SObject) theField);
+    bool addField(_PTR(SObject) theField);
     void clearView();
 
     void restoreFromStudy(_PTR(SObject) theAnimation);
@@ -137,6 +197,7 @@ class VisuGUI_TimeAnimationDlg: public QDialog
  protected:
     virtual void closeEvent(QCloseEvent* theEvent);
     virtual void showEvent(QShowEvent* theEvent);
+    virtual void keyPressEvent(QKeyEvent* theEvent);
     void stopAnimation();
 
  private slots:
@@ -152,30 +213,44 @@ class VisuGUI_TimeAnimationDlg: public QDialog
    void onSpeedChange(double theSpeed);
    void onExecution(long theNewFrame, double theTime);
    void onBrowse();
+   void onBrowseAVI();
+   void onCheckDump(bool);
    void onStop();
+   void onHelp();
    void saveToStudy();
    void publishToStudy();
+   /*!Sets dump format for myAnimator (setDumpFormat(...)), from myPicsFormat.*/
+   void onPicsFormatChanged();
+   /*!Sets path for myAnimator (dumpTo(...)), from myPathEdit.*/
+   void onPathChanged();
 
  private:
+    // Data
+    VisuGUI* myModule;
+    VISU_TimeAnimation* myAnimator;
+
+    // widgets
     QSlider* mySlider;
     QComboBox* myTypeCombo;
     QPushButton* myPropBtn;
-    QToolButton* myPlayBtn;
+    QPushButton* myPlayBtn;
     QLabel* myTimeLbl;
     QPushButton* mySetupBtn;
     QPushButton* myGenBtn;
 
     QFrame* myPlayFrame;
     SetupDlg* mySetupDlg;
-    _PTR(Study) myStudy;
-    VisuGUI* myModule;
 
-    VISU_TimeAnimation* myAnimator;
     QCheckBox* mySaveCheck;
     QComboBox* myPicsFormat;
     QLineEdit* myPathEdit;
-    bool isClosing;
-    QCloseEvent* myEvent;
+
+    QCheckBox*   mySaveAVICheck;
+    QLineEdit*   myPathAVIEdit;
+    QLabel*      myPathAVILbl;
+    QPushButton* myBrowseAVIBtn;
+    QLabel*      myFrequencyLbl;
+    SalomeApp_IntSpinBox* myFrequencySpin;
 
     QPushButton* myPublishBtn;
     QPushButton* mySaveBtn;