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 SVTK_ViewWindow;
30 VISU::VISUType myPrsType;
31 _PTR(SObject) 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
41 class VISU_TimeAnimation: public QObject, public QThread
45 //static VISU::Result_i* createPresent (SALOMEDS::SObject_var theField);
46 //static VISU::Storable::TRestoringMap getMapOfValue (SALOMEDS::SObject_var theSObject);
47 //static double getTimeValue (SALOMEDS::SObject_var theTimestamp);
49 static VISU::Result_i* createPresent (_PTR(SObject) theField);
50 static VISU::Storable::TRestoringMap getMapOfValue (_PTR(SObject) theSObject);
51 static double getTimeValue (_PTR(SObject) theTimestamp);
53 VISU_TimeAnimation(_PTR(Study) theStudy,
54 VISU::View3D_ptr theView3D = VISU::View3D::_nil());
55 ~VISU_TimeAnimation();
57 virtual VISU::VISUType GetType() { return VISU::TNONE;};
59 void addField (_PTR(SObject) theField);
60 void addField (SALOMEDS::SObject_ptr theField);
61 FieldData& getFieldData (int theNum) { return myFieldsLst[theNum]; }
63 CORBA::Boolean generateFrames();
64 void generatePresentations(CORBA::Long theFieldNum);
65 void setViewer(SVTK_ViewWindow* theView) { myView = theView; }
66 SVTK_ViewWindow* getViewer() { return myView; }
68 void clearData(FieldData& theData);
71 void startAnimation();
76 void gotoFrame(CORBA::Long theFrame);
78 CORBA::Long getNbFields() { return myFieldsLst.size(); }
79 CORBA::Long getNbFrames();
80 CORBA::Boolean isRunning() { return myIsActive; }
81 CORBA::Long getCurrentFrame() { return myFrame; }
83 VISU::ScalarMap_ptr getPresentation(CORBA::Long theField, CORBA::Long theFrame);
85 void setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType)
86 { myFieldsLst[theFieldNum].myPrsType = theType; }
87 VISU::VISUType getPresentationType(CORBA::Long theFieldNum)
88 { return myFieldsLst[theFieldNum].myPrsType; }
90 void setSpeed(CORBA::Long theSpeed);
91 CORBA::Long getSpeed() { return mySpeed; }
93 CORBA::Boolean isProportional() { return myProportional; }
95 void setAnimationRange(CORBA::Double theMin, CORBA::Double theMax)
96 { myMaxVal = theMax; myMinVal = theMin; }
98 CORBA::Double getMinRange() { return myMinVal; }
99 CORBA::Double getMaxRange() { return myMaxVal; }
100 CORBA::Boolean isRangeDefined() { return !((myMaxVal==0) && (myMinVal == myMaxVal)); }
102 void dumpTo(const char* thePath) { myDumpPath = thePath; }
104 QString getLastErrorMsg() { return myLastError; }
106 CORBA::Boolean isCycling() { return myCycling; }
108 CORBA::Double getMinTime() { return myTimeMin;}
109 CORBA::Double getMaxTime() { return myTimeMax;}
111 void setProportional(CORBA::Boolean theProp) { myProportional = theProp; }
112 void setCycling(CORBA::Boolean theCycle) { myCycling = theCycle; }
114 SALOMEDS::SObject_ptr publishInStudy();
115 void restoreFromStudy(SALOMEDS::SObject_ptr theField);
116 void restoreFromStudy(_PTR(SObject) theField);
117 void saveAnimation();
118 bool isSavedInStudy() const { return !myAnimEntry.isEmpty(); }
121 void setProportionalSlot(bool theProp) { myProportional = theProp; }
122 void setCyclingSlot(bool theCycle) { myCycling = theCycle; }
125 void frameChanged(long theNewFrame, double theTime);
130 QString GenerateName();
135 QValueList<FieldData> myFieldsLst;
143 double myMaxVal, myMinVal;
144 double myTimeMin, myTimeMax;
146 SVTK_ViewWindow* myView;
150 static int myNBAnimations;
154 class VISU_TimeAnimation_i: public virtual POA_VISU::Animation,
155 public virtual VISU::Base_i
157 VISU_TimeAnimation* myAnim;
159 VISU_TimeAnimation_i(SALOMEDS::Study_ptr theStudy,
160 VISU::View3D_ptr theView3D = VISU::View3D::_nil());
161 ~VISU_TimeAnimation_i();
163 virtual VISU::VISUType GetType() { return VISU::TANIMATION; }
164 //virtual VISU::VISUType GetType() { return VISU::TNONE; }
166 virtual void addField(SALOMEDS::SObject_ptr theField);
168 virtual CORBA::Boolean generateFrames();
169 virtual void generatePresentations(CORBA::Long theFieldNum);
171 virtual void clearView();
173 virtual void stopAnimation();
174 virtual void startAnimation();
175 virtual void nextFrame();
176 virtual void prevFrame();
177 virtual void firstFrame();
178 virtual void lastFrame();
179 virtual void gotoFrame(CORBA::Long theFrame);
181 virtual CORBA::Long getNbFields();
182 virtual CORBA::Long getNbFrames();
183 virtual CORBA::Boolean isRunning();
184 virtual CORBA::Long getCurrentFrame();
186 virtual VISU::ScalarMap_ptr getPresentation(CORBA::Long theField, CORBA::Long theFrame);
188 virtual void setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType);
189 virtual VISU::VISUType getPresentationType(CORBA::Long theFieldNum);
191 virtual void setSpeed(CORBA::Long theSpeed);
192 virtual CORBA::Long getSpeed();
194 virtual CORBA::Boolean isProportional();
196 virtual void setAnimationRange(CORBA::Double theMin, CORBA::Double theMax);
198 virtual CORBA::Double getMinRange();
199 virtual CORBA::Double getMaxRange();
200 virtual CORBA::Boolean isRangeDefined();
202 virtual void dumpTo(const char* thePath);
204 virtual CORBA::Boolean isCycling();
206 virtual CORBA::Double getMinTime();
207 virtual CORBA::Double getMaxTime();
209 virtual void setProportional(CORBA::Boolean theProp);
210 virtual void setCycling(CORBA::Boolean theCycle);
212 virtual SALOMEDS::SObject_ptr publishInStudy();
213 virtual void restoreFromStudy(SALOMEDS::SObject_ptr theField);
214 virtual CORBA::Boolean isSavedInStudy();
215 virtual void saveAnimation();
218 #endif //VISU_TIMEANIMATION_H