-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.h
More file actions
100 lines (77 loc) · 2.17 KB
/
node.h
File metadata and controls
100 lines (77 loc) · 2.17 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#pragma once
#include <QTreeWidgetItem>
#include <QString>
#include <vector>
#include "smartpointerhelp.h"
#include "drawable.h"
#include "scene/polygon.h"
class Node : public QTreeWidgetItem {
private:
Polygon2D* geom;
glm::vec3 rgbcolor;
int type;
QString nodeName;
std::vector<uPtr<Node>> ptrchildren;
public:
//in every class you have to define:
//constructors
Node();
Node(QString nodeName);
Node(const Node &node); //copy
Node &addNewChild(uPtr<Node> node);
Node(const QString &nodeName, Polygon2D *p, int type = 0);
//getters for each public value
Polygon2D* returnPolygon();
const QString returnNameofString();
const glm::vec3 returnColor();
const std::vector<uPtr<Node>> &getChildren();
//setters
void set2DPolygon(Polygon2D *geom);
void setColor(glm::vec3 rgbcolor);
virtual void setValue(float v, int index) = 0;
int getType();
virtual float getValue(int index) = 0;
//and then your primary functions
virtual glm::mat3 transform() = 0;
virtual ~Node();
};
class TranslateNode : public Node {
private:
float x;
float y;
public:
TranslateNode(float x, float y, const QString &nodeName, Polygon2D *p);
float returnXvalue();
float returnYvalue();
float getValue(int index);
void translate(float x, float y);
glm::mat3 transform();
void setValue(float v, int index);
virtual ~TranslateNode();
};
class RotateNode : public Node {
private:
float degree;
public:
RotateNode( float degree, const QString &nodeName, Polygon2D *p);
void setValue(float v, int index);
float getValue(int index);
float returnDegree();
glm::mat3 transform();
void rotate(float degree);
virtual ~RotateNode();
};
class ScaleNode : public Node {
private:
float scalex;
float scaley;
public:
ScaleNode(float scalex, float scaley, const QString &nodeName, Polygon2D *p);
float returnscaleX();
float returnscaleY();
void setValue(float v, int index);
float getValue(int index);
void scale(float scalex, float scaley);
glm::mat3 transform();
virtual ~ScaleNode();
};