output_view.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef QT_OUTPUT_VIEW_HPP
  2. #define QT_OUTPUT_VIEW_HPP
  3. #include <QWidget>
  4. #include <QPainter>
  5. #include <QOpenGLWidget>
  6. #include <QMouseEvent>
  7. #include <GL/glut.h>
  8. #include "qt/output/solver.hpp"
  9. class QtOutputView:public QOpenGLWidget{
  10. private:
  11. static constexpr size_t const arrow_step_x=3;
  12. static constexpr size_t const arrow_step_z=7;
  13. static constexpr double const scale_arrow=12000;
  14. static constexpr double const scale_arrow_head=0.3;
  15. size_t nX;
  16. double dX,lX;
  17. double factor;
  18. QtSolver* solver;
  19. size_t step;
  20. public:
  21. QtOutputView(QtSolver* solver);
  22. ~QtOutputView();
  23. void initializeGL();
  24. void resizeGL(int x,int h);
  25. void paintGL();
  26. double getP(size_t ix,size_t iz);
  27. double getPl(size_t ix);
  28. double getl(size_t ix);
  29. double getHydr(size_t ix);
  30. void setColor(size_t ix,size_t iz);
  31. /* void paintEvent(QPaintEvent* event);*/
  32. void draw(size_t t);
  33. void drawTriangle(size_t ix1,size_t iz1,size_t ix2,size_t iz2,size_t ix3,size_t iz3);
  34. void mousePressEvent(QMouseEvent* event);
  35. void displayInfos(double x,double y);
  36. void drawVector(size_t ix,size_t iz,double u,double v);
  37. void drawVectors();
  38. void drawPump(Pump* pump);
  39. };
  40. inline
  41. QtOutputView::~QtOutputView(){
  42. }
  43. inline double
  44. QtOutputView::getP(size_t ix,size_t iz){
  45. return solver->get_solution(step)->P[ix][iz];
  46. }
  47. inline double
  48. QtOutputView::getPl(size_t ix){
  49. return solver->get_solution(step)->Pl[ix];
  50. }
  51. inline double
  52. QtOutputView::getl(size_t ix){
  53. return solver->get_solution(step)->l[ix];
  54. }
  55. inline double
  56. QtOutputView::getHydr(size_t ix){
  57. return solver->get_solution(step)->hydr[ix];
  58. }
  59. #endif