summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2010-11-06 15:04:03 (GMT)
committerMarius Kintel <marius@kintel.net>2010-11-06 15:04:03 (GMT)
commitc1c5d8174d0a0949dcd27ee6c32e3d237b244c73 (patch)
treeab2a6a611ca19da9d163025a50c483333179e24f
parenteed6e69530486aa57a981940565ffc0013ef5bd7 (diff)
doc and cosmetics
-rw-r--r--src/PolySetCGALRenderer.cc3
-rw-r--r--src/Tree.cc13
-rw-r--r--src/Tree.h8
-rw-r--r--src/node.h11
-rw-r--r--src/render.cc3
5 files changed, 29 insertions, 9 deletions
diff --git a/src/PolySetCGALRenderer.cc b/src/PolySetCGALRenderer.cc
index b91098d..95e4806 100644
--- a/src/PolySetCGALRenderer.cc
+++ b/src/PolySetCGALRenderer.cc
@@ -324,7 +324,8 @@ PolySet *PolySetCGALRenderer::renderPolySet(const DxfLinearExtrudeNode &node, Ab
return ps;
}
-PolySet *PolySetCGALRenderer::renderPolySet(const DxfRotateExtrudeNode &node, AbstractPolyNode::render_mode_e)
+PolySet *PolySetCGALRenderer::renderPolySet(const DxfRotateExtrudeNode &node,
+ AbstractPolyNode::render_mode_e)
{
const string &cacheid = this->cgalrenderer.getTree().getString(node);
if (this->cache.contains(cacheid)) return this->cache[cacheid]->ps->link();
diff --git a/src/Tree.cc b/src/Tree.cc
index 1561b4f..a451f24 100644
--- a/src/Tree.cc
+++ b/src/Tree.cc
@@ -3,6 +3,10 @@
#include <assert.h>
+/*!
+ Returns the cached string representation of the subtree rootet by \a node.
+ If node is not cached, the cache will be rebuilt.
+*/
const std::string &Tree::getString(const AbstractNode &node) const
{
assert(this->root_node);
@@ -15,3 +19,12 @@ const std::string &Tree::getString(const AbstractNode &node) const
}
return this->nodecache[node];
}
+
+/*!
+ Sets a new root. Will clear the existing cache.
+ */
+void Tree::setRoot(const AbstractNode *root)
+{
+ this->root_node = root;
+ this->nodecache.clear();
+}
diff --git a/src/Tree.h b/src/Tree.h
index 88c55cb..2c3f0b8 100644
--- a/src/Tree.h
+++ b/src/Tree.h
@@ -5,13 +5,19 @@
using std::string;
+/*!
+ For now, just an abstraction of the node tree which keeps a dump
+ cache based on node indices around.
+
+ Note that since node trees don't survive a recompilation, the tree cannot either.
+ */
class Tree
{
public:
Tree(const AbstractNode *root = NULL) : root_node(root) {}
~Tree() {}
- void setRoot(const AbstractNode *root) { this->root_node = root; }
+ void setRoot(const AbstractNode *root);
const AbstractNode *root() const { return this->root_node; }
// FIXME: Really return a reference?
diff --git a/src/node.h b/src/node.h
index c333d80..7ef5f5c 100644
--- a/src/node.h
+++ b/src/node.h
@@ -4,10 +4,6 @@
#include <QCache>
#include <QVector>
-#ifdef ENABLE_CGAL
-#include "cgal.h"
-#endif
-
#include "traverser.h"
extern int progress_report_count;
@@ -17,6 +13,13 @@ extern void *progress_report_vp;
void progress_report_prep(AbstractNode *root, void (*f)(const class AbstractNode *node, void *vp, int mark), void *vp);
void progress_report_fin();
+/*!
+
+ The node tree is the result of evaluation of a module instantiation
+ tree. Both the module tree and the node tree are regenerated from
+ scratch for each compile.
+
+ */
class AbstractNode
{
// FIXME: the idx_counter/idx is mostly (only?) for debugging.
diff --git a/src/render.cc b/src/render.cc
index b85c446..8a58b7c 100644
--- a/src/render.cc
+++ b/src/render.cc
@@ -34,9 +34,6 @@
#include "printutils.h"
#include "progress.h"
#include "visitor.h"
-#ifdef ENABLE_CGAL
-# include "cgal.h"
-#endif
#include <QApplication>
#include <QTime>
contact: Jan Huwald // Impressum