output_view.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. void drawOverland();
  40. };
  41. inline
  42. QtOutputView::~QtOutputView(){
  43. }
  44. inline double
  45. QtOutputView::getP(size_t ix,size_t iz){
  46. return solver->get_solution(step)->P[ix][iz];
  47. }
  48. inline double
  49. QtOutputView::getPl(size_t ix){
  50. return solver->get_solution(step)->Pl[ix];
  51. }
  52. inline double
  53. QtOutputView::getl(size_t ix){
  54. return solver->get_solution(step)->l[ix];
  55. }
  56. inline double
  57. QtOutputView::getHydr(size_t ix){
  58. return solver->get_solution(step)->hydr[ix];
  59. }
  60. #endif