00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00026 #ifndef __vtkPVSimpleAnimationCue_h
00027 #define __vtkPVSimpleAnimationCue_h
00028
00029 #include "vtkPVTracedWidget.h"
00030 class vtkPVSimpleAnimationCueObserver;
00031 class vtkCollectionIterator;
00032 class vtkCollection;
00033 class vtkSMAnimationCueProxy;
00034 class vtkSMKeyFrameAnimationCueManipulatorProxy;
00035 class vtkPVKeyFrame;
00036 class vtkSMProxy;
00037 class vtkSMProperty;
00038 class vtkSMPropertyStatusManager;
00039
00040 class VTK_EXPORT vtkPVSimpleAnimationCue : public vtkPVTracedWidget
00041 {
00042 public:
00043 static vtkPVSimpleAnimationCue* New();
00044 vtkTypeRevisionMacro(vtkPVSimpleAnimationCue, vtkPVTracedWidget);
00045 void PrintSelf(ostream& os, vtkIndent indent);
00046
00048 virtual void Create(vtkKWApplication* app);
00049
00051
00053 vtkGetMacro(Virtual, int);
00055
00058 virtual char* GetTextRepresentation();
00059
00061
00064 void SetParentAnimationCue(vtkPVSimpleAnimationCue* cue)
00065 { this->ParentCue = cue; }
00067
00069
00070 vtkSetStringMacro(LabelText);
00071 vtkGetStringMacro(LabelText);
00073
00075 unsigned long GetKeyFramesMTime();
00076
00078 int GetNumberOfKeyFrames();
00079
00082 double GetKeyFrameTime(int id);
00083
00086 void SetKeyFrameTime(int id, double time);
00087
00094 int AddNewKeyFrame(double time);
00095
00100 virtual int CreateAndAddKeyFrame(double time, int type);
00101
00105 int AppendNewKeyFrame();
00106
00108 virtual void RemoveAllKeyFrames();
00109
00114 void RemoveKeyFrame(vtkPVKeyFrame* keyframe);
00115
00120 int RemoveKeyFrame(int id);
00121
00125 void DeleteKeyFrame(int id);
00126
00128 int CanDeleteKeyFrame(int index);
00129
00131 int CanDeleteSelectedKeyFrame();
00132
00134 vtkPVKeyFrame* GetKeyFrame(int id);
00135
00140 vtkPVKeyFrame* GetKeyFrame(const char* name);
00141
00144 vtkPVKeyFrame* GetSelectedKeyFrame();
00145
00148 virtual void ReplaceKeyFrame(vtkPVKeyFrame* oldFrame, vtkPVKeyFrame* newFrame);
00149
00153 virtual int IsKeyFrameTypeSupported(int type);
00154
00156
00158 virtual void SetAnimatedProxy(vtkSMProxy* proxy);
00159 vtkSMProxy* GetAnimatedProxy();
00160 virtual void SetAnimatedPropertyName(const char* name);
00161 const char* GetAnimatedPropertyName();
00162 void SetAnimatedDomainName(const char* name);
00163 const char* GetAnimatedDomainName();
00164 void SetAnimatedElement(int index);
00165 int GetAnimatedElement();
00167
00170 virtual void StartRecording();
00171
00173 virtual void StopRecording();
00174
00175 virtual void RecordState(double ntime, double offset);
00176
00178
00180 vtkGetObjectMacro(CueProxy, vtkSMAnimationCueProxy);
00182
00193 void SetCueProxy(vtkSMAnimationCueProxy* cueProxy);
00194
00197 void InitializeKeyFrameUsingCurrentState(vtkPVKeyFrame* keyframe);
00198
00199 virtual void UpdateEnableState();
00200
00202 virtual void SelectKeyFrame(int id);
00203
00205
00206 vtkGetMacro(SelectedKeyFrameIndex, int);
00208
00209
00210
00211
00212
00213 enum {
00214 KeysModifiedEvent = 3001,
00215 SelectionChangedEvent
00216 };
00217
00218
00220
00224 virtual void SetTimeBounds(double bounds[2], int enable_scaling=0);
00225 virtual int GetTimeBounds(double* bounds);
00227
00229
00231 void SetKeyFrameParent(vtkKWWidget* kfParent);
00232 vtkGetObjectMacro(KeyFrameParent, vtkKWWidget);
00234
00236
00237 void SetDuration(double duration);
00238 vtkGetMacro(Duration, double);
00240
00241
00243
00244 vtkGetMacro(DefaultKeyFrameType, int);
00245 vtkSetMacro(DefaultKeyFrameType, int);
00247
00248
00250
00251 enum {
00252 RAMP = 0,
00253 STEP,
00254 EXPONENTIAL,
00255 SINUSOID,
00256 CAMERA,
00257 LAST_NOT_USED
00258 };
00259
00261
00266 vtkPVKeyFrame* ReplaceKeyFrame(int type, vtkPVKeyFrame* replaceFrame = NULL);
00267
00271 vtkPVKeyFrame* NewKeyFrame(int type);
00272
00274
00275 int GetKeyFrameType(vtkPVKeyFrame* kf);
00276 int GetKeyFrameType(vtkSMProxy* kf);
00278
00279 protected:
00280 vtkPVSimpleAnimationCue();
00281 ~vtkPVSimpleAnimationCue();
00282
00283 virtual void SelectKeyFrameInternal(int id);
00285 virtual void CreateProxy();
00286
00288 void CleanupKeyFramesGUI();
00289
00291 void InitializeGUIFromProxy();
00292
00293
00296 vtkPVKeyFrame* CreateNewKeyFrameAndInit(int type);
00297
00299
00302 vtkSetMacro(Virtual, int);
00304
00306 int AddKeyFrame(vtkPVKeyFrame* keyframe);
00307
00308
00309 vtkKWWidget* KeyFrameParent;
00310 vtkCollection* PVKeyFrames;
00311 vtkCollectionIterator* PVKeyFramesIterator;
00312
00313 vtkSMPropertyStatusManager* PropertyStatusManager;
00314 vtkPVSimpleAnimationCue* ParentCue;
00315
00316 int Virtual;
00317 int NumberOfPoints;
00318 double PointParameters[2];
00319 vtkSMAnimationCueProxy* CueProxy;
00320 char* CueProxyName;
00321 vtkSetStringMacro(CueProxyName);
00322
00323 vtkSMKeyFrameAnimationCueManipulatorProxy* KeyFrameManipulatorProxy;
00324 void SetKeyFrameManipulatorProxy(vtkSMKeyFrameAnimationCueManipulatorProxy*);
00325
00329 void SetupManipulatorProxy();
00330
00331 char* KeyFrameManipulatorProxyName;
00332 vtkSetStringMacro(KeyFrameManipulatorProxyName);
00333 char* KeyFrameManipulatorProxyXMLName;
00334 vtkSetStringMacro(KeyFrameManipulatorProxyXMLName);
00335
00336 char* LabelText;
00337 int ProxiesRegistered;
00338
00339 int InRecording;
00340 int SelectedKeyFrameIndex;
00341
00344 int PreviousStepKeyFrameAdded;
00345
00349 int KeyFramesCreatedCount;
00350
00352 int DefaultKeyFrameType;
00353
00355
00360 virtual void RegisterProxies();
00361 virtual void UnregisterProxies();
00363
00364 friend class vtkPVSimpleAnimationCueObserver;
00365 vtkPVSimpleAnimationCueObserver* Observer;
00366 void Observe(vtkObject* toObserver, unsigned long event);
00367 virtual void ExecuteEvent(vtkObject* wdg, unsigned long event, void*data);
00368
00369
00370 double Duration;
00371
00372 private:
00373 vtkPVSimpleAnimationCue(const vtkPVSimpleAnimationCue&);
00374 void operator=(const vtkPVSimpleAnimationCue&);
00375 };
00376
00377
00378 #endif