File: CSGTextRenderer.h

package info (click to toggle)
openscad 2021.01-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 35,608 kB
  • sloc: cpp: 53,187; sh: 4,384; ansic: 4,382; python: 1,813; yacc: 853; javascript: 762; lex: 417; lisp: 163; xml: 127; makefile: 114
file content (40 lines) | stat: -rw-r--r-- 1,089 bytes parent folder | download | duplicates (5)
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
#ifndef CSGTEXTRENDERER_H_
#define CSGTEXTRENDERER_H_

#include "NodeVisitor.h"
#include "CSGTextCache.h"
#include "enums.h"

#include <map>
#include <list>

using std::string;
using std::map;
using std::list;

class CSGTextRenderer : public NodeVisitor
{
public:
	CSGTextRenderer(CSGTextCache &cache) : cache(cache) {}
	virtual ~CSGTextRenderer() {}

	virtual Response visit(State &state, const AbstractNode &node);
	virtual Response visit(State &state, const AbstractIntersectionNode &node);
	virtual Response visit(State &state, const CsgOpNode &node);
	virtual Response visit(State &state, const TransformNode &node);
	virtual Response visit(State &state, const AbstractPolyNode &node);

private:
	void addToParent(const State &state, const AbstractNode &node);
	bool isCached(const AbstractNode &node);
	void process(string &target, const string &src, OpenSCADOperator op);
	void applyToChildren(const AbstractNode &node, OpenSCADOperator op);

	string currindent;
	typedef list<const AbstractNode *> ChildList;
	map<int, ChildList> visitedchildren;

	CSGTextCache &cache;
};

#endif