diff options
author | Marius Kintel <marius@kintel.net> | 2011-09-11 05:37:14 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-09-11 05:37:14 (GMT) |
commit | 9afeded46c0e9023002dc04ba6131adcb39762b1 (patch) | |
tree | 0096a12ce36a5b39aa18d7ec5da45c05eb3d42dd /src/CGALEvaluator.cc | |
parent | b087e68e5430c3dde6adfe452becbaba0f680196 (diff) | |
parent | dc7eeb30d06a928a30ee47a765be3e5a61288d35 (diff) |
Merge branch 'polyset-cleanup' into visitor
Diffstat (limited to 'src/CGALEvaluator.cc')
-rw-r--r-- | src/CGALEvaluator.cc | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index 34911b1..51fe41a 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -91,8 +91,7 @@ void CGALEvaluator::applyToChildren(const AbstractNode &node, CGALEvaluator::Csg chnode->progress_report(); } } - const std::string &cacheid = this->tree.getString(node); - this->cache.insert(cacheid, N); + this->cache.insert(this->tree.getString(node), N); } extern CGAL_Nef_polyhedron2 *convexhull2(std::list<CGAL_Nef_polyhedron2*> a); @@ -123,8 +122,7 @@ void CGALEvaluator::applyHull(const CgaladvNode &node) if (all2d) { CGAL_Nef_polyhedron N(convexhull2(polys)); - const std::string &cacheid = this->tree.getString(node); - this->cache.insert(cacheid, N); + this->cache.insert(this->tree.getString(node), N); } } } @@ -216,7 +214,6 @@ Response CGALEvaluator::visit(State &state, const TransformNode &node) dxf_tesselate(&ps, *dd, 0, true, false, 0); N = evaluateCGALMesh(ps); - ps.refcount = 0; delete dd; } else if (N.dim == 3) { @@ -226,8 +223,7 @@ Response CGALEvaluator::visit(State &state, const TransformNode &node) node.matrix[2], node.matrix[6], node.matrix[10], node.matrix[14], node.matrix[15]); N.p3->transform(t); } - const std::string &cacheid = this->tree.getString(node); - this->cache.insert(cacheid, N); + this->cache.insert(this->tree.getString(node), N); } addToParent(state, node); } @@ -240,23 +236,19 @@ Response CGALEvaluator::visit(State &state, const AbstractPolyNode &node) if (state.isPostfix()) { if (!isCached(node)) { // Apply polyset operation - PolySet *ps = node.evaluate_polyset(AbstractPolyNode::RENDER_CGAL, &this->psevaluator); + shared_ptr<PolySet> ps = this->psevaluator.getPolySet(node, false); CGAL_Nef_polyhedron N; if (ps) { try { N = evaluateCGALMesh(*ps); // print_messages_pop(); node.progress_report(); - - ps->unlink(); } - catch (...) { // Don't leak the PolySet on ProgressCancelException - ps->unlink(); + catch (...) { throw; } } - const std::string &cacheid = this->tree.getString(node); - this->cache.insert(cacheid, N); + this->cache.insert(this->tree.getString(node), N); } addToParent(state, node); } @@ -316,7 +308,7 @@ CGAL_Nef_polyhedron CGALEvaluator::evaluateCGALMesh(const AbstractPolyNode &node // print_messages_push(); - PolySet *ps = node.evaluate_polyset(AbstractPolyNode::RENDER_CGAL); + shared_ptr<PolySet> ps = this->psevaluator->getPolySet(node, false); if (ps) { try { CGAL_Nef_polyhedron N = ps->evaluateCSGMesh(); @@ -324,11 +316,9 @@ CGAL_Nef_polyhedron CGALEvaluator::evaluateCGALMesh(const AbstractPolyNode &node // print_messages_pop(); node.progress_report(); - ps->unlink(); return N; } catch (...) { // Don't leak the PolySet on ProgressCancelException - ps->unlink(); throw; } } |