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 //SALOMEDS::SObject_var myField; // field label
32 _PTR(SObject) myField; // field label
33 long myNbTimes; // number of Timestamps
34 long myNbFrames; // number of created Frames
35 std::vector<VISU::ScalarMap_i*> myPrs; // Presentations
36 std::vector<VISU_Actor*> myActors; // Actors
37 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(SALOMEDS::Study_ptr theStudy,
54 VISU_TimeAnimation(_PTR(Study) theStudy,
55 VISU::View3D_ptr theView3D = VISU::View3D::_nil());
56 ~VISU_TimeAnimation();
58 virtual VISU::VISUType GetType() { return VISU::TNONE;};
60 void addField (_PTR(SObject) theField);
61 void addField (SALOMEDS::SObject_ptr theField);
62 FieldData& getFieldData (int theNum) { return myFieldsLst[theNum]; }
64 CORBA::Boolean generateFrames();
65 void generatePresentations(CORBA::Long theFieldNum);
66 void setViewer(SVTK_ViewWindow* theView) { myView = theView; }
67 SVTK_ViewWindow* getViewer() { return myView; }
69 void clearData(FieldData& theData);
72 void startAnimation();
77 void gotoFrame(CORBA::Long theFrame);
79 CORBA::Long getNbFields() { return myFieldsLst.size(); }
80 CORBA::Long getNbFrames();
81 CORBA::Boolean isRunning() { return myIsActive; }
82 CORBA::Long getCurrentFrame() { return myFrame; }
84 VISU::ScalarMap_ptr getPresentation(CORBA::Long theField, CORBA::Long theFrame);
86 void setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType) { myFieldsLst[theFieldNum].myPrsType = theType; }
87 VISU::VISUType getPresentationType(CORBA::Long theFieldNum) { return myFieldsLst[theFieldNum].myPrsType; }
89 void setSpeed(CORBA::Long theSpeed);
90 CORBA::Long getSpeed() { return mySpeed; }
92 CORBA::Boolean isProportional() { return myProportional; }
94 void setAnimationRange(CORBA::Double theMin, CORBA::Double theMax)
95 { myMaxVal = theMax; myMinVal = theMin; }
97 CORBA::Double getMinRange() { return myMinVal; }
98 CORBA::Double getMaxRange() { return myMaxVal; }
99 CORBA::Boolean isRangeDefined() { return !((myMaxVal==0) && (myMinVal == myMaxVal)); }
101 void dumpTo(const char* thePath) { myDumpPath = thePath; }
103 QString getLastErrorMsg() { return myLastError; }
105 CORBA::Boolean isCycling() { return myCycling; }
107 CORBA::Double getMinTime() { return myTimeMin;}
108 CORBA::Double getMaxTime() { return myTimeMax;}
110 void setProportional(CORBA::Boolean theProp) { myProportional = theProp; }
111 void setCycling(CORBA::Boolean theCycle) { myCycling = theCycle; }
114 void setProportionalSlot(bool theProp) { myProportional = theProp; }
115 void setCyclingSlot(bool theCycle) { myCycling = theCycle; }
118 void frameChanged(long theNewFrame, double theTime);
127 QValueList<FieldData> myFieldsLst;
133 //SALOMEDS::Study_var myStudy;
136 double myMaxVal, myMinVal;
137 double myTimeMin, myTimeMax;
139 SVTK_ViewWindow* myView;
143 class VISU_TimeAnimation_i: public virtual POA_VISU::Animation,
144 public virtual VISU::Base_i
146 VISU_TimeAnimation* myAnim;
148 VISU_TimeAnimation_i(SALOMEDS::Study_ptr theStudy,
149 VISU::View3D_ptr theView3D = VISU::View3D::_nil());
150 ~VISU_TimeAnimation_i();
152 virtual VISU::VISUType GetType(){ return VISU::TNONE;}
154 virtual void addField(SALOMEDS::SObject_ptr theField);
156 virtual CORBA::Boolean generateFrames();
157 virtual void generatePresentations(CORBA::Long theFieldNum);
159 virtual void clearView();
161 virtual void stopAnimation();
162 virtual void startAnimation();
163 virtual void nextFrame();
164 virtual void prevFrame();
165 virtual void firstFrame();
166 virtual void lastFrame();
167 virtual void gotoFrame(CORBA::Long theFrame);
169 virtual CORBA::Long getNbFields();
170 virtual CORBA::Long getNbFrames();
171 virtual CORBA::Boolean isRunning();
172 virtual CORBA::Long getCurrentFrame();
174 virtual VISU::ScalarMap_ptr getPresentation(CORBA::Long theField, CORBA::Long theFrame);
176 virtual void setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType);
177 virtual VISU::VISUType getPresentationType(CORBA::Long theFieldNum);
179 virtual void setSpeed(CORBA::Long theSpeed);
180 virtual CORBA::Long getSpeed();
182 virtual CORBA::Boolean isProportional();
184 virtual void setAnimationRange(CORBA::Double theMin, CORBA::Double theMax);
186 virtual CORBA::Double getMinRange();
187 virtual CORBA::Double getMaxRange();
188 virtual CORBA::Boolean isRangeDefined();
190 virtual void dumpTo(const char* thePath);
192 virtual CORBA::Boolean isCycling();
194 virtual CORBA::Double getMinTime();
195 virtual CORBA::Double getMaxTime();
197 virtual void setProportional(CORBA::Boolean theProp);
198 virtual void setCycling(CORBA::Boolean theCycle);
202 #endif //VISU_TIMEANIMATION_H