Skip to content

Commit

Permalink
Merge pull request #1579 from openscad/leafnode-const
Browse files Browse the repository at this point in the history
Change LeafNode::createGeometry() to return a const geometry pointer.
  • Loading branch information
kintel committed Feb 12, 2016
2 parents 9950e6a + 5f0e716 commit 22cf081
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/import.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/importnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
2 changes: 1 addition & 1 deletion src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/primitives.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

/**
Expand Down Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 22cf081

Please sign in to comment.