Skip to content
Browse files

Merge pull request #1579 from openscad/leafnode-const

Change LeafNode::createGeometry() to return a const geometry pointer.
2 parents 9950e6a + 5f0e716 commit 22cf081d00a2764a731d86f311e7daecf1d90819 @kintel kintel committed
Showing with 7 additions and 7 deletions.
  1. +1 −1 src/import.cc
  2. +1 −1 src/importnode.h
  3. +1 −1 src/node.h
  4. +2 −2 src/primitives.cc
  5. +2 −2 src/surface.cc
View
2 src/import.cc
@@ -184,7 +184,7 @@ void read_stl_facet( std::ifstream &f, stl_facet &facet )
/*!
Will return an empty geometry if the import failed, but not NULL
*/
-Geometry *ImportNode::createGeometry() const
+const Geometry *ImportNode::createGeometry() const
{
Geometry *g = NULL;
View
2 src/importnode.h
@@ -27,5 +27,5 @@ class ImportNode : public LeafNode
int convexity;
double fn, fs, fa;
double origin_x, origin_y, scale;
- virtual class Geometry *createGeometry() const;
+ virtual const class Geometry *createGeometry() const;
};
View
2 src/node.h
@@ -109,7 +109,7 @@ class LeafNode : public AbstractPolyNode
LeafNode(const ModuleInstantiation *mi) : AbstractPolyNode(mi) { };
virtual ~LeafNode() { };
virtual Response accept(class State &state, class Visitor &visitor) const;
- virtual class Geometry *createGeometry() const = 0;
+ virtual const class Geometry *createGeometry() const = 0;
};
std::ostream &operator<<(std::ostream &stream, const AbstractNode &node);
View
4 src/primitives.cc
@@ -105,7 +105,7 @@ class PrimitiveNode : public LeafNode
primitive_type_e type;
int convexity;
ValuePtr points, paths, faces;
- virtual Geometry *createGeometry() const;
+ virtual const Geometry *createGeometry() const;
};
/**
@@ -295,7 +295,7 @@ static void generate_circle(point2d *circle, double r, int fragments)
Creates geometry for this node.
May return an empty Geometry creation failed, but will not return NULL.
*/
-Geometry *PrimitiveNode::createGeometry() const
+const Geometry *PrimitiveNode::createGeometry() const
{
Geometry *g = NULL;
View
4 src/surface.cc
@@ -72,7 +72,7 @@ class SurfaceNode : public LeafNode
bool invert;
int convexity;
- virtual Geometry *createGeometry() const;
+ virtual const Geometry *createGeometry() const;
private:
void convert_image(img_data_t &data, std::vector<unsigned char> &img, unsigned int width, unsigned int height) const;
bool is_png(std::vector<unsigned char> &img) const;
@@ -211,7 +211,7 @@ img_data_t SurfaceNode::read_dat(std::string filename) const
return data;
}
-Geometry *SurfaceNode::createGeometry() const
+const Geometry *SurfaceNode::createGeometry() const
{
img_data_t data = read_png_or_dat(filename);

0 comments on commit 22cf081

Please sign in to comment.
Something went wrong with that request. Please try again.