VAPOR3 3.9.4
RenderEventRouter.h
Go to the documentation of this file.
1//************************************************************************
2// *
3// Copyright (C) 2017 *
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 RenderEventRouter class
18// This (pure virtual) class manages communication between
19// renderer gui elements, visualizers, and params.
20
21#ifndef RENDEREREVENTROUTER_H
22#define RENDEREREVENTROUTER_H
23
24#include "EventRouter.h"
25#include "Flags.h"
26
27namespace VAPoR {
28class ControlExec;
29class RenderParams;
30class ParamsMgr;
31} // namespace VAPoR
32
33#ifdef WIN32
34 // Annoying unreferenced formal parameter warning
35 #pragma warning(disable : 4100)
36#endif
37
38class ColorbarWidget;
39
48
109//
111public:
112 RenderEventRouter(VAPoR::ControlExec *ce, string paramsType) : EventRouter(ce, paramsType) { _instName = ""; }
113
115
116 void SetActive(string instName) { _instName = instName; }
117
118 virtual void hookUpTab() {}
119
120 virtual void updateTab();
121
123
126 virtual bool Supports2DVariables() const = 0;
127
130 virtual bool Supports3DVariables() const = 0;
131
132 virtual bool SupportsParticleVariables() const { return false; };
133
143 //
144 void updateRenderer(VAPoR::RenderParams *rParams, bool prevEnabled, string VizName, string renderInstName, bool newWindow);
145
149 //
150 virtual void sessionLoadTF(string name) {}
151
152#ifdef VAPOR3_0_0_ALPHA
158 //
159 virtual void UpdateMapBounds() {}
160#endif
161
165 virtual void fitToView() {}
166
170 virtual ColorbarWidget *getColorbarWidget() { return NULL; }
171
175 virtual void variableChanged() {}
176
177#ifdef VAPOR3_0_0_ALPHA
183 virtual float CalcCurrentValue(const double point[3]);
184#endif
185
190
195
198 string GetDescription() const { return (_getDescription()); }
199
203 string GetSmallIconImagePath() const;
204 string GetIconImagePath() const;
205
206protected:
208
217 virtual void _updateTab() = 0;
218
228 virtual void _confirmText(){};
229
230 virtual string _getDescription() const = 0;
231
232 virtual string _getSmallIconImagePath() const = 0;
233
234 virtual string _getIconImagePath() const = 0;
235
236private:
237 string _instName;
238};
239
240
242//
243// RenderEventRouterFactory Class
244//
246
248public:
250 {
251 static RenderEventRouterFactory instance;
252 return &instance;
253 }
254
255 void RegisterFactoryFunction(string name, function<RenderEventRouter *(QWidget *, VAPoR::ControlExec *)> classFactoryFunction)
256 {
257 // register the class factory function
258 _factoryFunctionRegistry[name] = classFactoryFunction;
259 }
260
261 RenderEventRouter *(CreateInstance(string classType, QWidget *, VAPoR::ControlExec *));
262
263 vector<string> GetFactoryNames() const;
264
265private:
266 map<string, function<RenderEventRouter *(QWidget *, VAPoR::ControlExec *)>> _factoryFunctionRegistry;
267
270 RenderEventRouterFactory &operator=(const RenderEventRouterFactory &) { return *this; }
271};
272
274//
275// RenderEventRouterRegistrar Class
276//
277// Register RenderEventRouter derived class with:
278//
279// static RenderEventRouterRegistrar<RERClass> registrar("myclassname");
280//
281// where 'RERClass' is a class derived from 'RenderEventRouter', and
282// "myclassname" is the name of the class
283//
285
286template<class T> class RenderEventRouterRegistrar {
287public:
289 {
290 // register the class factory function
291 //
292 RenderEventRouterFactory::Instance()->RegisterFactoryFunction(classType, [](QWidget *parent, VAPoR::ControlExec *ce) -> RenderEventRouter * { return new T(parent, ce); });
293 }
294};
295
296#endif // RENDEREREVENTROUTER_H
A pure virtual class specifying the common properties of all the parameter tabs in the VAPOR GUI.
Definition: EventRouter.h:107
virtual void confirmText()
RenderEventRouter * CreateInstance(string classType, QWidget *, VAPoR::ControlExec *))
static RenderEventRouterFactory * Instance()
void RegisterFactoryFunction(string name, function< RenderEventRouter *(QWidget *, VAPoR::ControlExec *)> classFactoryFunction)
vector< string > GetFactoryNames() const
RenderEventRouterRegistrar(string classType)
A pure virtual class specifying the common properties of all the renderer parameter tabs in the VAPOR...
virtual void hookUpTab()
virtual void _updateTab()=0
virtual bool Supports3DVariables() const =0
VAPoR::DataMgr * GetActiveDataMgr() const
RenderEventRouter(VAPoR::ControlExec *ce, string paramsType)
virtual void variableChanged()
virtual void fitToView()
virtual string _getSmallIconImagePath() const =0
string GetSmallIconImagePath() const
string GetDescription() const
virtual ColorbarWidget * getColorbarWidget()
virtual void sessionLoadTF(string name)
virtual string _getIconImagePath() const =0
void updateRenderer(VAPoR::RenderParams *rParams, bool prevEnabled, string VizName, string renderInstName, bool newWindow)
virtual bool SupportsParticleVariables() const
virtual ~RenderEventRouter()
virtual bool Supports2DVariables() const =0
VAPoR::RenderParams * GetActiveParams() const
virtual void updateTab()
void SetActive(string instName)
string GetIconImagePath() const
virtual string _getDescription() const =0
virtual void confirmText()
virtual void _confirmText()
Provides API for VAPOR visualizer User Interfaces (UIs)
A cache based data reader.
Definition: DataMgr.h:110
A Params subclass for managing parameters used by Renderers.
Definition: RenderParams.h:43