2010-03-28 20:03:44 +04:00
|
|
|
#ifndef CSGTEXTRENDERER_H_
|
|
|
|
#define CSGTEXTRENDERER_H_
|
|
|
|
|
2010-04-12 08:57:02 +04:00
|
|
|
#include "visitor.h"
|
|
|
|
#include "CSGTextCache.h"
|
2013-11-15 06:17:41 +04:00
|
|
|
#include "enums.h"
|
2010-04-12 04:16:36 +04:00
|
|
|
|
2010-03-28 20:03:44 +04:00
|
|
|
#include <map>
|
|
|
|
#include <list>
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
using std::map;
|
|
|
|
using std::list;
|
|
|
|
|
|
|
|
class CSGTextRenderer : public Visitor
|
|
|
|
{
|
|
|
|
public:
|
2010-04-12 08:57:02 +04:00
|
|
|
CSGTextRenderer(CSGTextCache &cache) : cache(cache) {}
|
2010-03-28 20:03:44 +04:00
|
|
|
virtual ~CSGTextRenderer() {}
|
|
|
|
|
2010-08-28 23:21:44 +04:00
|
|
|
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);
|
2010-03-28 20:03:44 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
void addToParent(const State &state, const AbstractNode &node);
|
|
|
|
bool isCached(const AbstractNode &node);
|
2013-11-15 06:17:41 +04:00
|
|
|
void process(string &target, const string &src, OpenSCADOperator op);
|
|
|
|
void applyToChildren(const AbstractNode &node, OpenSCADOperator op);
|
2010-03-28 20:03:44 +04:00
|
|
|
|
|
|
|
string currindent;
|
2010-04-12 08:57:02 +04:00
|
|
|
typedef list<const AbstractNode *> ChildList;
|
2010-03-28 20:03:44 +04:00
|
|
|
map<int, ChildList> visitedchildren;
|
|
|
|
|
2010-04-12 08:57:02 +04:00
|
|
|
CSGTextCache &cache;
|
2010-03-28 20:03:44 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|