diff options
author | Marius Kintel <marius@kintel.net> | 2011-09-30 23:36:30 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-09-30 23:36:30 (GMT) |
commit | 84e98b178ad60b22ae6a3b60ea3f6296b1f71989 (patch) | |
tree | 6fba1e961976c3e8fc16e5b6c44afd64d4b2ae14 | |
parent | 0c2053caf9c7e521c31bbf603e8a1980d2eee3b2 (diff) |
Cleaned up some unnecessary includes
39 files changed, 71 insertions, 123 deletions
diff --git a/openscad.pro b/openscad.pro index 765ff6b..271c34d 100644 --- a/openscad.pro +++ b/openscad.pro @@ -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 \ diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index d950cb8..72d1f17 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -11,6 +11,7 @@ #include "polyset.h" #include "dxfdata.h" #include "dxftess.h" +#include "Tree.h" #include "CGALCache.h" #include "cgal.h" diff --git a/src/CGALEvaluator.h b/src/CGALEvaluator.h index c1b5ae8..0ac716c 100644 --- a/src/CGALEvaluator.h +++ b/src/CGALEvaluator.h @@ -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: diff --git a/src/CGALRenderer.h b/src/CGALRenderer.h index 5f854ea..9c19e5a 100644 --- a/src/CGALRenderer.h +++ b/src/CGALRenderer.h @@ -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; diff --git a/src/CSGTermEvaluator.cc b/src/CSGTermEvaluator.cc index ebea89c..2467c05 100644 --- a/src/CSGTermEvaluator.cc +++ b/src/CSGTermEvaluator.cc @@ -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) diff --git a/src/CSGTermEvaluator.h b/src/CSGTermEvaluator.h index ac22906..cca6c91 100644 --- a/src/CSGTermEvaluator.h +++ b/src/CSGTermEvaluator.h @@ -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; }; diff --git a/src/GLView.h b/src/GLView.h index 1001754..3a36a15 100644 --- a/src/GLView.h +++ b/src/GLView.h @@ -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> diff --git a/src/MainWindow.h b/src/MainWindow.h index 0ba3bd9..37a6a4c 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -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 diff --git a/src/OpenCSGRenderer.cc b/src/OpenCSGRenderer.cc index 4a86c5c..a030e6c 100644 --- a/src/OpenCSGRenderer.cc +++ b/src/OpenCSGRenderer.cc @@ -24,7 +24,7 @@ * */ -#include <GL/glew.h> +#include "system-gl.h" #include "OpenCSGRenderer.h" #include "polyset.h" #include "csgterm.h" diff --git a/src/OpenCSGRenderer.h b/src/OpenCSGRenderer.h index 95ffc8e..e6091aa 100644 --- a/src/OpenCSGRenderer.h +++ b/src/OpenCSGRenderer.h @@ -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 { diff --git a/src/PolySetEvaluator.cc b/src/PolySetEvaluator.cc index 1f09127..b5075ba 100644 --- a/src/PolySetEvaluator.cc +++ b/src/PolySetEvaluator.cc @@ -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. diff --git a/src/PolySetEvaluator.h b/src/PolySetEvaluator.h index 8d7d1a8..348cbba 100644 --- a/src/PolySetEvaluator.h +++ b/src/PolySetEvaluator.h @@ -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; } diff --git a/src/ThrownTogetherRenderer.cc b/src/ThrownTogetherRenderer.cc index 956fc11..7a92e7f 100644 --- a/src/ThrownTogetherRenderer.cc +++ b/src/ThrownTogetherRenderer.cc @@ -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, diff --git a/src/cgaladv.cc b/src/cgaladv.cc index 5014133..c83e18b 100644 --- a/src/cgaladv.cc +++ b/src/cgaladv.cc @@ -28,7 +28,6 @@ #include "module.h" #include "context.h" #include "builtin.h" -#include "printutils.h" #include "PolySetEvaluator.h" #include <sstream> #include <assert.h> diff --git a/src/cgaladv_minkowski2.cc b/src/cgaladv_minkowski2.cc index f08e7d6..4ce684f 100644 --- a/src/cgaladv_minkowski2.cc +++ b/src/cgaladv_minkowski2.cc @@ -26,7 +26,6 @@ #ifdef ENABLE_CGAL -#include "node.h" #include "printutils.h" #include "grid.h" #include "cgal.h" diff --git a/src/color.cc b/src/color.cc index a65a8e4..ee8f872 100644 --- a/src/color.cc +++ b/src/color.cc @@ -29,7 +29,6 @@ #include "context.h" #include "builtin.h" #include "printutils.h" -#include "visitor.h" #include <sstream> #include <assert.h> #include <QColor> diff --git a/src/csgops.cc b/src/csgops.cc index 98d68c7..7b363f0 100644 --- a/src/csgops.cc +++ b/src/csgops.cc @@ -29,7 +29,6 @@ #include "module.h" #include "csgterm.h" #include "builtin.h" -#include "printutils.h" #include <sstream> #include <assert.h> diff --git a/src/csgterm.h b/src/csgterm.h index c12b7ae..63d1240 100644 --- a/src/csgterm.h +++ b/src/csgterm.h @@ -3,8 +3,10 @@ #include <string> #include <vector> -#include "polyset.h" #include "memory.h" +#include "linalg.h" + +class PolySet; class CSGTerm { diff --git a/src/dxftess-glu.cc b/src/dxftess-glu.cc index 23d8a45..4ad2051 100644 --- a/src/dxftess-glu.cc +++ b/src/dxftess-glu.cc @@ -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 diff --git a/src/export.h b/src/export.h index cba0b23..dd6e3e0 100644 --- a/src/export.h +++ b/src/export.h @@ -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 diff --git a/src/func.cc b/src/func.cc index b58a1b7..964214f 100644 --- a/src/func.cc +++ b/src/func.cc @@ -27,7 +27,6 @@ #include "function.h" #include "expression.h" #include "context.h" -#include "dxfdim.h" #include "builtin.h" #include <sstream> #include <ctime> diff --git a/src/linalg.h b/src/linalg.h new file mode 100644 index 0000000..60a706f --- /dev/null +++ b/src/linalg.h @@ -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 diff --git a/src/linearextrude.cc b/src/linearextrude.cc index 4ce87db..5c3b684 100644 --- a/src/linearextrude.cc +++ b/src/linearextrude.cc @@ -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()); diff --git a/src/mainwin.cc b/src/mainwin.cc index 51e85e7..cce2971 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -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" diff --git a/src/node.cc b/src/node.cc index e2f3fa0..12a7ca4 100644 --- a/src/node.cc +++ b/src/node.cc @@ -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; @@ -3,7 +3,6 @@ #include <vector> #include <string> - #include "traverser.h" extern int progress_report_count; diff --git a/src/nodedumper.cc b/src/nodedumper.cc index d75c703..4523bac 100644 --- a/src/nodedumper.cc +++ b/src/nodedumper.cc @@ -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()) { diff --git a/src/openscad.h b/src/openscad.h index 9d97bac..e6b9b9f 100644 --- a/src/openscad.h +++ b/src/openscad.h @@ -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 diff --git a/src/polyset.cc b/src/polyset.cc index 23b9876..ec0cdf9 100644 --- a/src/polyset.cc +++ b/src/polyset.cc @@ -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 diff --git a/src/polyset.h b/src/polyset.h index c59d86a..2fe1c1f 100644 --- a/src/polyset.h +++ b/src/polyset.h @@ -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 { diff --git a/src/primitives.cc b/src/primitives.cc index 08b9c62..a651ff8 100644 --- a/src/primitives.cc +++ b/src/primitives.cc @@ -32,7 +32,6 @@ #include "dxftess.h" #include "builtin.h" #include "printutils.h" -#include <assert.h> #include "visitor.h" #include <sstream> #include <assert.h> diff --git a/src/printutils.cc b/src/printutils.cc index 01fa06b..a315ab3 100644 --- a/src/printutils.cc +++ b/src/printutils.cc @@ -1,5 +1,6 @@ #include "printutils.h" #include <stdio.h> +#include <QDate> QList<QString> print_messages_stack; OutputHandlerFunc *outputhandler = NULL; diff --git a/src/printutils.h b/src/printutils.h index 0432622..60cd12a 100644 --- a/src/printutils.h +++ b/src/printutils.h @@ -5,7 +5,6 @@ #include <QList> #include <iostream> #include <QFileInfo> -#include <QDateTime> typedef void (OutputHandlerFunc)(const QString &msg, void *userdata); extern OutputHandlerFunc *outputhandler; diff --git a/src/projection.cc b/src/projection.cc index 2c9d821..1333d19 100644 --- a/src/projection.cc +++ b/src/projection.cc @@ -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> diff --git a/src/render.cc b/src/render.cc index f08423a..b79fa56 100644 --- a/src/render.cc +++ b/src/render.cc @@ -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> diff --git a/src/rotateextrude.cc b/src/rotateextrude.cc index 3a6eb55..4d6de73 100644 --- a/src/rotateextrude.cc +++ b/src/rotateextrude.cc @@ -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() diff --git a/src/surface.cc b/src/surface.cc index 35449ed..8349afd 100644 --- a/src/surface.cc +++ b/src/surface.cc @@ -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" diff --git a/src/system-gl.h b/src/system-gl.h new file mode 100644 index 0000000..cdbf3dc --- /dev/null +++ b/src/system-gl.h @@ -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 diff --git a/tests/csgtermtest.cc b/tests/csgtermtest.cc index 7c37b0a..8579182 100644 --- a/tests/csgtermtest.cc +++ b/tests/csgtermtest.cc @@ -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); |