VAPOR3 3.9.4
VizWin.h
Go to the documentation of this file.
1//************************************************************************
2// *
3// Copyright (C) 2013 *
4// University Corporation for Atmospheric Research *
5// All Rights Reserved *
6// *
7//************************************************************************/
8//
9// File: VizWin.h
10//
11// Author: Alan Norton
12// National Center for Atmospheric Research
13// PO 3000, Boulder, Colorado
14//
15// Date: October 2013
16//
17//
18
19#ifndef VIZWIN_H
20#define VIZWIN_H
21
22#include <vapor/glutil.h>
23#include <QGLWidget>
24#include "vapor/Transform.h"
25#include "Manip.h"
26#include <QWheelEvent>
27
28class QCloseEvent;
29class QRect;
30class QMouseEvent;
31class QFocusEvent;
32
33class Visualizer;
34class Viewpoint;
35class Trackball;
36
37namespace VAPoR {
38class ControlExec;
39class Visualizer;
40struct GLManager;
41}; // namespace VAPoR
42
45
51
60class VizWin : public QGLWidget {
61 Q_OBJECT
62
63public:
64 VizWin(const QGLFormat &format, QWidget *parent, const QString &name, string winName, VAPoR::ControlExec *ce, Trackball *trackBall);
66
69 string getWindowName() { return _winName; }
70
71 // Render the scene
72 //
73 // If \p fast is true try to render the scene quickly
74 //
75 void Render(bool fast);
76
77signals:
78 // Sent prior to closing window - after receiving Qt closeEvent()
79 //
80 void Closing(const string &winName);
81
82 // Sent when window gains focus - after receiving Qt focusInEvent()
83 //
84 void HasFocus(const string &winName);
85
86 // Sent when window ends navigation
87 //
88 void EndNavigation(const string &winName);
89
90public slots:
91 virtual void setFocus();
92
93private:
94 void _renderHelper(bool fast);
95 void _preRender();
96 void _postRender();
97 void updateManip(bool initialize = false);
98 void _updateOriginGlyph();
99 void _drawContourSliceQuad();
100
101 // Event handling
102 // Virtual overrides:
103 virtual void wheelEvent(QWheelEvent *e) { e->accept(); }
104
105 // QWidget reimplementations
106 virtual void mousePressEvent(QMouseEvent *);
107 virtual void mouseReleaseEvent(QMouseEvent *);
108 virtual void mouseMoveEvent(QMouseEvent *);
109
110 virtual void _mousePressEventNavigate(QMouseEvent *);
111 virtual void _mouseReleaseEventNavigate(QMouseEvent *);
112 virtual void _mouseMoveEventNavigate(QMouseEvent *);
113
114 virtual void _mousePressEventManip(QMouseEvent *);
115 virtual void _mouseReleaseEventManip(QMouseEvent *);
116 virtual void _mouseMoveEventManip(QMouseEvent *);
117
118 virtual void focusInEvent(QFocusEvent *e);
119 virtual void closeEvent(QCloseEvent *);
120
121 // QGLWidget reimplementations
122 virtual void resizeGL(int width, int height);
123 virtual void initializeGL();
124
125 string _winName;
126 VAPoR::ControlExec *_controlExec;
127 VAPoR::GLManager * _glManager;
128 double _strHandleMid[3];
129 bool _insideRender = false;
130
131 bool _mouseClicked; // Indicates mouse has been clicked but not move
132 int _buttonNum; // currently pressed button (0=none, 1=left,2=mid, 3=right)
133 bool _navigateFlag;
134 bool _manipFlag;
135 bool _manipFlowSeedFlag = false;
136 bool _manipFlowIntegrationFlag = false;
137 Trackball *_trackBall;
138
139 std::vector<double> _getScreenCoords(QMouseEvent *e) const;
140 string _getCurrentMouseMode() const;
141 void _setNewExtents();
142 void _getActiveExtents(VAPoR::CoordType &minExts, VAPoR::CoordType &maxExts);
143 void _getUnionOfFieldVarExtents(VAPoR::RenderParams *rParams, VAPoR::DataMgr *dataMgr, int timestep, int refLevel, int lod, VAPoR::CoordType &minExts, VAPoR::CoordType &maxExts);
144 string _getCurrentDataMgrName() const;
145 VAPoR::Transform *_getDataMgrTransform() const;
146
147 void _getNearFarDist(const double posVec[3], const double dirVec[3], double &boxNear, double &boxFar) const;
148 VAPoR::RenderParams *_getRenderParams();
149 VAPoR::RenderParams *_getRenderParams(string &classType);
150
151 void _setUpProjMatrix();
152 void _setUpModelViewMatrix();
153
155
156 bool _openGLInitFlag;
157
158 friend class VizWinMgr;
159};
160
161#endif // VIZWIN_H
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
class that indicates location and direction of view
Definition: Transform.h:22
A Manip subclass for manipulators that stretch and translate.
Definition: Manip.h:147
A class for managing all visualizers.
Definition: VizWinMgr.h:49
A QGLWidget that supports display based on GL methods invoked in a Visualizer.
Definition: VizWin.h:60
VizWin(const QGLFormat &format, QWidget *parent, const QString &name, string winName, VAPoR::ControlExec *ce, Trackball *trackBall)
void Render(bool fast)
virtual void setFocus()
void Closing(const string &winName)
void EndNavigation(const string &winName)
void HasFocus(const string &winName)
string getWindowName()
Definition: VizWin.h:69
std::array< double, 3 > CoordType
Type for specifying floating point coordinates.
Definition: Grid.h:23
Contains references to context scope OpenGL data.
Definition: GLManager.h:18