Skip to content

Commit

Permalink
Clifford Wolf:
Browse files Browse the repository at this point in the history
	Fixed building without CGAL



git-svn-id: http://svn.clifford.at/openscad/trunk@406 b57f626f-c46c-0410-a088-ec61d464b74c
  • Loading branch information
clifford committed Feb 1, 2010
1 parent 07bc7db commit 51ae248
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/dxfdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class DxfData

DxfData();
DxfData(double fn, double fs, double fa, QString filename, QString layername = QString(), double xorigin = 0.0, double yorigin = 0.0, double scale = 1.0);
#ifdef ENABLE_CGAL
DxfData(const struct CGAL_Nef_polyhedron &N);
#endif

Point *addPoint(double x, double y);

Expand Down
5 changes: 5 additions & 0 deletions src/dxflinextrude.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ PolySet *DxfLinearExtrudeNode::render_polyset(render_mode_e rm) const

if (filename.isEmpty())
{
#ifdef ENABLE_CGAL
QTime t;
QProgressDialog *pd = NULL;

Expand Down Expand Up @@ -268,6 +269,10 @@ PolySet *DxfLinearExtrudeNode::render_polyset(render_mode_e rm) const
PRINTF_NOCACHE("..rendering time: %d hours, %d minutes, %d seconds", s / (60*60), (s / 60) % 60, s % 60);
delete pd;
}
#else // ENABLE_CGAL
PRINT("WARNING: Found linear_extrude() statement without dxf file but compiled without CGAL support!");
dxf = new DxfData();
#endif // ENABLE_CGAL
} else {
dxf = new DxfData(fn, fs, fa, filename, layername, origin_x, origin_y, scale);
}
Expand Down
5 changes: 5 additions & 0 deletions src/dxfrotextrude.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ PolySet *DxfRotateExtrudeNode::render_polyset(render_mode_e rm) const

if (filename.isEmpty())
{
#ifdef ENABLE_CGAL
QTime t;
QProgressDialog *pd;

Expand Down Expand Up @@ -169,6 +170,10 @@ PolySet *DxfRotateExtrudeNode::render_polyset(render_mode_e rm) const
PRINTF_NOCACHE("..rendering time: %d hours, %d minutes, %d seconds", s / (60*60), (s / 60) % 60, s % 60);
delete pd;
}
#else // ENABLE_CGAL
PRINT("WARNING: Found rotate_extrude() statement without dxf file but compiled without CGAL support!");
dxf = new DxfData();
#endif // ENABLE_CGAL
} else {
dxf = new DxfData(fn, fs, fa, filename, layername, origin_x, origin_y, scale);
}
Expand Down
5 changes: 2 additions & 3 deletions src/dxftess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@

#include "printutils.h"

#define CGAL_TESSELATE
#ifdef CGAL_TESSELATE
#ifdef ENABLE_CGAL
#include "dxftess-cgal.cc"
#else
#include "dxftess-glu.cc"
#endif // CGAL_TESSELATE
#endif

/*!
Converts all paths in the given DxfData to PolySet::borders polygons
Expand Down
2 changes: 2 additions & 0 deletions src/mainwin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,9 @@ void MainWindow::actionExportDXF()
void MainWindow::actionFlushCaches()
{
PolySet::ps_cache.clear();
#ifdef ENABLE_CGAL
AbstractNode::cgal_nef_cache.clear();
#endif
dxf_dim_cache.clear();
dxf_cross_cache.clear();
}
Expand Down
3 changes: 3 additions & 0 deletions src/nef2dxf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "grid.h"
#include "cgal.h"

#ifdef ENABLE_CGAL

DxfData::DxfData(const struct CGAL_Nef_polyhedron &N)
{
Grid2d<int> grid(GRID_COARSE);
Expand Down Expand Up @@ -70,3 +72,4 @@ DxfData::DxfData(const struct CGAL_Nef_polyhedron &N)
fixup_path_direction();
}

#endif // ENABLE_CGAL
14 changes: 14 additions & 0 deletions src/projection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ void register_builtin_projection()
builtin_modules["projection"] = new ProjectionModule();
}

#ifdef ENABLE_CGAL

static void report_func(const class AbstractNode*, void *vp, int mark)
{
QProgressDialog *pd = (QProgressDialog*)vp;
Expand Down Expand Up @@ -291,6 +293,18 @@ PolySet *ProjectionNode::render_polyset(render_mode_e rm) const
return ps;
}

#else // ENABLE_CGAL

PolySet *ProjectionNode::render_polyset(render_mode_e) const
{
PRINT("WARNING: Found projection() statement but compiled without CGAL support!");
PolySet *ps = new PolySet();
ps->is2d = true;
return ps;
}

#endif // ENABLE_CGAL

QString ProjectionNode::dump(QString indent) const
{
if (dump_cache.isEmpty()) {
Expand Down

0 comments on commit 51ae248

Please sign in to comment.