diff options
author | Marius Kintel <marius@kintel.net> | 2010-08-28 19:21:44 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2010-10-31 00:42:38 (GMT) |
commit | d0390c41a2268ce23d3010c7085e4365725d2f49 (patch) | |
tree | d3f2e6b0cc58a66ff759740ddcf27191335076aa /test-code | |
parent | 93f3d4a1b6251523428179261dc070df44b0b317 (diff) |
Added AbstractNode::name(), changed CSGTextRenderer to use this instead of the rtti name
Diffstat (limited to 'test-code')
-rw-r--r-- | test-code/CSGTextRenderer.cc | 15 | ||||
-rw-r--r-- | test-code/CSGTextRenderer.h | 10 |
2 files changed, 12 insertions, 13 deletions
diff --git a/test-code/CSGTextRenderer.cc b/test-code/CSGTextRenderer.cc index 6f1010c..b55c88f 100644 --- a/test-code/CSGTextRenderer.cc +++ b/test-code/CSGTextRenderer.cc @@ -50,8 +50,7 @@ CSGTextRenderer::process(string &target, const string &src, CSGTextRenderer::Csg void CSGTextRenderer::applyToChildren(const AbstractNode &node, CSGTextRenderer::CsgOp op) { std::stringstream stream; - stream << typeid(node).name(); - stream << "<" << node.index() << ">"; + stream << node.name() << node.index(); string N = stream.str(); if (this->visitedchildren[node.index()].size() > 0) { // FIXME: assert that cache contains nodes in code below @@ -84,7 +83,7 @@ void CSGTextRenderer::applyToChildren(const AbstractNode &node, CSGTextRenderer: o In postfix: addToParent() */ -Response CSGTextRenderer::visit(const State &state, const AbstractNode &node) +Response CSGTextRenderer::visit(State &state, const AbstractNode &node) { if (state.isPrefix() && isCached(node)) return PruneTraversal; if (state.isPostfix()) { @@ -94,7 +93,7 @@ Response CSGTextRenderer::visit(const State &state, const AbstractNode &node) return ContinueTraversal; } -Response CSGTextRenderer::visit(const State &state, const AbstractIntersectionNode &node) +Response CSGTextRenderer::visit(State &state, const AbstractIntersectionNode &node) { if (state.isPrefix() && isCached(node)) return PruneTraversal; if (state.isPostfix()) { @@ -104,7 +103,7 @@ Response CSGTextRenderer::visit(const State &state, const AbstractIntersectionNo return ContinueTraversal; } -Response CSGTextRenderer::visit(const State &state, const CsgNode &node) +Response CSGTextRenderer::visit(State &state, const CsgNode &node) { if (state.isPrefix() && isCached(node)) return PruneTraversal; if (state.isPostfix()) { @@ -128,7 +127,7 @@ Response CSGTextRenderer::visit(const State &state, const CsgNode &node) return ContinueTraversal; } -Response CSGTextRenderer::visit(const State &state, const TransformNode &node) +Response CSGTextRenderer::visit(State &state, const TransformNode &node) { if (state.isPrefix() && isCached(node)) return PruneTraversal; if (state.isPostfix()) { @@ -151,7 +150,7 @@ Response CSGTextRenderer::visit(const State &state, const TransformNode &node) // DxfRotateExtrudeNode // (SurfaceNode) // (PrimitiveNode) -Response CSGTextRenderer::visit(const State &state, const AbstractPolyNode &node) +Response CSGTextRenderer::visit(State &state, const AbstractPolyNode &node) { if (state.isPrefix() && isCached(node)) return PruneTraversal; if (state.isPostfix()) { @@ -160,7 +159,7 @@ Response CSGTextRenderer::visit(const State &state, const AbstractPolyNode &node // FIXME: Manage caching // FIXME: Will generate one single Nef polyhedron (no csg ops necessary) - string N = typeid(node).name(); + string N = node.name(); this->cache.insert(node, N); // std::cout << "Insert: " << N << "\n"; diff --git a/test-code/CSGTextRenderer.h b/test-code/CSGTextRenderer.h index 4085e60..79a8a96 100644 --- a/test-code/CSGTextRenderer.h +++ b/test-code/CSGTextRenderer.h @@ -17,11 +17,11 @@ public: CSGTextRenderer(CSGTextCache &cache) : cache(cache) {} virtual ~CSGTextRenderer() {} - virtual Response visit(const State &state, const AbstractNode &node); - virtual Response visit(const State &state, const AbstractIntersectionNode &node); - virtual Response visit(const State &state, const CsgNode &node); - virtual Response visit(const State &state, const TransformNode &node); - virtual Response visit(const State &state, const AbstractPolyNode &node); + 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}; |