1 // Copyright (C) 2003 CEA/DEN, EDF R&D
5 // File : VISU_TimeAnimation.h
6 // Author : Vitaly SMETANNIKOV
9 #ifndef VISU_TIMEANIMATION_H
10 #define VISU_TIMEANIMATION_H
12 #include "VISUConfig.hh"
17 #include <qvaluelist.h>
20 class VTKViewer_ViewFrame;
30 VISU::VISUType myPrsType;
31 SALOMEDS::SObject_var myField; // field label
32 long myNbTimes; // number of Timestamps
33 long myNbFrames; // number of created Frames
34 std::vector<VISU::ScalarMap_i*> myPrs; // Presentations
35 std::vector<VISU_Actor*> myActors; // Actors
36 std::vector<double> myTiming; // time values
40 class VISU_TimeAnimation: public QObject, public QThread
44 static VISU::Result_i* createPresent(SALOMEDS::SObject_var theField);
45 static VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject);
46 static double getTimeValue(SALOMEDS::SObject_var theTimestamp);
48 VISU_TimeAnimation(SALOMEDS::Study_ptr theStudy, VISU::View3D_ptr theView3D = VISU::View3D::_nil());
49 ~VISU_TimeAnimation();
51 virtual VISU::VISUType GetType() { return VISU::TNONE;};
53 void addField(SALOMEDS::SObject_ptr theField);
54 FieldData& getFieldData(int theNum) { return myFieldsLst[theNum]; }
56 CORBA::Boolean generateFrames();
57 void generatePresentations(CORBA::Long theFieldNum);
58 void setViewer(VTKViewer_ViewFrame* theView) { myView = theView; }
59 VTKViewer_ViewFrame* getViewer() { return myView; }
61 void clearData(FieldData& theData);
64 void startAnimation();
69 void gotoFrame(CORBA::Long theFrame);
71 CORBA::Long getNbFields() { return myFieldsLst.size(); }
72 CORBA::Long getNbFrames();
73 CORBA::Boolean isRunning() { return myIsActive; }
74 CORBA::Long getCurrentFrame() { return myFrame; }
76 VISU::ScalarMap_ptr getPresentation(CORBA::Long theField, CORBA::Long theFrame);
78 void setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType) { myFieldsLst[theFieldNum].myPrsType = theType; }
79 VISU::VISUType getPresentationType(CORBA::Long theFieldNum) { return myFieldsLst[theFieldNum].myPrsType; }
81 void setSpeed(CORBA::Long theSpeed);
82 CORBA::Long getSpeed() { return mySpeed; }
84 CORBA::Boolean isProportional() { return myProportional; }
86 void setAnimationRange(CORBA::Double theMin, CORBA::Double theMax)
87 { myMaxVal = theMax; myMinVal = theMin; }
89 CORBA::Double getMinRange() { return myMinVal; }
90 CORBA::Double getMaxRange() { return myMaxVal; }
91 CORBA::Boolean isRangeDefined() { return !((myMaxVal==0) && (myMinVal == myMaxVal)); }
93 void dumpTo(const char* thePath) { myDumpPath = thePath; }
95 QString getLastErrorMsg() { return myLastError; }
97 CORBA::Boolean isCycling() { return myCycling; }
99 CORBA::Double getMinTime() { return myTimeMin;}
100 CORBA::Double getMaxTime() { return myTimeMax;}
102 void setProportional(CORBA::Boolean theProp) { myProportional = theProp; }
103 void setCycling(CORBA::Boolean theCycle) { myCycling = theCycle; }
106 void setProportionalSlot(bool theProp) { myProportional = theProp; }
107 void setCyclingSlot(bool theCycle) { myCycling = theCycle; }
110 void frameChanged(long theNewFrame, double theTime);
119 QValueList<FieldData> myFieldsLst;
125 SALOMEDS::Study_var myStudy;
127 double myMaxVal, myMinVal;
128 double myTimeMin, myTimeMax;
130 VTKViewer_ViewFrame* myView;
134 class VISU_TimeAnimation_i: public virtual POA_VISU::Animation,
135 public virtual VISU::Base_i
137 VISU_TimeAnimation* myAnim;
139 VISU_TimeAnimation_i(SALOMEDS::Study_ptr theStudy,
140 VISU::View3D_ptr theView3D = VISU::View3D::_nil());
141 ~VISU_TimeAnimation_i();
143 virtual VISU::VISUType GetType(){ return VISU::TNONE;}
145 virtual void addField(SALOMEDS::SObject_ptr theField);
147 virtual CORBA::Boolean generateFrames();
148 virtual void generatePresentations(CORBA::Long theFieldNum);
150 virtual void clearView();
152 virtual void stopAnimation();
153 virtual void startAnimation();
154 virtual void nextFrame();
155 virtual void prevFrame();
156 virtual void firstFrame();
157 virtual void lastFrame();
158 virtual void gotoFrame(CORBA::Long theFrame);
160 virtual CORBA::Long getNbFields();
161 virtual CORBA::Long getNbFrames();
162 virtual CORBA::Boolean isRunning();
163 virtual CORBA::Long getCurrentFrame();
165 virtual VISU::ScalarMap_ptr getPresentation(CORBA::Long theField, CORBA::Long theFrame);
167 virtual void setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType);
168 virtual VISU::VISUType getPresentationType(CORBA::Long theFieldNum);
170 virtual void setSpeed(CORBA::Long theSpeed);
171 virtual CORBA::Long getSpeed();
173 virtual CORBA::Boolean isProportional();
175 virtual void setAnimationRange(CORBA::Double theMin, CORBA::Double theMax);
177 virtual CORBA::Double getMinRange();
178 virtual CORBA::Double getMaxRange();
179 virtual CORBA::Boolean isRangeDefined();
181 virtual void dumpTo(const char* thePath);
183 virtual CORBA::Boolean isCycling();
185 virtual CORBA::Double getMinTime();
186 virtual CORBA::Double getMaxTime();
188 virtual void setProportional(CORBA::Boolean theProp);
189 virtual void setCycling(CORBA::Boolean theCycle);
193 #endif //VISU_TIMEANIMATION_H