VAPoR  3.0.0
animationparams.h
Go to the documentation of this file.
1 //************************************************************************
2 // *
3 // Copyright (C) 2004 *
4 // University Corporation for Atmospheric Research *
5 // All Rights Reserved *
6 // *
7 //************************************************************************/
8 //
9 // File: animationparams.h
10 //
11 // Author: Alan Norton
12 // National Center for Atmospheric Research
13 // PO 3000, Boulder, Colorado
14 //
15 // Date: January 2005
16 //
17 // Description: Defines the AnimationParams class
18 // This is derived from the Params class
19 // It contains all the parameters required for animation
20 
21 //
22 #ifndef ANIMATIONPARAMS_H
23 #define ANIMATIONPARAMS_H
24 
25 
26 #include "params.h"
27 #include <vapor/common.h>
28 #include "viewpointparams.h"
29 #include "command.h"
30 
31 
32 namespace VAPoR {
33 class ExpatParseMgr;
34 
35 class XmlNode;
36 class ParamNode;
37 
47 
48 public:
49 
53  return GetValueLong(_currentTimestepTag);
54  }
58  int setCurrentTimestep(long ts) {
59  int rc = SetValueLong(_currentTimestepTag,"Set timestep",ts);
60  return rc;
61  }
62 
66  return GetValueLong(_startTimestepTag);
67  }
71  int setStartTimestep(int ts) {
72  int rc= SetValueLong(_startTimestepTag,"Set start timestep",ts);
73  return rc;
74  }
75 
79  return GetValueLong(_endTimestepTag);
80  }
84  int setEndTimestep(int val) {
85 
86  return SetValueLong(_endTimestepTag,"Set end timestep",val);
87  }
88 
92  return GetValueLong(_minTimestepTag);
93  }
97  int setMinTimestep(int val) {
98 
99  return SetValueLong(_minTimestepTag,"Set min timestep",val);
100  }
104  return GetValueLong(_maxTimestepTag);
105  }
106 
110  int setMaxTimestep(int val) {
111  return SetValueLong(_maxTimestepTag,"Set max timestep",val);
112  }
113 
117  return GetValueLong(_playDirectionTag);
118  }
119 
123  int setPlayDirection(int val) {
124  return SetValueLong(_playDirectionTag,"Set play direction",val);
125  }
129  return GetValueLong(_stepSizeTag);
130  }
134  int setFrameStepSize(int val) {
135  return SetValueLong(_stepSizeTag,"Set frame stepsize",val);
136  }
139  double getMaxFrameRate() {
140  return GetValueDouble(_maxRateTag);
141  }
145  int setMaxFrameRate(double rate) {
146  return SetValueDouble(_maxRateTag,"Set max frame rate",rate);
147  }
150  bool isRepeating() {
151  return (GetValueLong(_repeatTag) != 0);
152  }
156  int setRepeating(bool onOff){
157  return SetValueLong(_repeatTag,"enable repeat play",(long)onOff);
158  }
159 
162  int getMinTimeToRender() {return ((int)(1000.f/getMaxFrameRate()) );}
163 
167  int SetCaptureEnabled(bool val) {
168  return SetValueLong(_captureEnabledTag, "Toggle capture enabled", (long)val);
169  }
173  return (GetValueLong(_captureEnabledTag) != 0);
174  }
179  int SetCaptureFilepath(string path){
180  return SetValueString(_capturePathTag, "Set capture file path", path);
181  }
185  return GetValueString(_capturePathTag);
186  }
191 
194  AnimationParams(XmlNode* parent, int winnum);
196  ~AnimationParams();
197 
199 
200  //The following are not part of the public API
201 #ifndef DOXYGEN_SKIP_THIS
202  virtual void Validate(int type);
206  virtual void restart();
209  const std::string getShortName() {return _shortName;}
212  static ParamsBase* CreateDefaultInstance() {return new AnimationParams(0,-1);}
213 
214  //When rendering is finished, renderer calls this. Returns true no change (if the change bit
215  //needs to be set.
216  //It advances the currentFrame to the next one
217  bool advanceFrame();
218 
219  //set to pause if last frame is done, return true if done.
220  bool checkLastFrame();
221  int getNextFrame(int dir); //Determine the next frame in the specified direction
222 
223 
224 private:
225 
226  static const string _shortName;
227  static const string _repeatTag;
228  static const string _maxRateTag;
229  static const string _stepSizeTag;
230  static const string _startTimestepTag;
231  static const string _endTimestepTag;
232  static const string _minTimestepTag;
233  static const string _maxTimestepTag;
234  static const string _playDirectionTag;
235  static const string _currentTimestepTag;
236  static const string _capturePathTag;
237  static const string _captureEnabledTag;
238 
239 
240 #endif /* DOXYGEN_SKIP_THIS */
241 
242 };
243 
244 };
245 
246 #endif //ANIMATIONPARAMS_H
int setFrameStepSize(int val)
int setRepeating(bool onOff)
A pure virtual class for managing parameters used in visualization.
Definition: params.h:129
int SetCaptureEnabled(bool val)
int setCurrentTimestep(long ts)
int setStartTimestep(int ts)
int SetCaptureFilepath(string path)
int setMaxFrameRate(double rate)
#define PARAMS_API
Definition: DC.h:10
int setMinTimestep(int val)
A class that specifies parameters used in animation.
int setPlayDirection(int val)
int setEndTimestep(int val)