-
Notifications
You must be signed in to change notification settings - Fork 0
/
TextRendering.cpp
48 lines (39 loc) · 1.15 KB
/
TextRendering.cpp
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
#include "TextRendering.hpp"
#include <iostream>
#include <vector>
using namespace std;
TextRendering::TextRendering(ostream &stream): out(stream) { }
void TextRendering::visitParentNode(sgraph::ParentSGNode *node) {
visitNode(node);
vector<sgraph::SGNode *> nodes = node->getChildren();
layer++;
for (auto &child : nodes) {
child->accept(this);
}
layer--;
}
void TextRendering::visitNode(sgraph::AbstractSGNode *node) {
if (layer != 0) {
out << string((layer - 1) * 4, ' ');
out << " - ";
}
out << node->getName() << endl;
}
void TextRendering::visitGroupNode(sgraph::GroupNode *node) {
visitParentNode(node);
}
void TextRendering::visitLeafNode(sgraph::LeafNode *node) {
visitNode(node);
}
void TextRendering::visitTransformNode(sgraph::TransformNode *node) {
visitParentNode(node);
}
void TextRendering::visitScaleTransform(sgraph::ScaleTransform *node) {
visitParentNode(node);
}
void TextRendering::visitTranslateTransform(sgraph::TranslateTransform *node) {
visitParentNode(node);
}
void TextRendering::visitRotateTransform(sgraph::RotateTransform *node) {
visitParentNode(node);
}