-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNode.h
47 lines (37 loc) · 1.72 KB
/
Node.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
#pragma once
#ifndef NODE_H
#define NODE_H
#include <iostream>
#include <fstream>
#include <string>
#include "LinkedList.h"
#include "Structures.h"
class Tree;// utile juste pour éviter une déclaration récursive
struct IParam;// utile juste pour éviter une déclaration récursive
//class which contains all the information related to each node
//each node has its own parameters, then it gets a linked list of nodes called kids
class Node {
public:
Node(IParam* parameters, int level, Node* Parent, position positionKid);
~Node();
Node* getPrevious(); //finds the parent of the current node
LinkedList* getKids(); //finds the kids of the current node and returns it as a linked list
void setKids(Node* Kid, int branches, int whichKid); //very important, used to set all the poisition information of all the kids, used when the tree is first created
void setPrevious(Node* Parent); //since we need to tell each kid what its parent is
int getlevel(); //basic getter
void setLevel(int level);
void setPosition(int x, int y);
position getPosition();
position PositionKids(int branches,int whichKid);
int length();
int angle();
private:
position mPosition{};
Node* mPrevious=nullptr; // This can only contain one pointer to its parent
int mLength{}; //very useful later, set once and then reused every movement
LinkedList mKids = {}; // this points to a table of Nodes
float mAngle{}; //very useful later, set once and then reused every movement
int mLevel {}; // determines the level of the node inside a tree
IParam* TreeParameters = nullptr; // points to the parameters of the tree (all the same that were originally set by the user)
};
#endif