summaryrefslogtreecommitdiff
path: root/src/PolySetEvaluator.h
blob: 9a72ff7cb0000157a62fe568d40362b87dfd6317 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef POLYSETEVALUATOR_H_
#define POLYSETEVALUATOR_H_

#include "myqhash.h"
#include "node.h"
#include <QCache>

class PolySetEvaluator
{
public:
	enum EvaluateMode { EVALUATE_CGAL, EVALUATE_OPENCSG };
	PolySetEvaluator() : cache(100) {}

	virtual ~PolySetEvaluator() {}

	virtual PolySet *evaluatePolySet(const class ProjectionNode &, AbstractPolyNode::render_mode_e) = 0;
	virtual PolySet *evaluatePolySet(const class DxfLinearExtrudeNode &, AbstractPolyNode::render_mode_e) = 0;
	virtual PolySet *evaluatePolySet(const class DxfRotateExtrudeNode &, AbstractPolyNode::render_mode_e) = 0;
	virtual PolySet *evaluatePolySet(const class CgaladvNode &, AbstractPolyNode::render_mode_e) = 0;

	void clearCache() {
		this->cache.clear();
	}

protected:

	struct cache_entry {
		class PolySet *ps;
		QString msg;
		cache_entry(PolySet *ps);
		~cache_entry();
	};

	QCache<std::string, cache_entry> cache;

private:
	static PolySetEvaluator *global_evaluator;
};

#endif
contact: Jan Huwald // Impressum