Salome HOME
Roll-back previous integration
[modules/visu.git] / src / VISU_I / VISU_TimeAnimation.h
index 87f08e6ebb45b49e62f7e2f28e9d8de0abc46ff9..0331f2f773b52e8bd94c2f763a7c31aa44330f74 100644 (file)
@@ -1,48 +1,60 @@
-//  File      : VISU_TimeAnimation.h
-//  Created   : 10 / 04 / 2003
-//  Author    : Vitaly SMETANNIKOV
-//  Project   : SALOME 
-//  Module    : VISU_I
-//  Copyright : Open CASCADE 
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : VISU_TimeAnimation.h
+//  Author : Vitaly SMETANNIKOV
+//  Module : VISU
 
 #ifndef VISU_TIMEANIMATION_H
 #define VISU_TIMEANIMATION_H
 
+#include "VISUConfig.hh"
+
+class VTKViewer_ViewFrame;
+class VISU_Actor;
+
 #include <qobject.h>
 #include <qvaluelist.h>
 #include <qthread.h>
-#include "VISU_Actor.h"
-#include "VISU_PrsObject_i.hh"
-#include "VTKViewer_ViewFrame.h"
 
+namespace VISU{
+  class Result_i;
+  class ScalarMap_i;
+}
 
 struct FieldData
 {
   VISU::VISUType myPrsType;  
   SALOMEDS::SObject_var myField; // field label
   long myNbTimes;                // number of Timestamps
+  long myNbFrames;               // number of created Frames
   VISU::ScalarMap_i** myPrs;         // Presentations
   VISU_Actor** myActors;         // Actors
   double* myTiming;              // time values
 };
 
 
-class VISU_TimeAnimation: public QObject, public QThread
+class VISU_TimeAnimation: public QObject, public QThread,
+                          public virtual POA_VISU::Animation,
+                          public virtual VISU::Base_i
 {
-    Q_OBJECT
+  Q_OBJECT;
  public:
   static VISU::Result_i* createPresent(SALOMEDS::SObject_var theField);
   static VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject);
   static double getTimeValue(SALOMEDS::SObject_var theTimestamp);
   
-  VISU_TimeAnimation(SALOMEDS::Study_var theStudy);
+  VISU_TimeAnimation(SALOMEDS::Study_var theStudy, VISU::View3D_ptr theView3D = VISU::View3D::_nil());
   ~VISU_TimeAnimation();
-
-  void addField(SALOMEDS::SObject_var theField);
+  
+  virtual VISU::VISUType GetType() { return VISU::TNONE;};
+  
+  void addField(SALOMEDS::SObject_ptr theField);
   FieldData& getFieldData(int theNum) { return myFieldsLst[theNum]; }
 
-  bool generateFrames();
-  void generatePresentations(int theFieldNum);
+  CORBA::Boolean generateFrames();
+  void generatePresentations(CORBA::Long theFieldNum);
   void setViewer(VTKViewer_ViewFrame* theView) { myView = theView; }
   VTKViewer_ViewFrame* getViewer() { return myView; }
   void clearView();
@@ -54,51 +66,66 @@ class VISU_TimeAnimation: public QObject, public QThread
   void prevFrame();
   void firstFrame();
   void lastFrame();
-  void gotoFrame(long theFrame);
+  void gotoFrame(CORBA::Long theFrame);
 
-  int getNbFields() { return myFieldsLst.size(); }
-  long getNbFrames();
-  bool isRunning() { return myIsActive; }
-  long getCurrentFrame() { return myFrame; }
+  CORBA::Long getNbFields() { return myFieldsLst.size(); }
+  CORBA::Long getNbFrames();
+  CORBA::Boolean isRunning() { return myIsActive; }
+  CORBA::Long getCurrentFrame() { return myFrame; }
 
-  VISU::ScalarMap_i* getPresentation(int theField, long theFrame);
+  VISU::ScalarMap_ptr getPresentation(CORBA::Long theField, CORBA::Long theFrame);
 
-  void setPresentationType(int theFieldNum, VISU::VISUType theType) { myFieldsLst[theFieldNum].myPrsType = theType; }
-  VISU::VISUType getPresentationType(int theFieldNum) { return myFieldsLst[theFieldNum].myPrsType; }
+  void setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType) { myFieldsLst[theFieldNum].myPrsType = theType; }
+  VISU::VISUType getPresentationType(CORBA::Long theFieldNum) { return myFieldsLst[theFieldNum].myPrsType; }
 
-  void setSpeed(int theSpeed);
-  int getSpeed() { return mySpeed; }
+  void setSpeed(CORBA::Long theSpeed);
+  CORBA::Long getSpeed() { return mySpeed; }
 
-  bool isProportional() { return myProportional; }
+  CORBA::Boolean isProportional() { return myProportional; }
 
-  void setAnimationRange(double theMin, double theMax)
+  void setAnimationRange(CORBA::Double theMin, CORBA::Double theMax)
     { myMaxVal = theMax; myMinVal = theMin; }
 
-  double getMinRange() { return myMinVal; }
-  double getMaxRange() { return myMaxVal; } 
-  bool isRangeDefined() { return ((myMaxVal!=0) && (myMinVal != 0)); }
+  CORBA::Double getMinRange() { return myMinVal; }
+  CORBA::Double getMaxRange() { return myMaxVal; } 
+  CORBA::Boolean isRangeDefined() { return !((myMaxVal==0) && (myMinVal == myMaxVal)); }
+
+  void dumpTo(const char* thePath) { myDumpPath = thePath; }
+
+  QString getLastErrorMsg() { return myLastError; }
+
+  CORBA::Boolean isCycling() { return myCycling; }
+
+  CORBA::Double getMinTime() { return myTimeMin;}
+  CORBA::Double getMaxTime() { return myTimeMax;}
 
-  void dumpTo(QString thePath) { myDumpPath = thePath; }
+  void setProportional(CORBA::Boolean theProp) { myProportional = theProp; }
+  void setCycling(CORBA::Boolean theCycle) { myCycling = theCycle; }
 
  public slots:
-  void setProportional(bool theProp) { myProportional = theProp; }
+  void setProportionalSlot(bool theProp) { myProportional = theProp; }
+  void setCyclingSlot(bool theCycle) { myCycling = theCycle; }
 
  signals:
   void frameChanged(long theNewFrame, double theTime);
+  void stopped();
 
  protected:
   void run();
 
  private:
+  QString myLastError;
 
   QValueList<FieldData> myFieldsLst;
   bool myIsActive;
   long myFrame;
   int mySpeed;
   bool myProportional;
+  bool myCycling;
   SALOMEDS::Study_var myStudy;
 
   double myMaxVal, myMinVal;
+  double myTimeMin, myTimeMax;
   QString myDumpPath;
   VTKViewer_ViewFrame* myView;
 };