VAPoR  3.0.0
eventrouter.h
Go to the documentation of this file.
1 //************************************************************************
2 // *
3 // Copyright (C) 2006 *
4 // University Corporation for Atmospheric Research *
5 // All Rights Reserved *
6 // *
7 //************************************************************************/
8 //
9 // File: eventrouter.h
10 //
11 // Author: Alan Norton
12 // National Center for Atmospheric Research
13 // PO 3000, Boulder, Colorado
14 //
15 // Date: May 2006
16 //
17 // Description: Definition of EventRouter class
18 // This (pure virtual) class manages communication between
19 // gui elements, visualizers, and params.
20 
21 #ifndef EVENTROUTER_H
22 #define EVENTROUTER_H
23 #include "assert.h"
24 #include "params.h"
25 #include "vizwin.h"
26 #include <qobject.h>
27 #include "vapor/ControlExecutive.h"
28 
29 class QWidget;
30 class QHBoxLayout;
31 class QGroupBox;
32 class QComboBox;
33 class QButtonGroup;
34 class MappingFrame;
35 
36 #ifdef WIN32
37 //Annoying unreferenced formal parameter warning
38 #pragma warning( disable : 4100)
39 #endif
40 
41 namespace VAPoR{
42 class Histo;
43 
100 //
102 {
103 
104 public:
106 
107  _currentHistogram = 0;
108  _updatingTab = false;
109  _textChangedFlag=false;
110  }
116  virtual void hookUpTab() = 0;
117 
122  void updateTab();
123 
127  virtual void confirmText();
128 
133  void reinitTab(bool doOverride);
134 
141  virtual void updateUrgentTabState() {return;}
142 
147  void SetTextChanged(bool on) {if(!_updatingTab) _textChangedFlag = on;}
148 
154  virtual void captureMouseUp() {assert(0);}
155 
163  virtual void captureMouseDown(int mouseNum) {assert(0);}
164 
167  string getTag() {
168  return _paramsTag;
169  }
170 
177  virtual void updateRenderer(RenderParams* rp, bool wasEnabled, int instance, bool newVis);
178 
185  virtual void cleanParams(Params* rp ) {}
186 
190  virtual void sessionLoadTF(string name ) {assert(0);}
191 
197  virtual void SetLocal(Params* p, bool lg);
198 
203  virtual void SetEnabled(bool On, int instance );
204 
211  virtual void setEditorDirty(RenderParams*);
212 
217  virtual void updateMapBounds(RenderParams*) {assert (0);}
218 
222  void saveTF(RenderParams* rParams);
223 
226  void fileSaveTF(RenderParams* rParams);
227 
231  void loadInstalledTF(RenderParams* rParams, string varname);
232 
236  void loadTF(RenderParams* rParams, string varname);
237 
243  void fileLoadTF(RenderParams* rParams, string varname, const char* startPath, bool savePath);
244 
250  virtual Histo* getHistogram(RenderParams* rParam, bool mustGet, bool isIsoWin = false);
251 
255  virtual void refreshHistogram(RenderParams* rp){}
256 
260 
265  void calcSliceHistogram(RenderParams* rp, int ts, Histo* histo);
266 
270  virtual MappingFrame* getMappingFrame() {return NULL;}
271 
274  virtual void StartCursorMove();
275 
278  virtual void EndCursorMove();
279 
285  virtual void SetDimension(int dim) {}
286 
290  virtual void variableChanged() {}
291 
295  static void SetVizWinMgr(VizWinMgr* vizMgr) {_vizMgr = vizMgr;}
296 
300  static void SetDataMgr(DataMgrV3_0* dataMgr) {_dataMgr = dataMgr;}
301 
305  static void SetMainForm(MainForm* mainForm) {_mainForm = mainForm;}
306 
308  static DataMgrV3_0* GetDataMgr() { return _dataMgr;}
309 
313  virtual void invalidateRenderer(RenderParams* rParams) {return;}
314 
315 protected:
316 
321  virtual void _updateTab(Params* p) = 0;
322 
329  virtual void _confirmText(Params* p) = 0;
330 
337  virtual void _reinitTab(bool doOverride) = 0;
338 
349  vector<QAction*>* makeWebHelpActions(const char* text[], const char* urls[]);
350 
354  static EventRouter* GetEventRouter(const std::string& tag){
355  return VizWinMgr::getEventRouter(tag);
356  }
357 
363  virtual float calcCurrentValue(RenderParams* p, const double point[3]);
364 
368  return ControlExec::GetActiveParams(_paramsTag);
369  }
373  Params* GetActiveParams(string tag){
374  return ControlExec::GetActiveParams(tag);
375  }
376 
380 
384  void ForceRender(bool always = false) {
385  _vizMgr->forceRender(GetActiveParams(), always);
386  }
387 
388 
392 
393  }
394 
395 
396 #ifndef DOXYGEN_SKIP_THIS
397 
398  vector<QAction*>* _webHelpActions;
399 
400  Histo* _currentHistogram;
401  string _paramsTag;
402  static DataMgrV3_0* _dataMgr;
403 
404  static MainForm* _mainForm;
405  bool _textChangedFlag;
406  static float _OUT_OF_BOUNDS;
407 
408 private:
409  static VizWinMgr* _vizMgr;
410  bool _updatingTab;
411 #endif //DOXYGEN_SKIP_THIS
412 };
413 };
414 #endif // EVENTROUTER_H
415 
A pure virtual class for managing parameters used in visualization.
Definition: params.h:129
A Params subclass for managing parameters used by Renderers.
Definition: renderparams.h:57
virtual void confirmText()
void calcSliceHistogram(RenderParams *rp, int ts, Histo *histo)
Params * GetActiveParams()
Definition: eventrouter.h:367
virtual void _confirmText(Params *p)=0
void loadTF(RenderParams *rParams, string varname)
virtual void EndCursorMove()
virtual void cleanParams(Params *rp)
Definition: eventrouter.h:185
virtual void hookUpTab()=0
static int GetActiveVizIndex()
Visualizer * GetActiveVisualizer()
Identify the currently active Visualizer instance.
Definition: eventrouter.h:390
virtual void updateRenderer(RenderParams *rp, bool wasEnabled, int instance, bool newVis)
static Params * GetActiveParams(string type)
virtual MappingFrame * getMappingFrame()
Definition: eventrouter.h:270
virtual void setEditorDirty(RenderParams *)
A pure virtual class specifying the common properties of all the parameter tabs in the VAPOR GUI...
Definition: eventrouter.h:101
void SetTextChanged(bool on)
Definition: eventrouter.h:147
static void SetVizWinMgr(VizWinMgr *vizMgr)
Definition: eventrouter.h:295
virtual void SetLocal(Params *p, bool lg)
virtual void updateUrgentTabState()
Definition: eventrouter.h:141
virtual void captureMouseUp()
Definition: eventrouter.h:154
virtual Histo * getHistogram(RenderParams *rParam, bool mustGet, bool isIsoWin=false)
virtual void _reinitTab(bool doOverride)=0
virtual void SetDimension(int dim)
Definition: eventrouter.h:285
void reinitTab(bool doOverride)
A QGLWidget that displays a Transfer Function Editor, or an Iso Selection Window. ...
Definition: mappingframe.h:76
static void SetDataMgr(DataMgrV3_0 *dataMgr)
Definition: eventrouter.h:300
virtual void sessionLoadTF(string name)
Definition: eventrouter.h:190
void loadInstalledTF(RenderParams *rParams, string varname)
A class for managing all visualizers.
Definition: vizwinmgr.h:69
virtual void variableChanged()
Definition: eventrouter.h:290
virtual void invalidateRenderer(RenderParams *rParams)
Definition: eventrouter.h:313
static EventRouter * getEventRouter(const std::string &tag)
virtual void updateMapBounds(RenderParams *)
Definition: eventrouter.h:217
A class for performing OpenGL rendering in VAPOR GUI Window.
Definition: visualizer.h:61
static void SetMainForm(MainForm *mainForm)
Definition: eventrouter.h:305
virtual void _updateTab(Params *p)=0
void ForceRender(bool always=false)
Definition: eventrouter.h:384
static DataMgrV3_0 * GetDataMgr()
Obtain the current DataMgr.
Definition: eventrouter.h:308
Definition: DC.h:10
virtual void StartCursorMove()
virtual void SetEnabled(bool On, int instance)
virtual float calcCurrentValue(RenderParams *p, const double point[3])
Params * GetActiveParams(string tag)
Definition: eventrouter.h:373
void fileSaveTF(RenderParams *rParams)
void fileLoadTF(RenderParams *rParams, string varname, const char *startPath, bool savePath)
void refresh2DHistogram(RenderParams *)
virtual void captureMouseDown(int mouseNum)
Definition: eventrouter.h:163
static EventRouter * GetEventRouter(const std::string &tag)
Definition: eventrouter.h:354
void saveTF(RenderParams *rParams)
virtual void refreshHistogram(RenderParams *rp)
Definition: eventrouter.h:255
static Visualizer * GetVisualizer(int viz)
vector< QAction * > * makeWebHelpActions(const char *text[], const char *urls[])
A cache based data reader.
Definition: DataMgrV3_0.h:100