-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderarea.h
More file actions
67 lines (54 loc) · 1.83 KB
/
renderarea.h
File metadata and controls
67 lines (54 loc) · 1.83 KB
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
61
62
63
64
65
66
67
#ifndef RENDERAREA_H
#define RENDERAREA_H
#include <QWidget>
#include <QColor>
#include <QPen>
class RenderArea : public QWidget
{
Q_OBJECT
public:
explicit RenderArea(QWidget *parent = 0);
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
QSize sizeHint() const Q_DECL_OVERRIDE;
enum ShapeType {
Astroid,
Cycloid,
HuygensCycloid,
HypoCycloid,
Line,
Circle
};
void setBackgroundColor (QColor color) { mbackgroundColor = color; } // setter
QColor BackgroundColor() const {return mbackgroundColor;} // getter
void setShapeColor (QColor color ) {mShapeColor = color; } // setter
QColor ShapeColor () const {return mShapeColor;} // getter
void setShape(ShapeType shape) { mShape = shape; on_shape_changed ();} // setter
ShapeType shape() const {return mShape;} // getter
void setScale (float scale ) {mScale = scale;repaint();} // setter
float scale () const {return mScale;} // getter
void setInterval (float interval ) { mIntervalLength = interval; repaint();} // setter
float intervalLength () const {return mIntervalLength;} // getter
void setStep (float step ) { mStepCount = step ; repaint();} // setter
int step () const {return mStepCount;} // getter
protected:
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
signals:
public slots:
private:
QPointF compute (float t); // dispatch function
QPointF compute_astroid(float t);
QPointF compute_cycloid(float t);
QPointF compute_huygens(float t);
QPointF compute_hypo(float t);
QPointF compute_line(float t);
QPointF compute_circle(float t);
void on_shape_changed ();
private:
QColor mbackgroundColor;
QColor mShapeColor ;
ShapeType mShape;
float mIntervalLength;
float mScale;
int mStepCount;
};
#endif // RENDERAREA_H