mantaflow  0.10
A framework for fluid simulation
mainwindow.h
Go to the documentation of this file.
1 
2 /******************************************************************************
3  *
4  * MantaFlow fluid solver framework
5  * Copyright 2011 Tobias Pfaff, Nils Thuerey
6  *
7  * This program is free software, distributed under the terms of the
8  * GNU General Public License (GPL)
9  * http://www.gnu.org/licenses
10  *
11  * QT main window
12  *
13  ******************************************************************************/
14 
15 #ifndef _MAINWINDOW_H_
16 #define _MAINWINDOW_H_
17 
18 #include <QMainWindow>
19 #include <QMenuBar>
20 #include "glwidget.h"
21 #include "customctrl.h"
22 #include "painter.h"
23 #include <vector>
24 
25 namespace Manta {
26 class Mesh;
27 
28 class MainWnd : public QMainWindow
29 {
30 Q_OBJECT
31 public:
32  enum EventType { EventFullUpdate = QEvent::User, EventGuiShow,
33  EventStepUpdate, EventFinalUpdate, EventInstantKill, EventSet2DCam };
34 
35  MainWnd();
36  virtual ~MainWnd();
37  bool event(QEvent* e);
38  void keyPressEvent(QKeyEvent* e);
39  void keyReleaseEvent(QKeyEvent* e);
40  inline bool pauseRequest() { return mRequestPause && !mRequestClose; }
41  inline bool closeRequest() { return mRequestClose; }
42  void setPauseStatus(bool v);
43  void stepReset(bool fullUpdate) { if (mStep == 1 || (mStep == 2 && fullUpdate)) {mRequestPause = true; mStep = 0;} }
44  void requestClose() { mRequestClose =true; }
45  void setStep(int f, float time);
46  void setBackground(Mesh *m) { emit setBackgroundMesh(m); }
47 
48 public slots:
49  void pause();
50  void play();
51  void step();
52  void showHelp();
53  void addControl(void* ctrl);
54  void screenshot(QString file);
55  void clickLine(QPoint pos, float p0, float p1,float p2, float q0, float q1, float q2);
56 
57  void nextRealGrid();
58  void nextVec3Grid();
59  void nextMesh();
60  void nextParts();
61  void nextPdata();
62  void nextVec3Display();
63  void nextPartDisplay();
64  void nextMeshDisplay();
65  void toggleHideGrids();
66 
67  void setCamPos(float x, float y, float z);
68  void setCamRot(float x, float y, float z);
69  void windowSize(int w, int h);
70 
71 signals:
72  void painterEvent(int e, int param=0);
73  void wakeMain();
74  void setBackgroundMesh(Mesh* bgr);
75  void killMain();
76  void exitApp();
77 
78 protected:
79  bool mPaused, mRequestPause, mRequestClose;
80  int mStep;
81  GLWidget *mGlWidget;
82  QAction *mAcPlay, *mAcPause;
83  std::vector<Painter*> mPainter;
84  std::vector<CustomControl*> mCtrls;
85  QLabel* mInfo;
86  QVBoxLayout* mPainterLayout;
87 
88  // keyboard info window
89  QAction *mAcHelp;
90  QGraphicsScene *mKbwScene;
91  QGraphicsView *mKbwView;
92  QGraphicsPixmapItem *mKbwPixmap;
93 
94  QMenu *mMenuBar;
95 };
96 
97 }
98 
99 #endif
100 
101 
Definition: commonkernels.h:22
Definition: glwidget.h:24
Definition: mainwindow.h:28
Triangle mesh class.
Definition: mesh.h:126