summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RELEASE_NOTES4
-rw-r--r--openscad.pro8
-rw-r--r--patches/CGAL-OGL_helper-colors.patch80
-rw-r--r--patches/CGAL-OGL_helper-tesscombine.patch (renamed from patches/CGAL-OGL-Tess-Combine-Fix.patch)21
-rwxr-xr-xscripts/macosx-build-dependencies.sh7
-rw-r--r--src/OGL_helper.h21
-rw-r--r--src/PolySetCGALEvaluator.cc12
-rw-r--r--src/PolySetCGALEvaluator.h8
-rw-r--r--src/PolySetEvaluator.h4
-rw-r--r--src/func.cc9
-rw-r--r--src/linearextrude.cc (renamed from src/dxflinextrude.cc)18
-rw-r--r--src/linearextrudenode.h (renamed from src/dxflinextrudenode.h)8
-rw-r--r--src/qtcolorbutton/README.txt2
-rw-r--r--src/qtcolorbutton/qtcolorbutton.cpp278
-rw-r--r--src/qtcolorbutton/qtcolorbutton.h86
-rw-r--r--src/qtcolorbutton/qtcolorbutton.pri4
-rw-r--r--src/rotateextrude.cc (renamed from src/dxfrotextrude.cc)18
-rw-r--r--src/rotateextrudenode.h (renamed from src/dxfrotextrudenode.h)8
-rw-r--r--src/value.cc12
-rw-r--r--src/visitor.h4
-rw-r--r--testdata/scad/features/polyhedron-tests.scad20
-rw-r--r--testdata/scad/minimal/allfunctions.scad1
-rw-r--r--tests/CMakeLists.txt5
-rw-r--r--tests/regression/cgalpngtest/polyhedron-tests-expected.pngbin0 -> 9208 bytes
-rw-r--r--tests/regression/opencsgtest/polyhedron-tests-expected.pngbin0 -> 10415 bytes
25 files changed, 194 insertions, 444 deletions
diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index 97af740..f8a10f0 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -9,11 +9,15 @@ o New import() statement reads the correct file format based on the filename ext
o The color() statement now supports an alpha parameter, e.g. color(c=[1,0,0], alpha=0.4)
o The color() statement now supports specifying colors as strings, e.g. color("Red")
o if() and else() can now take any value type as parameter. false, 0, empty string and empty vector or illegal value type will evaluate as false, everything else as true.
+o Strings can now be lexographically compared using the <, <=, >, >= operators
+o The version() function will return the OpenSCAD version as a string, e.g. "2011.10"
Bugfixes:
o square() crashed if any of the dimensions were zero
o Flush Caches didn't flush cached USE'd modules
o STL export should be a bit more robust
+o Dropping a file into the editor under Windows didn't work (double C:/C:/ problem)
+
Deprecations:
o dxf_linear_extrude() and dxf_rotate_extrude() are now deprecated.
diff --git a/openscad.pro b/openscad.pro
index 6e79b29..765ff6b 100644
--- a/openscad.pro
+++ b/openscad.pro
@@ -139,8 +139,8 @@ HEADERS += src/renderer.h \
src/module.h \
src/node.h \
src/csgnode.h \
- src/dxflinextrudenode.h \
- src/dxfrotextrudenode.h \
+ src/linearextrudenode.h \
+ src/rotateextrudenode.h \
src/projectionnode.h \
src/cgaladvnode.h \
src/importnode.h \
@@ -197,8 +197,8 @@ SOURCES += src/openscad.cc \
src/dxftess-glu.cc \
src/dxftess-cgal.cc \
src/dxfdim.cc \
- src/dxflinextrude.cc \
- src/dxfrotextrude.cc \
+ src/linearextrude.cc \
+ src/rotateextrude.cc \
src/highlighter.cc \
src/printutils.cc \
src/Preferences.cc \
diff --git a/patches/CGAL-OGL_helper-colors.patch b/patches/CGAL-OGL_helper-colors.patch
new file mode 100644
index 0000000..4c2f8c0
--- /dev/null
+++ b/patches/CGAL-OGL_helper-colors.patch
@@ -0,0 +1,80 @@
+--- OGL_helper.h 2011-09-29 23:02:04.000000000 +0200
++++ ../src/OGL_helper.h 2011-09-29 23:01:27.000000000 +0200
+@@ -263,7 +263,7 @@
+ enum { SNC_BOUNDARY, SNC_SKELETON };
+
+ class Polyhedron : public OGL_base_object {
+-
++ protected:
+ std::list<DPoint> vertices_;
+ std::list<DSegment> edges_;
+ std::list<DFacet> halffacets_;
+@@ -356,11 +356,17 @@
+ Bbox_3 bbox() const { return bbox_; }
+ Bbox_3& bbox() { return bbox_; }
+
++ virtual CGAL::Color getVertexColor(Vertex_iterator v) const
++ {
++ CGAL::Color cf(CGAL_NEF3_MARKED_VERTEX_COLOR),
++ ct(CGAL_NEF3_UNMARKED_VERTEX_COLOR); // more blue-ish
++ CGAL::Color c = v->mark() ? ct : cf;
++ return c;
++ }
++
+ void draw(Vertex_iterator v) const {
+ // CGAL_NEF_TRACEN("drawing vertex "<<*v);
+- CGAL::Color cf(CGAL_NEF3_MARKED_VERTEX_COLOR),
+- ct(CGAL_NEF3_UNMARKED_VERTEX_COLOR); // more blue-ish
+- CGAL::Color c = v->mark() ? ct : cf;
++ CGAL::Color c = getVertexColor(v);
+ glPointSize(10);
+ glColor3ub(c.red(), c.green(), c.blue());
+ glBegin(GL_POINTS);
+@@ -372,12 +378,18 @@
+ glEnd();
+ }
+
++ virtual CGAL::Color getEdgeColor(Edge_iterator e) const
++ {
++ CGAL::Color cf(CGAL_NEF3_MARKED_EDGE_COLOR),
++ ct(CGAL_NEF3_UNMARKED_EDGE_COLOR); // more blue-ish
++ CGAL::Color c = e->mark() ? ct : cf;
++ return c;
++ }
++
+ void draw(Edge_iterator e) const {
+ // CGAL_NEF_TRACEN("drawing edge "<<*e);
+ Double_point p = e->source(), q = e->target();
+- CGAL::Color cf(CGAL_NEF3_MARKED_EDGE_COLOR),
+- ct(CGAL_NEF3_UNMARKED_EDGE_COLOR); // more blue-ish
+- CGAL::Color c = e->mark() ? ct : cf;
++ CGAL::Color c = getEdgeColor(e);
+ glLineWidth(5);
+ glColor3ub(c.red(),c.green(),c.blue());
+ glBegin(GL_LINE_STRIP);
+@@ -386,6 +398,14 @@
+ glEnd();
+ }
+
++ virtual CGAL::Color getFacetColor(Halffacet_iterator f) const
++ {
++ CGAL::Color cf(CGAL_NEF3_MARKED_FACET_COLOR),
++ ct(CGAL_NEF3_UNMARKED_FACET_COLOR); // more blue-ish
++ CGAL::Color c = (f->mark() ? ct : cf);
++ return c;
++ }
++
+ void draw(Halffacet_iterator f) const {
+ // CGAL_NEF_TRACEN("drawing facet "<<(f->debug(),""));
+ GLUtesselator* tess_ = gluNewTess();
+@@ -403,9 +423,7 @@
+ GLU_TESS_WINDING_POSITIVE);
+
+ DFacet::Coord_const_iterator cit;
+- CGAL::Color cf(CGAL_NEF3_MARKED_FACET_COLOR),
+- ct(CGAL_NEF3_UNMARKED_FACET_COLOR); // more blue-ish
+- CGAL::Color c = (f->mark() ? ct : cf);
++ CGAL::Color c = getFacetColor(f);
+ glColor3ub(c.red(),c.green(),c.blue());
+ gluTessBeginPolygon(tess_,f->normal());
+ // CGAL_NEF_TRACEN(" ");
diff --git a/patches/CGAL-OGL-Tess-Combine-Fix.patch b/patches/CGAL-OGL_helper-tesscombine.patch
index 2a4ad1a..792e1da 100644
--- a/patches/CGAL-OGL-Tess-Combine-Fix.patch
+++ b/patches/CGAL-OGL_helper-tesscombine.patch
@@ -1,12 +1,11 @@
---- CGAL-3.4/include/CGAL/Nef_3/OGL_helper.h
-+++ CGAL-3.4/include/CGAL/Nef_3/OGL_helper.h
-@@ -243,6 +243,23 @@
+--- ../../libraries/install/include/CGAL/Nef_3/OGL_helper.h 2010-06-09 21:00:52.000000000 +0200
++++ OGL_helper.h 2011-09-29 23:09:47.000000000 +0200
+@@ -243,6 +243,22 @@
glVertex3dv(pc);
}
-+ inline void CGAL_GLU_TESS_CALLBACK combineCallback(GLdouble coords[3], GLvoid *d[4], GLfloat w[4], GLvoid **dataOut)
-+ {
-+ static std::list<GLdouble*> pcache;
++ inline void CGAL_GLU_TESS_CALLBACK combineCallback(GLdouble coords[3], GLvoid *[4], GLfloat [4], GLvoid **dataOut)
++ { static std::list<GLdouble*> pcache;
+ if (dataOut) {
+ GLdouble *n = new GLdouble[3];
+ n[0] = coords[0];
@@ -24,7 +23,7 @@
enum { SNC_AXES};
enum { SNC_BOUNDARY, SNC_SKELETON };
-@@ -376,6 +393,8 @@
+@@ -376,6 +392,8 @@
GLUtesselator* tess_ = gluNewTess();
gluTessCallback(tess_, GLenum(GLU_TESS_VERTEX_DATA),
(GLvoid (CGAL_GLU_TESS_CALLBACK *)(CGAL_GLU_TESS_DOTS)) &vertexCallback);
@@ -33,11 +32,3 @@
gluTessCallback(tess_, GLenum(GLU_TESS_BEGIN),
(GLvoid (CGAL_GLU_TESS_CALLBACK *)(CGAL_GLU_TESS_DOTS)) &beginCallback);
gluTessCallback(tess_, GLenum(GLU_TESS_END),
-@@ -410,6 +429,7 @@
- gluTessEndPolygon(tess_);
- // CGAL_NEF_TRACEN("End Polygon");
- gluDeleteTess(tess_);
-+ combineCallback(NULL, NULL, NULL, NULL);
- }
-
- void construct_axes() const
diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh
index 0ed375f..f524d43 100755
--- a/scripts/macosx-build-dependencies.sh
+++ b/scripts/macosx-build-dependencies.sh
@@ -120,12 +120,13 @@ build_cgal()
echo "Building CGAL" $version "..."
cd $BASEDIR/src
rm -rf CGAL*
- curl -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz
+ curl -O https://gforge.inria.fr/frs/download.php/29125/CGAL-$version.tar.gz
+# curl -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz
# curl -O https://gforge.inria.fr/frs/download.php/27641/CGAL-$version.tar.gz
tar xzf CGAL-$version.tar.gz
cd CGAL-$version
# We build a static lib. Not really necessary, but it's well tested.
- cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DBUILD_SHARED_LIBS=FALSE -DCMAKE_OSX_DEPLOYMENT_TARGET="10.5" -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" -DBOOST_ROOT=$DEPLOYDIR
+ cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.dylib -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.dylib -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBUILD_SHARED_LIBS=FALSE -DCMAKE_OSX_DEPLOYMENT_TARGET="10.5" -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" -DBOOST_ROOT=$DEPLOYDIR
make -j4
make install
}
@@ -165,6 +166,6 @@ build_gmp 5.0.1
build_mpfr 3.0.1
build_boost 1.47.0
# NB! For CGAL, also update the actual download URL in the function
-build_cgal 3.8
+build_cgal 3.9
build_glew 1.6.0
build_opencsg 1.3.0
diff --git a/src/OGL_helper.h b/src/OGL_helper.h
index 2764561..40a3e35 100644
--- a/src/OGL_helper.h
+++ b/src/OGL_helper.h
@@ -11,7 +11,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
-// $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.7-branch/Nef_3/include/CGAL/Nef_3/OGL_helper.h $
+// $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/trunk/Nef_3/include/CGAL/Nef_3/OGL_helper.h $
// $Id: OGL_helper.h 56667 2010-06-09 07:37:13Z sloriot $
//
//
@@ -246,19 +246,20 @@ namespace OGL {
inline void CGAL_GLU_TESS_CALLBACK combineCallback(GLdouble coords[3], GLvoid *[4], GLfloat [4], GLvoid **dataOut)
{ static std::list<GLdouble*> pcache;
if (dataOut) {
- GLdouble *n = new GLdouble[3];
- n[0] = coords[0];
- n[1] = coords[1];
- n[2] = coords[2];
- pcache.push_back(n);
- *dataOut = n;
+ GLdouble *n = new GLdouble[3];
+ n[0] = coords[0];
+ n[1] = coords[1];
+ n[2] = coords[2];
+ pcache.push_back(n);
+ *dataOut = n;
} else {
- for (std::list<GLdouble*>::const_iterator i = pcache.begin(); i != pcache.end(); i++)
- delete[] *i;
- pcache.clear();
+ for (std::list<GLdouble*>::const_iterator i = pcache.begin(); i != pcache.end(); i++)
+ delete[] *i;
+ pcache.clear();
}
}
+
enum { SNC_AXES};
enum { SNC_BOUNDARY, SNC_SKELETON };
diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc
index b019ad5..7f62d0a 100644
--- a/src/PolySetCGALEvaluator.cc
+++ b/src/PolySetCGALEvaluator.cc
@@ -4,8 +4,8 @@
#include "polyset.h"
#include "CGALEvaluator.h"
#include "projectionnode.h"
-#include "dxflinextrudenode.h"
-#include "dxfrotextrudenode.h"
+#include "linearextrudenode.h"
+#include "rotateextrudenode.h"
#include "cgaladvnode.h"
#include "rendernode.h"
#include "dxfdata.h"
@@ -251,7 +251,7 @@ static void add_slice(PolySet *ps, const DxfData &dxf, DxfData::Path &path, doub
}
}
-PolySet *PolySetCGALEvaluator::evaluatePolySet(const DxfLinearExtrudeNode &node)
+PolySet *PolySetCGALEvaluator::evaluatePolySet(const LinearExtrudeNode &node)
{
DxfData *dxf;
@@ -283,7 +283,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const DxfLinearExtrudeNode &node)
return ps;
}
-PolySet *PolySetCGALEvaluator::extrudeDxfData(const DxfLinearExtrudeNode &node, DxfData &dxf)
+PolySet *PolySetCGALEvaluator::extrudeDxfData(const LinearExtrudeNode &node, DxfData &dxf)
{
PolySet *ps = new PolySet();
ps->convexity = node.convexity;
@@ -349,7 +349,7 @@ PolySet *PolySetCGALEvaluator::extrudeDxfData(const DxfLinearExtrudeNode &node,
return ps;
}
-PolySet *PolySetCGALEvaluator::evaluatePolySet(const DxfRotateExtrudeNode &node)
+PolySet *PolySetCGALEvaluator::evaluatePolySet(const RotateExtrudeNode &node)
{
DxfData *dxf;
@@ -398,7 +398,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const RenderNode &node)
return ps;
}
-PolySet *PolySetCGALEvaluator::rotateDxfData(const DxfRotateExtrudeNode &node, DxfData &dxf)
+PolySet *PolySetCGALEvaluator::rotateDxfData(const RotateExtrudeNode &node, DxfData &dxf)
{
PolySet *ps = new PolySet();
ps->convexity = node.convexity;
diff --git a/src/PolySetCGALEvaluator.h b/src/PolySetCGALEvaluator.h
index 2aa5b13..dddcfc5 100644
--- a/src/PolySetCGALEvaluator.h
+++ b/src/PolySetCGALEvaluator.h
@@ -13,14 +13,14 @@ public:
PolySetCGALEvaluator(class CGALEvaluator &cgalevaluator);
virtual ~PolySetCGALEvaluator() { }
virtual PolySet *evaluatePolySet(const ProjectionNode &node);
- virtual PolySet *evaluatePolySet(const DxfLinearExtrudeNode &node);
- virtual PolySet *evaluatePolySet(const DxfRotateExtrudeNode &node);
+ virtual PolySet *evaluatePolySet(const LinearExtrudeNode &node);
+ virtual PolySet *evaluatePolySet(const RotateExtrudeNode &node);
virtual PolySet *evaluatePolySet(const CgaladvNode &node);
virtual PolySet *evaluatePolySet(const RenderNode &node);
protected:
- PolySet *extrudeDxfData(const DxfLinearExtrudeNode &node, class DxfData &dxf);
- PolySet *rotateDxfData(const DxfRotateExtrudeNode &node, class DxfData &dxf);
+ PolySet *extrudeDxfData(const LinearExtrudeNode &node, class DxfData &dxf);
+ PolySet *rotateDxfData(const RotateExtrudeNode &node, class DxfData &dxf);
CGALEvaluator &cgalevaluator;
};
diff --git a/src/PolySetEvaluator.h b/src/PolySetEvaluator.h
index 833b079..8d7d1a8 100644
--- a/src/PolySetEvaluator.h
+++ b/src/PolySetEvaluator.h
@@ -16,8 +16,8 @@ public:
virtual shared_ptr<PolySet> getPolySet(const class AbstractNode &, bool cache);
virtual PolySet *evaluatePolySet(const class ProjectionNode &) { return NULL; }
- virtual PolySet *evaluatePolySet(const class DxfLinearExtrudeNode &) { return NULL; }
- virtual PolySet *evaluatePolySet(const class DxfRotateExtrudeNode &) { return NULL; }
+ virtual PolySet *evaluatePolySet(const class LinearExtrudeNode &) { return NULL; }
+ virtual PolySet *evaluatePolySet(const class RotateExtrudeNode &) { return NULL; }
virtual PolySet *evaluatePolySet(const class CgaladvNode &) { return NULL; }
virtual PolySet *evaluatePolySet(const class RenderNode &) { return NULL; }
diff --git a/src/func.cc b/src/func.cc
index 52f04dd..b58a1b7 100644
--- a/src/func.cc
+++ b/src/func.cc
@@ -349,6 +349,14 @@ Value builtin_lookup(const Context *, const std::vector<std::string>&, const std
return Value(high_v * f + low_v * (1-f));
}
+#define QUOTE(x__) # x__
+#define QUOTED(x__) QUOTE(x__)
+
+Value builtin_version(const Context *, const std::vector<std::string>&, const std::vector<Value> &)
+{
+ return Value(std::string(QUOTED(OPENSCAD_VERSION)));
+}
+
void initialize_builtin_functions()
{
builtin_functions["abs"] = new BuiltinFunction(&builtin_abs);
@@ -373,6 +381,7 @@ void initialize_builtin_functions()
builtin_functions["ln"] = new BuiltinFunction(&builtin_ln);
builtin_functions["str"] = new BuiltinFunction(&builtin_str);
builtin_functions["lookup"] = new BuiltinFunction(&builtin_lookup);
+ builtin_functions["version"] = new BuiltinFunction(&builtin_version);
initialize_builtin_dxf_dim();
}
diff --git a/src/dxflinextrude.cc b/src/linearextrude.cc
index 8bb246f..4ce87db 100644
--- a/src/dxflinextrude.cc
+++ b/src/linearextrude.cc
@@ -24,7 +24,7 @@
*
*/
-#include "dxflinextrudenode.h"
+#include "linearextrudenode.h"
#include "module.h"
#include "context.h"
@@ -44,16 +44,16 @@ using namespace boost::assign; // bring 'operator+=()' into scope
#include <QFileInfo>
-class DxfLinearExtrudeModule : public AbstractModule
+class LinearExtrudeModule : public AbstractModule
{
public:
- DxfLinearExtrudeModule() { }
+ LinearExtrudeModule() { }
virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
};
-AbstractNode *DxfLinearExtrudeModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const
+AbstractNode *LinearExtrudeModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const
{
- DxfLinearExtrudeNode *node = new DxfLinearExtrudeNode(inst);
+ LinearExtrudeNode *node = new LinearExtrudeNode(inst);
std::vector<std::string> argnames;
argnames += "file", "layer", "height", "origin", "scale", "center", "twist", "slices";
@@ -120,11 +120,11 @@ AbstractNode *DxfLinearExtrudeModule::evaluate(const Context *ctx, const ModuleI
void register_builtin_dxf_linear_extrude()
{
- builtin_modules["dxf_linear_extrude"] = new DxfLinearExtrudeModule();
- builtin_modules["linear_extrude"] = new DxfLinearExtrudeModule();
+ builtin_modules["dxf_linear_extrude"] = new LinearExtrudeModule();
+ builtin_modules["linear_extrude"] = new LinearExtrudeModule();
}
-PolySet *DxfLinearExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) const
+PolySet *LinearExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) const
{
if (!evaluator) {
PRINTF("WARNING: No suitable PolySetEvaluator found for %s module!", this->name().c_str());
@@ -140,7 +140,7 @@ PolySet *DxfLinearExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) con
return ps;
}
-std::string DxfLinearExtrudeNode::toString() const
+std::string LinearExtrudeNode::toString() const
{
std::stringstream stream;
diff --git a/src/dxflinextrudenode.h b/src/linearextrudenode.h
index 360fd28..503f1bd 100644
--- a/src/dxflinextrudenode.h
+++ b/src/linearextrudenode.h
@@ -1,13 +1,13 @@
-#ifndef DXFLINEXTRUDENODE_H_
-#define DXFLINEXTRUDENODE_H_
+#ifndef LINEAREXTRUDENODE_H_
+#define LINEAREXTRUDENODE_H_
#include "node.h"
#include "visitor.h"
-class DxfLinearExtrudeNode : public AbstractPolyNode
+class LinearExtrudeNode : public AbstractPolyNode
{
public:
- DxfLinearExtrudeNode(const ModuleInstantiation *mi) : AbstractPolyNode(mi) {
+ LinearExtrudeNode(const ModuleInstantiation *mi) : AbstractPolyNode(mi) {
convexity = slices = 0;
fn = fs = fa = height = twist = 0;
origin_x = origin_y = scale = 0;
diff --git a/src/qtcolorbutton/README.txt b/src/qtcolorbutton/README.txt
deleted file mode 100644
index 4b55f67..0000000
--- a/src/qtcolorbutton/README.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-The QtColorButton class is copied from the gradient editor in Qt's shared tool classes:
-http://qt.gitorious.org/qt/qt/trees/master/tools/shared/qtgradienteditor
diff --git a/src/qtcolorbutton/qtcolorbutton.cpp b/src/qtcolorbutton/qtcolorbutton.cpp
deleted file mode 100644
index 21b9848..0000000
--- a/src/qtcolorbutton/qtcolorbutton.cpp
+++ /dev/null
@@ -1,278 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial Usage
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qtcolorbutton.h"
-#include <QtGui/QColorDialog>
-#include <QtGui/QPainter>
-#include <QtCore/QMimeData>
-#include <QtGui/QDragEnterEvent>
-#include <QtGui/QApplication>
-
-QT_BEGIN_NAMESPACE
-
-class QtColorButtonPrivate
-{
- QtColorButton *q_ptr;
- Q_DECLARE_PUBLIC(QtColorButton)
-public:
- QColor m_color;
-#ifndef QT_NO_DRAGANDDROP
- QColor m_dragColor;
- QPoint m_dragStart;
- bool m_dragging;
-#endif
- bool m_backgroundCheckered;
-
- void slotEditColor();
- QColor shownColor() const;
- QPixmap generatePixmap() const;
-};
-
-void QtColorButtonPrivate::slotEditColor()
-{
- bool ok;
- const QRgb rgba = QColorDialog::getRgba(m_color.rgba(), &ok, q_ptr);
- if (!ok)
- return;
- const QColor c = QColor::fromRgba(rgba);
- if (c == q_ptr->color())
- return;
- q_ptr->setColor(c);
- emit q_ptr->colorChanged(m_color);
-}
-
-QColor QtColorButtonPrivate::shownColor() const
-{
-#ifndef QT_NO_DRAGANDDROP
- if (m_dragging)
- return m_dragColor;
-#endif
- return m_color;
-}
-
-QPixmap QtColorButtonPrivate::generatePixmap() const
-{
- QPixmap pix(24, 24);
-
- int pixSize = 20;
- QBrush br(shownColor());
-
- QPixmap pm(2 * pixSize, 2 * pixSize);
- QPainter pmp(&pm);
- pmp.fillRect(0, 0, pixSize, pixSize, Qt::lightGray);
- pmp.fillRect(pixSize, pixSize, pixSize, pixSize, Qt::lightGray);
- pmp.fillRect(0, pixSize, pixSize, pixSize, Qt::darkGray);
- pmp.fillRect(pixSize, 0, pixSize, pixSize, Qt::darkGray);
- pmp.fillRect(0, 0, 2 * pixSize, 2 * pixSize, shownColor());
- br = QBrush(pm);
-
- QPainter p(&pix);
- int corr = 1;
- QRect r = pix.rect().adjusted(corr, corr, -corr, -corr);
- p.setBrushOrigin((r.width() % pixSize + pixSize) / 2 + corr, (r.height() % pixSize + pixSize) / 2 + corr);
- p.fillRect(r, br);
-
- p.fillRect(r.width() / 4 + corr, r.height() / 4 + corr,
- r.width() / 2, r.height() / 2,
- QColor(shownColor().rgb()));
- p.drawRect(pix.rect().adjusted(0, 0, -1, -1));
-
- return pix;
-}
-
-///////////////
-
-QtColorButton::QtColorButton(QWidget *parent)
- : QToolButton(parent)
-{
- d_ptr = new QtColorButtonPrivate;
- d_ptr->q_ptr = this;
- d_ptr->m_dragging = false;
- d_ptr->m_backgroundCheckered = true;
-
- setAcceptDrops(true);
-
- connect(this, SIGNAL(clicked()), this, SLOT(slotEditColor()));
- setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
-}
-
-QtColorButton::~QtColorButton()
-{
- delete d_ptr;
-}
-
-void QtColorButton::setColor(const QColor &color)
-{
- if (d_ptr->m_color == color)
- return;
- d_ptr->m_color = color;
- update();
-}
-
-QColor QtColorButton::color() const
-{
- return d_ptr->m_color;
-}
-
-void QtColorButton::setBackgroundCheckered(bool checkered)
-{
- if (d_ptr->m_backgroundCheckered == checkered)
- return;
- d_ptr->m_backgroundCheckered = checkered;
- update();
-}
-
-bool QtColorButton::isBackgroundCheckered() const
-{
- return d_ptr->m_backgroundCheckered;
-}
-
-void QtColorButton::paintEvent(QPaintEvent *event)
-{
- QToolButton::paintEvent(event);
- if (!isEnabled())
- return;
-
- const int pixSize = 10;
- QBrush br(d_ptr->shownColor());
- if (d_ptr->m_backgroundCheckered) {
- QPixmap pm(2 * pixSize, 2 * pixSize);
- QPainter pmp(&pm);
- pmp.fillRect(0, 0, pixSize, pixSize, Qt::white);
- pmp.fillRect(pixSize, pixSize, pixSize, pixSize, Qt::white);
- pmp.fillRect(0, pixSize, pixSize, pixSize, Qt::black);
- pmp.fillRect(pixSize, 0, pixSize, pixSize, Qt::black);
- pmp.fillRect(0, 0, 2 * pixSize, 2 * pixSize, d_ptr->shownColor());
- br = QBrush(pm);
- }
-
- QPainter p(this);
- const int corr = 4;
- QRect r = rect().adjusted(corr, corr, -corr, -corr);
- p.setBrushOrigin((r.width() % pixSize + pixSize) / 2 + corr, (r.height() % pixSize + pixSize) / 2 + corr);
- p.fillRect(r, br);
-
- //const int adjX = qRound(r.width() / 4.0);
- //const int adjY = qRound(r.height() / 4.0);
- //p.fillRect(r.adjusted(adjX, adjY, -adjX, -adjY),
- // QColor(d_ptr->shownColor().rgb()));
- /*
- p.fillRect(r.adjusted(0, r.height() * 3 / 4, 0, 0),
- QColor(d_ptr->shownColor().rgb()));
- p.fillRect(r.adjusted(0, 0, 0, -r.height() * 3 / 4),
- QColor(d_ptr->shownColor().rgb()));
- */
- /*
- const QColor frameColor0(0, 0, 0, qRound(0.2 * (0xFF - d_ptr->shownColor().alpha())));
- p.setPen(frameColor0);
- p.drawRect(r.adjusted(adjX, adjY, -adjX - 1, -adjY - 1));
- */
-
- const QColor frameColor1(0, 0, 0, 26);
- p.setPen(frameColor1);
- p.drawRect(r.adjusted(1, 1, -2, -2));
- const QColor frameColor2(0, 0, 0, 51);
- p.setPen(frameColor2);
- p.drawRect(r.adjusted(0, 0, -1, -1));
-}
-
-void QtColorButton::mousePressEvent(QMouseEvent *event)
-{
-#ifndef QT_NO_DRAGANDDROP
- if (event->button() == Qt::LeftButton)
- d_ptr->m_dragStart = event->pos();
-#endif
- QToolButton::mousePressEvent(event);
-}
-
-void QtColorButton::mouseMoveEvent(QMouseEvent *event)
-{
-#ifndef QT_NO_DRAGANDDROP
- if (event->buttons() & Qt::LeftButton &&
- (d_ptr->m_dragStart - event->pos()).manhattanLength() > QApplication::startDragDistance()) {
- QMimeData *mime = new QMimeData;
- mime->setColorData(color());
- QDrag *drg = new QDrag(this);
- drg->setMimeData(mime);
- drg->setPixmap(d_ptr->generatePixmap());
- setDown(false);
- event->accept();
- drg->start();
- return;
- }
-#endif
- QToolButton::mouseMoveEvent(event);
-}
-
-#ifndef QT_NO_DRAGANDDROP
-void QtColorButton::dragEnterEvent(QDragEnterEvent *event)
-{
- const QMimeData *mime = event->mimeData();
- if (!mime->hasColor())
- return;
-
- event->accept();
- d_ptr->m_dragColor = qvariant_cast<QColor>(mime->colorData());
- d_ptr->m_dragging = true;
- update();
-}
-
-void QtColorButton::dragLeaveEvent(QDragLeaveEvent *event)
-{
- event->accept();
- d_ptr->m_dragging = false;
- update();
-}
-
-void QtColorButton::dropEvent(QDropEvent *event)
-{
- event->accept();
- d_ptr->m_dragging = false;
- if (d_ptr->m_dragColor == color())
- return;
- setColor(d_ptr->m_dragColor);
- emit colorChanged(color());
-}
-#endif
-
-QT_END_NAMESPACE
-
-#include "moc_qtcolorbutton.cpp"
diff --git a/src/qtcolorbutton/qtcolorbutton.h b/src/qtcolorbutton/qtcolorbutton.h
deleted file mode 100644
index 26bdde0..0000000
--- a/src/qtcolorbutton/qtcolorbutton.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial Usage
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTCOLORBUTTON_H
-#define QTCOLORBUTTON_H
-
-#include <QtGui/QToolButton>
-
-QT_BEGIN_NAMESPACE
-
-class QtColorButton : public QToolButton
-{
- Q_OBJECT
- Q_PROPERTY(bool backgroundCheckered READ isBackgroundCheckered WRITE setBackgroundCheckered)
-public:
- QtColorButton(QWidget *parent = 0);
- ~QtColorButton();
-
- bool isBackgroundCheckered() const;
- void setBackgroundCheckered(bool checkered);
-
- QColor color() const;
-
-public slots:
-
- void setColor(const QColor &color);
-
-signals:
- void colorChanged(const QColor &color);
-protected:
- void paintEvent(QPaintEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
-#ifndef QT_NO_DRAGANDDROP
- void dragEnterEvent(QDragEnterEvent *event);
- void dragLeaveEvent(QDragLeaveEvent *event);
- void dropEvent(QDropEvent *event);
-#endif
-private:
- class QtColorButtonPrivate *d_ptr;
- Q_DECLARE_PRIVATE(QtColorButton)
- Q_DISABLE_COPY(QtColorButton)
- Q_PRIVATE_SLOT(d_func(), void slotEditColor())
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/qtcolorbutton/qtcolorbutton.pri b/src/qtcolorbutton/qtcolorbutton.pri
deleted file mode 100644
index 0e41068..0000000
--- a/src/qtcolorbutton/qtcolorbutton.pri
+++ /dev/null
@@ -1,4 +0,0 @@
-INCLUDEPATH += $$PWD
-DEPENDPATH += $$PWD
-SOURCES += $$PWD/qtcolorbutton.cpp
-HEADERS += $$PWD/qtcolorbutton.h
diff --git a/src/dxfrotextrude.cc b/src/rotateextrude.cc
index 646b643..3a6eb55 100644
--- a/src/dxfrotextrude.cc
+++ b/src/rotateextrude.cc
@@ -24,7 +24,7 @@
*
*/
-#include "dxfrotextrudenode.h"
+#include "rotateextrudenode.h"
#include "module.h"
#include "context.h"
#include "printutils.h"
@@ -42,16 +42,16 @@ using namespace boost::assign; // bring 'operator+=()' into scope
#include <QFileInfo>
-class DxfRotateExtrudeModule : public AbstractModule
+class RotateExtrudeModule : public AbstractModule
{
public:
- DxfRotateExtrudeModule() { }
+ RotateExtrudeModule() { }
virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
};
-AbstractNode *DxfRotateExtrudeModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const
+AbstractNode *RotateExtrudeModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const
{
- DxfRotateExtrudeNode *node = new DxfRotateExtrudeNode(inst);
+ RotateExtrudeNode *node = new RotateExtrudeNode(inst);
std::vector<std::string> argnames;
argnames += "file", "layer", "origin", "scale";
@@ -96,11 +96,11 @@ AbstractNode *DxfRotateExtrudeModule::evaluate(const Context *ctx, const ModuleI
void register_builtin_dxf_rotate_extrude()
{
- builtin_modules["dxf_rotate_extrude"] = new DxfRotateExtrudeModule();
- builtin_modules["rotate_extrude"] = new DxfRotateExtrudeModule();
+ builtin_modules["dxf_rotate_extrude"] = new RotateExtrudeModule();
+ builtin_modules["rotate_extrude"] = new RotateExtrudeModule();
}
-PolySet *DxfRotateExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) const
+PolySet *RotateExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) const
{
if (!evaluator) {
PRINTF("WARNING: No suitable PolySetEvaluator found for %s module!", this->name().c_str());
@@ -116,7 +116,7 @@ PolySet *DxfRotateExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) con
return ps;
}
-std::string DxfRotateExtrudeNode::toString() const
+std::string RotateExtrudeNode::toString() const
{
std::stringstream stream;
diff --git a/src/dxfrotextrudenode.h b/src/rotateextrudenode.h
index e0ade82..613d44b 100644
--- a/src/dxfrotextrudenode.h
+++ b/src/rotateextrudenode.h
@@ -1,13 +1,13 @@
-#ifndef DXFROTEXTRUDENODE_H_
-#define DXFROTEXTRUDENODE_H_
+#ifndef ROTATEEXTRUDENODE_H_
+#define ROTATEEXTRUDENODE_H_
#include "node.h"
#include "visitor.h"
-class DxfRotateExtrudeNode : public AbstractPolyNode
+class RotateExtrudeNode : public AbstractPolyNode
{
public:
- DxfRotateExtrudeNode(const ModuleInstantiation *mi) : AbstractPolyNode(mi) {
+ RotateExtrudeNode(const ModuleInstantiation *mi) : AbstractPolyNode(mi) {
convexity = 0;
fn = fs = fa = 0;
origin_x = origin_y = scale = 0;
diff --git a/src/value.cc b/src/value.cc
index 53fd6dc..685bf81 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -193,6 +193,9 @@ Value Value::operator < (const Value &v) const
if (this->type == NUMBER && v.type == NUMBER) {
return Value(this->num < v.num);
}
+ else if (this->type == STRING && v.type == STRING) {
+ return Value(this->text < v.text);
+ }
return Value();
}
@@ -201,6 +204,9 @@ Value Value::operator <= (const Value &v) const
if (this->type == NUMBER && v.type == NUMBER) {
return Value(this->num <= v.num);
}
+ else if (this->type == STRING && v.type == STRING) {
+ return Value(this->text <= v.text);
+ }
return Value();
}
@@ -240,6 +246,9 @@ Value Value::operator >= (const Value &v) const
if (this->type == NUMBER && v.type == NUMBER) {
return Value(this->num >= v.num);
}
+ else if (this->type == STRING && v.type == STRING) {
+ return Value(this->text >= v.text);
+ }
return Value();
}
@@ -248,6 +257,9 @@ Value Value::operator > (const Value &v) const
if (this->type == NUMBER && v.type == NUMBER) {
return Value(this->num > v.num);
}
+ else if (this->type == STRING && v.type == STRING) {
+ return Value(this->text > v.text);
+ }
return Value();
}
diff --git a/src/visitor.h b/src/visitor.h
index f4846b8..fe350f8 100644
--- a/src/visitor.h
+++ b/src/visitor.h
@@ -22,10 +22,10 @@ public:
virtual Response visit(class State &state, const class CsgNode &node) {
return visit(state, (const class AbstractNode &)node);
}
- virtual Response visit(class State &state, const class DxfLinearExtrudeNode &node) {
+ virtual Response visit(class State &state, const class LinearExtrudeNode &node) {
return visit(state, (const class AbstractPolyNode &)node);
}
- virtual Response visit(class State &state, const class DxfRotateExtrudeNode &node) {
+ virtual Response visit(class State &state, const class RotateExtrudeNode &node) {
return visit(state, (const class AbstractPolyNode &)node);
}
virtual Response visit(class State &state, const class ImportNode &node) {
diff --git a/testdata/scad/features/polyhedron-tests.scad b/testdata/scad/features/polyhedron-tests.scad
new file mode 100644
index 0000000..690d962
--- /dev/null
+++ b/testdata/scad/features/polyhedron-tests.scad
@@ -0,0 +1,20 @@
+module polyhedrons() {
+ polyhedron(points = [[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],
+ triangles = [[0,4,2],[0,2,5],[0,3,4],[0,5,3],[1,2,4],[1,5,2],[1,4,3], [1,3,5]]);
+
+ // One face flipped
+ translate([2,0,0])
+ polyhedron(points = [[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],
+ triangles = [[0,4,2],[0,2,5],[0,3,4],[0,5,3],[1,2,4],[1,5,2],[1,3,4], [1,3,5]]);
+
+ // All faces flipped
+ translate([4,0,0])
+ polyhedron(points = [[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],
+ triangles = [[0,2,4],[0,5,2],[0,4,3],[0,3,5],[1,4,2],[1,2,5],[1,3,4], [1,5,3]]);
+}
+
+polyhedrons();
+translate([0,2,0]) difference() {
+ polyhedrons();
+ translate([2,0,2]) cube([8,3,3], center=true);
+}
diff --git a/testdata/scad/minimal/allfunctions.scad b/testdata/scad/minimal/allfunctions.scad
index e58bd07..c33b43c 100644
--- a/testdata/scad/minimal/allfunctions.scad
+++ b/testdata/scad/minimal/allfunctions.scad
@@ -22,3 +22,4 @@ a = str();
a = lookup();
a = dxf_dim();
a = dxf_cross();
+a = version();
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index feff2c2..9e6ae0a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -120,8 +120,8 @@ set(COMMON_SOURCES
../src/dxfdata.cc
../src/dxftess.cc
../src/dxfdim.cc
- ../src/dxflinextrude.cc
- ../src/dxfrotextrude.cc
+ ../src/linearextrude.cc
+ ../src/rotateextrude.cc
../src/printutils.cc
../src/progress.cc
../src/nodedumper.cc
@@ -261,6 +261,7 @@ LIST(APPEND CGALPNGTEST_FILES
${CMAKE_SOURCE_DIR}/../testdata/scad/features/cube-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/features/sphere-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/features/cylinder-tests.scad
+ ${CMAKE_SOURCE_DIR}/../testdata/scad/features/polyhedron-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/features/union-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/features/difference-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/features/intersection-tests.scad
diff --git a/tests/regression/cgalpngtest/polyhedron-tests-expected.png b/tests/regression/cgalpngtest/polyhedron-tests-expected.png
new file mode 100644
index 0000000..c80990f
--- /dev/null
+++ b/tests/regression/cgalpngtest/polyhedron-tests-expected.png
Binary files differ
diff --git a/tests/regression/opencsgtest/polyhedron-tests-expected.png b/tests/regression/opencsgtest/polyhedron-tests-expected.png
new file mode 100644
index 0000000..0740f1a
--- /dev/null
+++ b/tests/regression/opencsgtest/polyhedron-tests-expected.png
Binary files differ
contact: Jan Huwald // Impressum