Cleaned up some unnecessary includes

stl_dim
Marius Kintel 2011-10-01 01:36:30 +02:00
parent 0c2053caf9
commit 84e98b178a
39 changed files with 71 additions and 123 deletions

View File

@ -166,6 +166,8 @@ HEADERS += src/renderer.h \
src/Tree.h \
src/mathc99.h \
src/memory.h \
src/linalg.h \
src/system-gl.h \
src/stl-utils.h
SOURCES += src/openscad.cc \

View File

@ -11,6 +11,7 @@
#include "polyset.h"
#include "dxfdata.h"
#include "dxftess.h"
#include "Tree.h"
#include "CGALCache.h"
#include "cgal.h"

View File

@ -3,7 +3,6 @@
#include "myqhash.h"
#include "visitor.h"
#include "Tree.h"
#include "CGAL_Nef_polyhedron.h"
#include "PolySetCGALEvaluator.h"
@ -11,16 +10,11 @@
#include <map>
#include <list>
using std::string;
using std::map;
using std::list;
using std::pair;
class CGALEvaluator : public Visitor
{
public:
enum CsgOp {CGE_UNION, CGE_INTERSECTION, CGE_DIFFERENCE, CGE_MINKOWSKI};
CGALEvaluator(const Tree &tree) : tree(tree), psevaluator(*this) {}
CGALEvaluator(const class Tree &tree) : tree(tree), psevaluator(*this) {}
virtual ~CGALEvaluator() {}
virtual Response visit(State &state, const AbstractNode &node);
@ -42,9 +36,9 @@ private:
CGAL_Nef_polyhedron applyToChildren(const AbstractNode &node, CGALEvaluator::CsgOp op);
CGAL_Nef_polyhedron applyHull(const CgaladvNode &node);
string currindent;
typedef list<pair<const AbstractNode *, string> > ChildList;
map<int, ChildList> visitedchildren;
std::string currindent;
typedef std::list<std::pair<const AbstractNode *, std::string> > ChildList;
std::map<int, ChildList> visitedchildren;
const Tree &tree;
public:

View File

@ -2,12 +2,11 @@
#define CGALRENDERER_H_
#include "renderer.h"
#include "CGAL_Nef_polyhedron.h"
class CGALRenderer : public Renderer
{
public:
CGALRenderer(const CGAL_Nef_polyhedron &root);
CGALRenderer(const class CGAL_Nef_polyhedron &root);
~CGALRenderer();
void draw(bool showfaces, bool showedges) const;

View File

@ -86,8 +86,8 @@ Response CSGTermEvaluator::visit(State &state, const AbstractIntersectionNode &n
}
static CSGTerm *evaluate_csg_term_from_ps(const State &state,
vector<CSGTerm*> &highlights,
vector<CSGTerm*> &background,
std::vector<CSGTerm*> &highlights,
std::vector<CSGTerm*> &background,
const shared_ptr<PolySet> &ps,
const ModuleInstantiation *modinst,
const AbstractNode &node)

View File

@ -1,39 +1,31 @@
#ifndef CSGTERMEVALUATOR_H_
#define CSGTERMEVALUATOR_H_
#include <string>
#include <map>
#include <list>
#include <vector>
#include "Tree.h"
#include "visitor.h"
#include "node.h"
using std::string;
using std::map;
using std::list;
using std::vector;
class CSGTermEvaluator : public Visitor
{
public:
CSGTermEvaluator(const Tree &tree, class PolySetEvaluator *psevaluator = NULL)
CSGTermEvaluator(const class Tree &tree, class PolySetEvaluator *psevaluator = NULL)
: tree(tree), psevaluator(psevaluator) {
}
virtual ~CSGTermEvaluator() {}
virtual Response visit(State &state, const AbstractNode &node);
virtual Response visit(State &state, const AbstractIntersectionNode &node);
virtual Response visit(State &state, const AbstractPolyNode &node);
virtual Response visit(State &state, const CsgNode &node);
virtual Response visit(State &state, const TransformNode &node);
virtual Response visit(State &state, const ColorNode &node);
virtual Response visit(State &state, const RenderNode &node);
virtual Response visit(State &state, const CgaladvNode &node);
virtual Response visit(State &state, const class AbstractNode &node);
virtual Response visit(State &state, const class AbstractIntersectionNode &node);
virtual Response visit(State &state, const class AbstractPolyNode &node);
virtual Response visit(State &state, const class CsgNode &node);
virtual Response visit(State &state, const class TransformNode &node);
virtual Response visit(State &state, const class ColorNode &node);
virtual Response visit(State &state, const class RenderNode &node);
virtual Response visit(State &state, const class CgaladvNode &node);
class CSGTerm *evaluateCSGTerm(const AbstractNode &node,
vector<CSGTerm*> &highlights,
vector<CSGTerm*> &background);
std::vector<CSGTerm*> &highlights,
std::vector<CSGTerm*> &background);
private:
enum CsgOp {CSGT_UNION, CSGT_INTERSECTION, CSGT_DIFFERENCE, CSGT_MINKOWSKI};
@ -41,14 +33,14 @@ private:
void applyToChildren(const AbstractNode &node, CSGTermEvaluator::CsgOp op);
const AbstractNode *root;
typedef list<const AbstractNode *> ChildList;
map<int, ChildList> visitedchildren;
typedef std::list<const AbstractNode *> ChildList;
std::map<int, ChildList> visitedchildren;
public:
map<int, class CSGTerm*> stored_term; // The term evaluated from each node index
std::map<int, class CSGTerm*> stored_term; // The term evaluated from each node index
vector<CSGTerm*> highlights;
vector<CSGTerm*> background;
std::vector<CSGTerm*> highlights;
std::vector<CSGTerm*> background;
const Tree &tree;
class PolySetEvaluator *psevaluator;
};

View File

@ -1,11 +1,7 @@
#ifndef GLVIEW_H_
#define GLVIEW_H_
#ifdef ENABLE_OPENCSG
// this must be included before the GL headers
# include <GL/glew.h>
#endif
#include "system-gl.h"
#include <QGLWidget>
#include <QLabel>

View File

@ -6,9 +6,7 @@
#include "openscad.h"
#include "context.h"
#include "module.h"
#include "polyset.h"
#include "Tree.h"
#include <QPointer>
#include <vector>
class MainWindow : public QMainWindow, public Ui::MainWindow

View File

@ -24,7 +24,7 @@
*
*/
#include <GL/glew.h>
#include "system-gl.h"
#include "OpenCSGRenderer.h"
#include "polyset.h"
#include "csgterm.h"

View File

@ -2,8 +2,7 @@
#define OPENCSGRENDERER_H_
#include "renderer.h"
#include <GL/glew.h> // this must be included before the GL headers
#include <qgl.h>
#include "system-gl.h"
class OpenCSGRenderer : public Renderer
{

View File

@ -2,6 +2,7 @@
#include "PolySetEvaluator.h"
#include "printutils.h"
#include "polyset.h"
#include "Tree.h"
/*!
The task of PolySetEvaluator is to create, keep track of and cache PolySet instances.

View File

@ -1,19 +1,17 @@
#ifndef POLYSETEVALUATOR_H_
#define POLYSETEVALUATOR_H_
#include "node.h"
#include "Tree.h"
#include "memory.h"
class PolySetEvaluator
{
public:
PolySetEvaluator(const Tree &tree) : tree(tree) {}
PolySetEvaluator(const class Tree &tree) : tree(tree) {}
virtual ~PolySetEvaluator() {}
const Tree &getTree() const { return this->tree; }
virtual shared_ptr<PolySet> getPolySet(const class AbstractNode &, bool cache);
virtual shared_ptr<class PolySet> getPolySet(const class AbstractNode &, bool cache);
virtual PolySet *evaluatePolySet(const class ProjectionNode &) { return NULL; }
virtual PolySet *evaluatePolySet(const class LinearExtrudeNode &) { return NULL; }

View File

@ -28,8 +28,7 @@
#include "polyset.h"
#include "csgterm.h"
#include <GL/glew.h> // this must be included before the GL headers
#include <qgl.h>
#include "system-gl.h"
ThrownTogetherRenderer::ThrownTogetherRenderer(CSGChain *root_chain,
CSGChain *highlights_chain,

View File

@ -28,7 +28,6 @@
#include "module.h"
#include "context.h"
#include "builtin.h"
#include "printutils.h"
#include "PolySetEvaluator.h"
#include <sstream>
#include <assert.h>

View File

@ -26,7 +26,6 @@
#ifdef ENABLE_CGAL
#include "node.h"
#include "printutils.h"
#include "grid.h"
#include "cgal.h"

View File

@ -29,7 +29,6 @@
#include "context.h"
#include "builtin.h"
#include "printutils.h"
#include "visitor.h"
#include <sstream>
#include <assert.h>
#include <QColor>

View File

@ -29,7 +29,6 @@
#include "module.h"
#include "csgterm.h"
#include "builtin.h"
#include "printutils.h"
#include <sstream>
#include <assert.h>

View File

@ -3,8 +3,10 @@
#include <string>
#include <vector>
#include "polyset.h"
#include "memory.h"
#include "linalg.h"
class PolySet;
class CSGTerm
{

View File

@ -4,13 +4,11 @@
#include "grid.h"
#include <stdio.h>
#ifdef ENABLE_OPENCSG
// this must be included before the GL headers
# include <GL/glew.h>
#endif
#include <qgl.h>
#include "system-gl.h"
#include "mathc99.h"
#include <QVector>
#ifdef WIN32
# define STDCALL __stdcall
#else

View File

@ -5,8 +5,7 @@
#include <iostream>
void cgal_nef3_to_polyset(class PolySet *ps, class CGAL_Nef_polyhedron *root_N);
void export_stl(CGAL_Nef_polyhedron *root_N, std::ostream &output, class QProgressDialog *pd);
void export_stl(class CGAL_Nef_polyhedron *root_N, std::ostream &output, class QProgressDialog *pd);
void export_off(CGAL_Nef_polyhedron *root_N, std::ostream &output, QProgressDialog *pd);
void export_dxf(CGAL_Nef_polyhedron *root_N, std::ostream &output, QProgressDialog *pd);
#endif

View File

@ -27,7 +27,6 @@
#include "function.h"
#include "expression.h"
#include "context.h"
#include "dxfdim.h"
#include "builtin.h"
#include <sstream>
#include <ctime>

10
src/linalg.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef LINALG_H_
#define LINALG_H_
#include <Eigen/Core>
#include <Eigen/Geometry>
using Eigen::Vector3d;
typedef Eigen::AlignedBox<double, 3> BoundingBox;
#endif

View File

@ -30,11 +30,6 @@
#include "context.h"
#include "printutils.h"
#include "builtin.h"
#include "dxfdata.h"
#include "dxftess.h"
#include "polyset.h"
#include "progress.h"
#include "visitor.h"
#include "PolySetEvaluator.h"
#include "openscad.h" // get_fragments_from_r()
@ -124,7 +119,7 @@ void register_builtin_dxf_linear_extrude()
builtin_modules["linear_extrude"] = new LinearExtrudeModule();
}
PolySet *LinearExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) const
class PolySet *LinearExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) const
{
if (!evaluator) {
PRINTF("WARNING: No suitable PolySetEvaluator found for %s module!", this->name().c_str());

View File

@ -33,13 +33,10 @@
#include "polyset.h"
#include "csgterm.h"
#include "highlighter.h"
#include "grid.h"
#include "dxfdata.h"
#include "dxfdim.h"
#include "export.h"
#include "builtin.h"
#include "dxftess.h"
#include "progress.h"
#include "dxfdim.h"
#ifdef ENABLE_OPENCSG
#include "CSGTermEvaluator.h"
#include "OpenCSGRenderer.h"

View File

@ -24,17 +24,13 @@
*
*/
#include "printutils.h"
#include "node.h"
#include "module.h"
#include "csgterm.h"
#include "progress.h"
#include "polyset.h"
#include "visitor.h"
#include "nodedumper.h"
#include "stl-utils.h"
#include <sstream>
#include <iostream>
#include <algorithm>
size_t AbstractNode::idx_counter;

View File

@ -3,7 +3,6 @@
#include <vector>
#include <string>
#include "traverser.h"
extern int progress_report_count;

View File

@ -1,13 +1,8 @@
#include "nodedumper.h"
#include <string>
#include <map>
#include <list>
#include "visitor.h"
#include "state.h"
#include "nodecache.h"
#include <string>
#include <sstream>
#include <iostream>
#include <assert.h>
/*!
@ -42,7 +37,7 @@ void NodeDumper::handleIndent(const State &state)
including braces and indentation.
All children are assumed to be cached already.
*/
string NodeDumper::dumpChildren(const AbstractNode &node)
std::string NodeDumper::dumpChildren(const AbstractNode &node)
{
std::stringstream dump;
if (!this->visitedchildren[node.index()].empty()) {

View File

@ -27,11 +27,6 @@
#ifndef OPENSCAD_H
#define OPENSCAD_H
#ifdef ENABLE_OPENCSG
// this must be included before the GL headers
# include <GL/glew.h>
#endif
// for win32 and maybe others..
#ifndef M_PI
# define M_PI 3.14159265358979323846

View File

@ -25,7 +25,6 @@
*/
#include "polyset.h"
#include "printutils.h"
// FIXME: Reenable/rewrite - don't be dependant on GUI
// #include "Preferences.h"
#ifdef ENABLE_CGAL

View File

@ -1,14 +1,10 @@
#ifndef POLYSET_H_
#define POLYSET_H_
#include <GL/glew.h>
#include "system-gl.h"
#include "grid.h"
#include "linalg.h"
#include <vector>
#include <Eigen/Core>
#include <Eigen/Geometry>
using Eigen::Vector3d;
typedef Eigen::AlignedBox<double, 3> BoundingBox;
class PolySet
{

View File

@ -32,7 +32,6 @@
#include "dxftess.h"
#include "builtin.h"
#include "printutils.h"
#include <assert.h>
#include "visitor.h"
#include <sstream>
#include <assert.h>

View File

@ -1,5 +1,6 @@
#include "printutils.h"
#include <stdio.h>
#include <QDate>
QList<QString> print_messages_stack;
OutputHandlerFunc *outputhandler = NULL;

View File

@ -5,7 +5,6 @@
#include <QList>
#include <iostream>
#include <QFileInfo>
#include <QDateTime>
typedef void (OutputHandlerFunc)(const QString &msg, void *userdata);
extern OutputHandlerFunc *outputhandler;

View File

@ -29,19 +29,9 @@
#include "context.h"
#include "printutils.h"
#include "builtin.h"
#include "dxfdata.h"
#include "dxftess.h"
#include "polyset.h"
#include "export.h"
#include "progress.h"
#include "visitor.h"
#include "PolySetEvaluator.h"
#ifdef ENABLE_CGAL
# include <CGAL/assertions_behaviour.h>
# include <CGAL/exceptions.h>
#endif
#include <assert.h>
#include <sstream>
#include <boost/assign/std/vector.hpp>

View File

@ -28,9 +28,6 @@
#include "module.h"
#include "context.h"
#include "builtin.h"
#include "printutils.h"
#include "progress.h"
#include "visitor.h"
#include "PolySetEvaluator.h"
#include <sstream>

View File

@ -30,8 +30,6 @@
#include "printutils.h"
#include "builtin.h"
#include "polyset.h"
#include "dxfdata.h"
#include "progress.h"
#include "visitor.h"
#include "PolySetEvaluator.h"
#include "openscad.h" // get_fragments_from_r()

View File

@ -29,7 +29,6 @@
#include "polyset.h"
#include "context.h"
#include "builtin.h"
#include "dxftess.h"
#include "printutils.h"
#include "handle_dep.h" // handle_dep()
#include "visitor.h"

11
src/system-gl.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef SYSTEMGL_H_
#define SYSTEMGL_H_
#include <GL/glew.h>
#ifdef __APPLE__
#include <OpenGL/OpenGL.h>
#else
#include <GL/gl.h>
#endif
#endif

View File

@ -26,7 +26,6 @@
#include "myqhash.h"
#include "PolySetEvaluator.h"
#include "CSGTermEvaluator.h"
#include "CSGTextCache.h"
#include "openscad.h"
#include "handle_dep.h"
#include "node.h"
@ -144,8 +143,8 @@ int main(int argc, char **argv)
// cout << tree.getString(*root_node) << "\n";
vector<CSGTerm*> highlights;
vector<CSGTerm*> background;
std::vector<CSGTerm*> highlights;
std::vector<CSGTerm*> background;
PolySetEvaluator psevaluator(tree);
CSGTermEvaluator evaluator(tree, &psevaluator);
CSGTerm *root_term = evaluator.evaluateCSGTerm(*root_node, highlights, background);