summaryrefslogtreecommitdiff
path: root/test-code/CSGTextRenderer.h
diff options
context:
space:
mode:
Diffstat (limited to 'test-code/CSGTextRenderer.h')
-rw-r--r--test-code/CSGTextRenderer.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/test-code/CSGTextRenderer.h b/test-code/CSGTextRenderer.h
index 22d722f..236f900 100644
--- a/test-code/CSGTextRenderer.h
+++ b/test-code/CSGTextRenderer.h
@@ -1,11 +1,15 @@
#ifndef CSGTEXTRENDERER_H_
#define CSGTEXTRENDERER_H_
+#include <qglobal.h>
#include <string>
+extern uint qHash(const std::string &);
+
#include <map>
#include <list>
+#include <QHash>
#include "visitor.h"
-#include "nodecache.h"
+#include "Tree.h"
using std::string;
using std::map;
@@ -15,8 +19,8 @@ using std::pair;
class CSGTextRenderer : public Visitor
{
public:
- enum CsgOp {UNION, INTERSECTION, DIFFERENCE, MINKOWSKI};
- CSGTextRenderer(const NodeCache<string> &dumpcache) : root(NULL), dumpcache(dumpcache) {}
+ CSGTextRenderer(QHash<string, string> &cache, const Tree &tree) :
+ cache(cache), tree(tree) {}
virtual ~CSGTextRenderer() {}
virtual Response visit(const State &state, const AbstractNode &node);
@@ -25,21 +29,19 @@ public:
virtual Response visit(const State &state, const TransformNode &node);
virtual Response visit(const State &state, const AbstractPolyNode &node);
- string getCSGString() const;
private:
+ enum CsgOp {UNION, INTERSECTION, DIFFERENCE, MINKOWSKI};
void addToParent(const State &state, const AbstractNode &node);
bool isCached(const AbstractNode &node);
- QString mk_cache_id(const AbstractNode &node) const;
void process(string &target, const string &src, CSGTextRenderer::CsgOp op);
void applyToChildren(const AbstractNode &node, CSGTextRenderer::CsgOp op);
string currindent;
- const AbstractNode *root;
- typedef list<pair<const AbstractNode *, QString> > ChildList;
+ typedef list<pair<const AbstractNode *, string> > ChildList;
map<int, ChildList> visitedchildren;
- QHash<QString, string> cache;
- const NodeCache<string> &dumpcache;
+ QHash<string, string> &cache;
+ const Tree &tree;
};
#endif
contact: Jan Huwald // Impressum