summaryrefslogtreecommitdiff
path: root/tests/CSGTextRenderer.h
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2010-08-30 22:52:39 (GMT)
committerMarius Kintel <marius@kintel.net>2010-10-31 00:42:39 (GMT)
commit728f4ac7901c8cfe1724b90effc96bd15ffb3fd0 (patch)
tree4cfc679debe8c42584f159052aefc66073aa273c /tests/CSGTextRenderer.h
parent067bc0ab31be36961a53a56a317c5c939f7cf11a (diff)
Moved more tests from test-code to tests
Diffstat (limited to 'tests/CSGTextRenderer.h')
-rw-r--r--tests/CSGTextRenderer.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/CSGTextRenderer.h b/tests/CSGTextRenderer.h
new file mode 100644
index 0000000..79a8a96
--- /dev/null
+++ b/tests/CSGTextRenderer.h
@@ -0,0 +1,40 @@
+#ifndef CSGTEXTRENDERER_H_
+#define CSGTEXTRENDERER_H_
+
+#include "visitor.h"
+#include "CSGTextCache.h"
+
+#include <map>
+#include <list>
+
+using std::string;
+using std::map;
+using std::list;
+
+class CSGTextRenderer : public Visitor
+{
+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 CsgNode &node);
+ virtual Response visit(State &state, const TransformNode &node);
+ virtual Response visit(State &state, const AbstractPolyNode &node);
+
+private:
+ enum CsgOp {UNION, INTERSECTION, DIFFERENCE, MINKOWSKI};
+ void addToParent(const State &state, const AbstractNode &node);
+ bool isCached(const AbstractNode &node);
+ void process(string &target, const string &src, CSGTextRenderer::CsgOp op);
+ void applyToChildren(const AbstractNode &node, CSGTextRenderer::CsgOp op);
+
+ string currindent;
+ typedef list<const AbstractNode *> ChildList;
+ map<int, ChildList> visitedchildren;
+
+ CSGTextCache &cache;
+};
+
+#endif
contact: Jan Huwald // Impressum