-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphicfunction.h
65 lines (52 loc) · 1.3 KB
/
graphicfunction.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
61
62
63
64
65
#ifndef GRAPHICFUNCTION_H
#define GRAPHICFUNCTION_H
#include <QPointF>
#include <string>
#include <stack>
#include <cmath>
#include <QDebug>
#include <QPainter>
#include "utils.h"
#include "parser.h"
#include "settings.h"
#include "QPolygon"
#include "scaleaxewidget.h"
class ScaleAxeWidget;
class GraphicFunction
{
public:
GraphicFunction();
struct BezierPoint
{
BezierPoint();
BezierPoint(QPointF _cp1, QPointF _cp2, QPointF _point) :
cp1{_cp1},
cp2{_cp2},
point{_point}
{}
QPointF cp1;
QPointF cp2;
QPointF point;
};
void draw(QPainter& painter);
void scale(const double ratioX, const double ratioY);
QColor getColor() const;
void setColor(const QColor& value);
QString getInputUserExpression() const;
void setInputUserExpression(const QString value);
void calculatePoints();
private:
Parser expressionPolish;
QString inputUserExpression;
QVector<QPointF> points;
//QStack<QPointF> points;
double lastScaleRatioX{1};
double lastScaleRatioY{1};
double factorX;
double factorY;
QColor color{Qt::black};
bool isPointInWindow(QPointF point);
std::vector<BezierPoint> bezierPoints;
void createBezierPoints();
};
#endif // GRAPHICFUNCTION_H