-
Notifications
You must be signed in to change notification settings - Fork 0
/
DensityPlotWidget.h
60 lines (53 loc) · 1.4 KB
/
DensityPlotWidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* DensityPlotWidget.h
*
* Created on: Apr 25, 2010
* Author: Vincent
*
* Provide the canvas for density plot
*
*/
#ifndef DENSITYPLOTWIDGET_H_
#define DENSITYPLOTWIDGET_H_
#include <QLabel>
#include <QImage>
#include <QColor>
class DensityPlotWidget: public QLabel {
Q_OBJECT
public:
DensityPlotWidget(QWidget *parent = 0);
virtual ~DensityPlotWidget();
public slots:
void setRange(int low, int high);
void clear();
void drawValue(double value);
void drawValues(const QList<double> &values);
void drawHighlightedValue(double value);
void drawHighlightedValues(const QList<double> &values);
void drawSelectedValue(double value);
void drawSelectedValues(const QList<double> &values);
void setDimension(int width, int height);
void setColor(const QColor & color);
void setTickNumber(int numOfTicks);
void setPlotWidth(int width);
void setPlotHeight(int height);
protected:
void paintEvent(QPaintEvent *event);
void drawFrame(QPainter *painter);
void drawValues(QPainter *painter, const QList<double> &list);
void drawValues(QPainter *painter);
void drawHighlightedValues(QPainter *painter);
void drawSelectedValues(QPainter *painter);
void drawLabels(QPainter *painter);
private:
QList<double> valueList;
QList<double> hlList;
QList<double> selList;
int rangeLow, rangeHigh;
QImage image;
double h, w;
double margin;
int tickNumber;
QColor color;
};
#endif /* DENSITYPLOTWIDGET_H_ */