Visualization 2 - Lab Course
 All Classes Functions Enumerations Enumerator
TransferWidget.hpp
1 #ifndef TRANSFORMWIDGET_HPP_
2 #define TRANSFORMWIDGET_HPP_
3 
4 #include <QGraphicsView>
5 #include <QGraphicsScene>
6 #include <QPainterPath>
7 #include <QList>
8 
9 #include "TransferPoint.hpp"
10 
16 class TransferWidget : public QGraphicsView
17 {
18  Q_OBJECT
19 
20 public:
21 
25  struct TransferFeature {
26  float pos;
27  float sigma;
28  float alpha;
29  QColor color;
30  };
31 
37  TransferWidget(QWidget *parent);
38 
43  void redrawScene();
44 
49  std::vector<TransferFeature> getTransferControlValues();
50 
55  int getNumPoints();
56 
60  void clear();
61 
70  void setNewRGBXY(float _red, float _green, float _blue, float _x, float _y);
71 
77  void resizeEvent(QResizeEvent *event);
78 
79 signals:
80  void transferChanged();
81 
82 private:
83  QGraphicsScene *scene;
84  QGraphicsPathItem *background;
85  QList<QGraphicsLineItem *> lines;
86  QList<TransferPoint *> points;
87 
91  void fillBackground();
92 
98  void mousePressEvent(QMouseEvent *event);
99 
105  void mouseMoveEvent(QMouseEvent *event);
106 };
107 
108 #endif /* TRANSFORMWIDGET_HPP_ */