VAPoR  3.0.0
ControlExecutive.h
Go to the documentation of this file.
1 
2 #ifndef ControlExec_h
3 #define ControlExec_h
4 #include <string>
5 #include <vector>
6 #include <map>
7 #include <vapor/ExpatParseMgr.h>
8 #include "params.h"
9 using namespace std;
10 namespace VAPoR {
11 
12 #include "common.h"
13 
14 class Visualizer;
15 class ParamsBase;
16 class RenderParams;
17 class DataMgrV3_0;
18 class ErrorHandler;
19 class Command;
20 class ParamNode;
21 class ViewpointParams;
22 class RegionParams;
23 class AnimationParams;
24 
25 
26 
30 //
31 
32 class RENDER_API ControlExec : public ParsedXml {
33 public:
37  ControlExec();
38  ~ControlExec();
39 
42  if (!_controlExec) _controlExec = new ControlExec();
43  return _controlExec;
44  }
45 
67  //
68  static int NewVisualizer(int vizNum = -1);
69 
73  static int RemoveVisualizer(int viz);
74 
75 
85  //
86  static void InitializeViz(int viz, int width, int height);
87 
99  //
100  static void ResizeViz(int viz, int width, int height);
101 
120  static int Paint(int viz, bool force=false);
121 
122 
139  //
140  static int ActivateRender(int viz, std::string type, int instance, bool on);
141 
166  //
167  static Params* GetParams(int viz, string type, int instance);
168 
182  //
183  static int SetParams(int viz, string type, int instance, Params* p);
184 
198  //
199  static int RemoveParams(int viz, string type, int instance);
200 
207  static int AddParams(int viz, string type, Params* p);
208 
215  static int FindInstanceIndex(int viz, RenderParams* p);
216 
223 
224  static int GetNumParamsInstances(int viz, string type);
225 
231 
232  static int GetNumBasicParamsClasses();
239 
240  static int GetNumParamsClasses();
241 
248 
249  static int GetNumTabParamsClasses();
250 
254  static const std::string GetShortName(string& typetag);
255 
262  static int SetCurrentParamsInstance(int viz, string type, int instance);
263 
269  static int GetCurrentRenderParamsInstance(int viz, string type);
270 
271 
276  static Params* GetCurrentParams(int viz, string type);
277 
282  static Params* GetActiveParams(string type){
283  return GetCurrentParams(GetActiveVizIndex(),type);
284  }
289  return (RegionParams*)GetActiveParams(Params::_regionParamsTag);
290  }
295  return (ViewpointParams*)GetActiveParams(Params::_viewpointParamsTag);
296  }
301  return (AnimationParams*)GetActiveParams(Params::_animationParamsTag);
302  }
303 
308  static Params* GetDefaultParams(string type);
309 
313 
314  static int GetNumVisualizers(){
315  return (int)_visualizers.size();
316  }
321 
322  static Visualizer* GetVisualizer(int viz){
323  std::map<int, Visualizer*>::iterator it;
324  it = _visualizers.find(viz);
325  if (it == _visualizers.end()) return 0;
326  return _visualizers[viz];
327  }
328 
333  static int GetActiveVizIndex();
334 
340  static int SetActiveVizIndex(int index);
341 
355  //
356  int SaveSession(string file);
357 
376  //
377  int RestoreSession(string file);
378 
405  //
406  static DataMgrV3_0 *LoadData(vector <string> files, bool deflt = true);
407 
411  static DataMgrV3_0* GetDataMgr(){ return _dataMgr;};
412 
430  //
431  static int DrawText(int viz, int x, int y, string font, int size, string text);
432 
449  Params* Undo();
450 
465  //
466  Params* Redo();
467 
468  string GetCommandText(int n);
469 
477 
478  bool CommandExists(int offset);
479 
493  static int EnableCapture(string filename, int viz);
494 
505  static int SetErrorHandler(ErrorHandler* handler);
506 
512  static void SetToDefault();
513 
522  static int ValidateParams(Params* p);
523 
527  static ViewpointParams* GetViewpointParams(int winNum);
528 
532  static RegionParams* GetRegionParams(int winNum);
533 
537  static AnimationParams* GetAnimationParams(int winNum);
538 
539  private:
540  static const string _VAPORVersionAttr;
541  static const string _sessionTag;
542  static const string _globalParamsTag;
543  static const string _vizNumAttr;
544  static const string _visualizerTag;
545  static const string _visualizersTag;
546 
547  bool elementEndHandler(ExpatParseMgr* pm, int depth, std::string& tag);
548  bool elementStartHandler(ExpatParseMgr* pm, int depth, std::string& tag, const char **attrs);
549  ParamNode* buildNode();
551  void createAllDefaultParams();
553  static void reinitializeParams(bool doOverride);
555  void destroyParams();
556  static std::map<int,Visualizer*> _visualizers;
557  static DataMgrV3_0* _dataMgr;
558  static ControlExec* _controlExec;
559 
560  Params* _tempParsedParams;
561  int _parsingVizNum;
562  vector<int> _parsingInstance;
563 };
564 };
565 #endif //ControlExec_h
A pure virtual class for managing parameters used in visualization.
Definition: params.h:129
Provides API for VAPOR visualizer User Interfaces (UIs)
A class for describing a 3D axis-aligned region in user space.
Definition: regionparams.h:53
static Params * GetActiveParams(string type)
static ViewpointParams * GetActiveVPParams()
static DataMgrV3_0 * GetDataMgr()
static RegionParams * GetActiveRegionParams()
A class for describing the viewpoint and lights in a 3D VAPOR scene.
static ControlExec * getInstance()
Obtain the singleton ControlExec object.
A class for performing OpenGL rendering in VAPOR GUI Window.
Definition: visualizer.h:61
static AnimationParams * GetActiveAnimationParams()
#define RENDER_API
Definition: DC.h:10
static int GetNumVisualizers()
A class that specifies parameters used in animation.
An Xml tree.
Definition: ParamNode.h:30
static Visualizer * GetVisualizer(int viz)
A cache based data reader.
Definition: DataMgrV3_0.h:100