Skip to content

Commit

Permalink
Cleaned up some unnecessary includes
Browse files Browse the repository at this point in the history
  • Loading branch information
kintel committed Sep 30, 2011
1 parent 0c2053c commit 84e98b1
Show file tree
Hide file tree
Showing 39 changed files with 71 additions and 123 deletions.
2 changes: 2 additions & 0 deletions openscad.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
1 change: 1 addition & 0 deletions src/CGALEvaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "polyset.h"
#include "dxfdata.h"
#include "dxftess.h"
#include "Tree.h"

#include "CGALCache.h"
#include "cgal.h"
Expand Down
14 changes: 4 additions & 10 deletions src/CGALEvaluator.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,18 @@

#include "myqhash.h"
#include "visitor.h"
#include "Tree.h"
#include "CGAL_Nef_polyhedron.h"
#include "PolySetCGALEvaluator.h"

#include <string>
#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);
Expand All @@ -42,9 +36,9 @@ class CGALEvaluator : public Visitor
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:
Expand Down
3 changes: 1 addition & 2 deletions src/CGALRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/CSGTermEvaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
40 changes: 16 additions & 24 deletions src/CSGTermEvaluator.h
Original file line number Diff line number Diff line change
@@ -1,54 +1,46 @@
#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};
void addToParent(const State &state, const AbstractNode &node);
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;
};
Expand Down
6 changes: 1 addition & 5 deletions src/GLView.h
Original file line number Diff line number Diff line change
@@ -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>

Expand Down
2 changes: 0 additions & 2 deletions src/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/OpenCSGRenderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
*/

#include <GL/glew.h>
#include "system-gl.h"
#include "OpenCSGRenderer.h"
#include "polyset.h"
#include "csgterm.h"
Expand Down
3 changes: 1 addition & 2 deletions src/OpenCSGRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
1 change: 1 addition & 0 deletions src/PolySetEvaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 2 additions & 4 deletions src/PolySetEvaluator.h
Original file line number Diff line number Diff line change
@@ -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; }
Expand Down
3 changes: 1 addition & 2 deletions src/ThrownTogetherRenderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/cgaladv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "module.h"
#include "context.h"
#include "builtin.h"
#include "printutils.h"
#include "PolySetEvaluator.h"
#include <sstream>
#include <assert.h>
Expand Down
1 change: 0 additions & 1 deletion src/cgaladv_minkowski2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#ifdef ENABLE_CGAL

#include "node.h"
#include "printutils.h"
#include "grid.h"
#include "cgal.h"
Expand Down
1 change: 0 additions & 1 deletion src/color.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "context.h"
#include "builtin.h"
#include "printutils.h"
#include "visitor.h"
#include <sstream>
#include <assert.h>
#include <QColor>
Expand Down
1 change: 0 additions & 1 deletion src/csgops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "module.h"
#include "csgterm.h"
#include "builtin.h"
#include "printutils.h"
#include <sstream>
#include <assert.h>

Expand Down
4 changes: 3 additions & 1 deletion src/csgterm.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

#include <string>
#include <vector>
#include "polyset.h"
#include "memory.h"
#include "linalg.h"

class PolySet;

class CSGTerm
{
Expand Down
8 changes: 3 additions & 5 deletions src/dxftess-glu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/export.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/func.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "function.h"
#include "expression.h"
#include "context.h"
#include "dxfdim.h"
#include "builtin.h"
#include <sstream>
#include <ctime>
Expand Down
10 changes: 10 additions & 0 deletions src/linalg.h
Original file line number Diff line number Diff line change
@@ -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
7 changes: 1 addition & 6 deletions src/linearextrude.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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());
Expand Down
5 changes: 1 addition & 4 deletions src/mainwin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 1 addition & 5 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <vector>
#include <string>

#include "traverser.h"

extern int progress_report_count;
Expand Down
Loading

0 comments on commit 84e98b1

Please sign in to comment.