VAPoR  3.0.0
isolineeventrouter.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: isolineeventrouter.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: Defines the IsolineEventRouter class.
18 // This class handles events for the region params
19 //
20 #ifndef ISOLINEEVENTROUTER_H
21 #define ISOLINEEVENTROUTER_H
22 
23 #include <qthread.h>
24 #include <qobject.h>
25 #include "GL/glew.h"
26 #include "params.h"
27 #include "eventrouter.h"
28 #include "tabmanager.h"
29 #include <vapor/MyBase.h>
30 #include "contourAppearance.h"
31 #include "contourIsovalues.h"
32 #include "contourImage.h"
33 #include "variablesWidget.h"
34 #include "layoutWidget.h"
35 #include "glisolinewindow.h"
36 
37 
38 using namespace VetsUtil;
39 
40 namespace VAPoR {
41 
42 class IsolineParams;
43 class XmlNode;
44 class TransferFunction;
45 
59 
60 class IsolineEventRouter : public QTabWidget, public EventRouter {
61  Q_OBJECT
62 public:
63 
64  IsolineEventRouter(QWidget* parent);
65  virtual ~IsolineEventRouter();
69  TabManager* tMgr = TabManager::getInstance();
70  return (EventRouter*)(new IsolineEventRouter((QWidget*)tMgr));
71  }
72 
74  virtual void hookUpTab();
75 
77  virtual MappingFrame* getMappingFrame() {return _isovals->isoSelectionFrame;}
78 
82  virtual void captureMouseDown(int button);
83 
86  virtual void captureMouseUp();
87 
90  virtual void updateMapBounds(RenderParams* rParams);
91 
94  void sessionLoadTF(QString* name);
95 
98  bool seedIsAttached(){return _seedAttached;}
99 
101  virtual void StartCursorMove();
102 
104  virtual void EndCursorMove();
105 
107  void CopyRegionToIsoline();
108 
113  virtual void SetDimension(int dim);
114 
116  virtual void variableChanged();
117 
118 
119 protected slots:
120 
122  void changeExtents();
123 
125  void isolineCenterRegion();
126 
128  void isolineCenterView();
129 
131  void isolineCenterRake();
132 
134  void CenterIsolines();
135 
136  //Appearance slots
138  void SetSingleColor();
139 
142  void SetUseSingleColor(bool val);
143 
146  void EnableText(bool val);
147 
150  void textTypeChanged(int type);
151 
152  //Isovalues (and color map) slots
154  void SpaceIsovalues();
155 
157  void EditIsovalues();
158 
160  void SetIsolineDensity();
161 
163  void isolineLoadTF();
164 
166  void isolineLoadInstalledTF();
167 
169  void isolineSaveTF();
170 
172  void StartChangeIsoSelection(QString);
173 
175  void EndChangeIsoSelection();
176 
178  void copyToProbeOr2D();
179 
180  //Image slots:
182  void isolineAddSeed();
183 
186  void isolineAttachSeed(bool attach);
187 
189  void SetPanelBackgroundColor();
190 
191  //Text setting and other general slots
194  void setIsolineTabTextChanged(const QString& qs);
195 
197  void isolineReturnPressed();
198 
201  virtual void invalidateRenderer(RenderParams* iParams);
202 
203 
204 private:
206  virtual void _confirmText(Params* p);
207 
209  virtual void _updateTab(Params* p);
210 
212  virtual void _reinitTab(bool doOverride);
213 
214  //Internal classes for sub-widgets:
217  class IsolineAppearance : public QWidget, public Ui_ContourAppearance {
218  public:
219  IsolineAppearance(QWidget* parent): QWidget(parent), Ui_ContourAppearance(){
220  setupUi(this);
221  }
222  };
223 
226  class IsolineImage : public QWidget, public Ui_ContourImage {
227  public:
228  IsolineImage(QWidget* parent): QWidget(parent), Ui_ContourImage(){
229  setupUi(this);
230  }
231  };
234  class IsolineIsovals : public QWidget, public Ui_ContourIsovalues {
235  public:
236  IsolineIsovals(QWidget* parent): QWidget(parent), Ui_ContourIsovalues(){
237  setupUi(this);
238  }
239  };
240 
242  void CopyToProbe();
243 
245  void CopyTo2D();
246 
249  void fitIsovalsToHisto(IsolineParams* ip);
250 
254  void convertIsovalsToColors(TransferFunction* tf);
255 
257  void mapCursor();
258 
261  void resetImageSize(IsolineParams* iParams);
262 
265  virtual void refreshHistogram(RenderParams* p);
266 
268  virtual void wheelEvent(QWheelEvent*) {}
269 
270 #ifndef DOXYGEN_SKIP_THIS
271  //Tabs in the contours panel
272  VariablesWidget *_variables;
273  IsolineAppearance * _appearance;
274  LayoutWidget * _layout;
275  IsolineIsovals * _isovals;
276  IsolineImage *_image;
277  GLIsolineWindow* _glIsolineWindow;
278 
279  //Web help text
280  static const char* _webHelpText[];
281  static const char* _webHelpURL[];
282 
283  static const float _thumbSpeedFactor;
284  bool _seedAttached;
285  //FlowParams* attachedFlow;
286  //Flag to enable resetting of the variable listbox without
287  //triggering a gui changed event
288  bool _ignoreComboChanges;
289 
290  float _maxBoxSize[3];
291 
292  float _startRotateActualAngle;
293  float _startRotateViewAngle;
294  bool _renormalizedRotate;
295 
296  // remember iso interval between mouse press and release:
297  double _prevIsoMax,_prevIsoMin;
298 
299  Command* _savedCommand; //Save between start and end of isocontrol edits
300 #endif //DOXYGEN_SKIP_THIS
301 };
302 
303 };
304 
305 
306 #endif //ISOLINEEVENTROUTER_H
307 
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
A pure virtual class specifying the common properties of all the parameter tabs in the VAPOR GUI...
Definition: eventrouter.h:101
A QGLWidget that displays a Transfer Function Editor, or an Iso Selection Window. ...
Definition: mappingframe.h:76
static EventRouter * CreateTab()
An EventRouter subclass that handles the Contours tab in the GUI.
virtual MappingFrame * getMappingFrame()
The Isoline tab uses a mapping frame for iso selection.
Definition: DC.h:10
A class that manages the contents of the parameter tabs in VAPOR GUI.
Definition: tabmanager.h:60