VAPoR  3.0.0
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 <QGLWidget>
23 #include "vizwinmgr.h"
24 #include "visualizer.h"
25 #include <QWheelEvent>
26 #include "manip.h"
27 
28 class QCloseEvent;
29 class QRect;
30 class QMouseEvent;
31 class QFocusEvent;
32 
33 namespace VAPoR {
34 class MainForm;
35 class VizWinMgr;
36 class Visualizer;
37 class Viewpoint;
38 
51 class VizWin : public QGLWidget
52 {
53  Q_OBJECT
54 
55 public:
56 
59  void setWindowNum(int visIndex) {
60  _windowNum = visIndex;
61  }
64  int getWindowNum() {return _windowNum;}
65 
68  Visualizer* getVisualizer() {return _visualizer;}
69 
71  void reallyUpdate();
76  VizWin(MainForm* parent , const QString& name, VizWinMgr* myMgr, QRect* location , int winNum);
77  ~VizWin();
79 #ifndef DOXYGEN_SKIP_THIS
80 public slots:
81  virtual void setFocus();
82 
83 private:
84  virtual QSize minimumSizeHint() const
85  {return QSize(400,400);}
86 
87  QPoint _mouseDownPosition;
88  bool _mouseDownHere;
89  //Event handling
90  //Virtual overrides:
91  virtual void wheelEvent(QWheelEvent* e){
92  e->accept();
93  }
94  virtual void mousePressEvent(QMouseEvent*);
95  virtual void mouseReleaseEvent(QMouseEvent*);
96  virtual void mouseMoveEvent(QMouseEvent*);
97  virtual void focusInEvent(QFocusEvent* e);
98  virtual void closeEvent(QCloseEvent*);
99 
100  virtual void resizeGL(int width, int height);
101  virtual void initializeGL();
102  void paintGL();
103  void setMouseDown(bool downUp, TranslateStretchManip* manip = 0) {
104  _mouseDownHere = downUp;
105  if(manip) manip->setMouseDown(downUp);
106  }
107  bool mouseIsDown() {return _mouseDownHere;}
108 
109 
110  int _windowNum;
111  VizWinMgr* _vizWinMgr;
112  Visualizer* _visualizer;
113  //Variables to control spin animation:
114  QTime* _spinTimer;
115 
116  int _moveCount; //number of mouse move events since mouse press
117  int _moveCoords[2]; //position at last move event during rotation navigation
118  int _moveDist; //Distance between last two mouse move events
119  int _latestMoveTime; //most recent time of move
120  int _olderMoveTime; //time of move before the latest
121 #endif //DOXYGEN_SKIP_THIS
122 };
123 };
124 
125 #endif // VIZWIN_H
126 
int getWindowNum()
Definition: vizwin.h:64
VizWin(MainForm *parent, const QString &name, VizWinMgr *myMgr, QRect *location, int winNum)
A class for managing all visualizers.
Definition: vizwinmgr.h:69
void reallyUpdate()
Force the window to update, even if nothing has changed.
A class for performing OpenGL rendering in VAPOR GUI Window.
Definition: visualizer.h:61
void setWindowNum(int visIndex)
Definition: vizwin.h:59
Visualizer * getVisualizer()
Definition: vizwin.h:68
Definition: DC.h:10
A QGLWidget that supports display based on GL methods invoked in a Visualizer.
Definition: vizwin.h:51