summaryrefslogtreecommitdiff
path: root/src/cgalworker.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgalworker.cc')
-rw-r--r--src/cgalworker.cc40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/cgalworker.cc b/src/cgalworker.cc
new file mode 100644
index 0000000..30bb1fe
--- /dev/null
+++ b/src/cgalworker.cc
@@ -0,0 +1,40 @@
+#include "cgalworker.h"
+#include <QThread>
+
+#include "Tree.h"
+#include "CGALEvaluator.h"
+#include "progress.h"
+#include "printutils.h"
+
+CGALWorker::CGALWorker()
+{
+ this->thread = new QThread();
+ connect(this->thread, SIGNAL(started()), this, SLOT(work()));
+ moveToThread(this->thread);
+}
+
+CGALWorker::~CGALWorker()
+{
+ delete this->thread;
+}
+
+void CGALWorker::start(const Tree &tree)
+{
+ this->tree = &tree;
+ this->thread->start();
+}
+
+void CGALWorker::work()
+{
+ CGAL_Nef_polyhedron *root_N = NULL;
+ try {
+ CGALEvaluator evaluator(*this->tree);
+ root_N = new CGAL_Nef_polyhedron(evaluator.evaluateCGALMesh(*this->tree->root()));
+ }
+ catch (ProgressCancelException e) {
+ PRINT("Rendering cancelled.");
+ }
+
+ emit done(root_N);
+ thread->quit();
+}
contact: Jan Huwald // Impressum