Make read-only constructor parameters - private.
This commit is contained in:
parent
76738dc66b
commit
22b05cb187
6 changed files with 81 additions and 32 deletions
|
@ -4,8 +4,8 @@
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
LayerRegion::LayerRegion(Layer *layer, PrintRegion *region)
|
LayerRegion::LayerRegion(Layer *layer, PrintRegion *region)
|
||||||
: layer(layer),
|
: _layer(layer),
|
||||||
region(region)
|
_region(region)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,18 @@ LayerRegion::~LayerRegion()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Layer*
|
||||||
|
LayerRegion::layer()
|
||||||
|
{
|
||||||
|
return this->_layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintRegion*
|
||||||
|
LayerRegion::region()
|
||||||
|
{
|
||||||
|
return this->_region;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
#ifdef SLIC3RXS
|
||||||
REGISTER_CLASS(LayerRegion, "Layer::Region");
|
REGISTER_CLASS(LayerRegion, "Layer::Region");
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,8 +32,8 @@ REGISTER_CLASS(LayerRegion, "Layer::Region");
|
||||||
|
|
||||||
Layer::Layer(int id, PrintObject *object, coordf_t height, coordf_t print_z,
|
Layer::Layer(int id, PrintObject *object, coordf_t height, coordf_t print_z,
|
||||||
coordf_t slice_z)
|
coordf_t slice_z)
|
||||||
: id(id),
|
: _id(id),
|
||||||
object(object),
|
_object(object),
|
||||||
upper_layer(NULL),
|
upper_layer(NULL),
|
||||||
lower_layer(NULL),
|
lower_layer(NULL),
|
||||||
regions(),
|
regions(),
|
||||||
|
@ -47,6 +59,19 @@ Layer::~Layer()
|
||||||
this->clear_regions();
|
this->clear_regions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
Layer::id()
|
||||||
|
{
|
||||||
|
return this->_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintObject*
|
||||||
|
Layer::object()
|
||||||
|
{
|
||||||
|
return this->_object;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
Layer::region_count()
|
Layer::region_count()
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,8 +24,8 @@ class LayerRegion
|
||||||
friend class Layer;
|
friend class Layer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Layer *layer;
|
Layer* layer();
|
||||||
PrintRegion *region;
|
PrintRegion* region();
|
||||||
|
|
||||||
// collection of surfaces generated by slicing the original geometry
|
// collection of surfaces generated by slicing the original geometry
|
||||||
// divided by type top/bottom/internal
|
// divided by type top/bottom/internal
|
||||||
|
@ -51,6 +51,9 @@ class LayerRegion
|
||||||
ExtrusionEntityCollection fills;
|
ExtrusionEntityCollection fills;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Layer *_layer;
|
||||||
|
PrintRegion *_region;
|
||||||
|
|
||||||
LayerRegion(Layer *layer, PrintRegion *region);
|
LayerRegion(Layer *layer, PrintRegion *region);
|
||||||
~LayerRegion();
|
~LayerRegion();
|
||||||
};
|
};
|
||||||
|
@ -62,8 +65,9 @@ class Layer {
|
||||||
friend class PrintObject;
|
friend class PrintObject;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int id; // sequential number of layer, 0-based
|
int id();
|
||||||
PrintObject *object;
|
PrintObject* object();
|
||||||
|
|
||||||
Layer *upper_layer;
|
Layer *upper_layer;
|
||||||
Layer *lower_layer;
|
Layer *lower_layer;
|
||||||
LayerRegionPtrs regions;
|
LayerRegionPtrs regions;
|
||||||
|
@ -84,6 +88,9 @@ class Layer {
|
||||||
void delete_region(int idx);
|
void delete_region(int idx);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
int _id; // sequential number of layer, 0-based
|
||||||
|
PrintObject *_object;
|
||||||
|
|
||||||
Layer(int id, PrintObject *object, coordf_t height, coordf_t print_z,
|
Layer(int id, PrintObject *object, coordf_t height, coordf_t print_z,
|
||||||
coordf_t slice_z);
|
coordf_t slice_z);
|
||||||
virtual ~Layer();
|
virtual ~Layer();
|
||||||
|
|
|
@ -48,7 +48,7 @@ REGISTER_CLASS(PrintState, "Print::State");
|
||||||
|
|
||||||
|
|
||||||
PrintRegion::PrintRegion(Print* print)
|
PrintRegion::PrintRegion(Print* print)
|
||||||
: config(), print(print)
|
: config(), _print(print)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,10 +56,16 @@ PrintRegion::~PrintRegion()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Print*
|
||||||
|
PrintRegion::print()
|
||||||
|
{
|
||||||
|
return this->_print;
|
||||||
|
}
|
||||||
|
|
||||||
PrintConfig &
|
PrintConfig &
|
||||||
PrintRegion::print_config()
|
PrintRegion::print_config()
|
||||||
{
|
{
|
||||||
return print->config;
|
return this->_print->config;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
#ifdef SLIC3RXS
|
||||||
|
@ -69,10 +75,10 @@ REGISTER_CLASS(PrintRegion, "Print::Region");
|
||||||
|
|
||||||
PrintObject::PrintObject(Print* print, ModelObject* model_object,
|
PrintObject::PrintObject(Print* print, ModelObject* model_object,
|
||||||
const BoundingBoxf3 &modobj_bbox)
|
const BoundingBoxf3 &modobj_bbox)
|
||||||
: print(print),
|
: _print(print),
|
||||||
model_object(model_object)
|
_model_object(model_object)
|
||||||
{
|
{
|
||||||
region_volumes.resize(print->regions.size());
|
region_volumes.resize(this->_print->regions.size());
|
||||||
|
|
||||||
// Compute the translation to be applied to our meshes so that we work with smaller coordinates
|
// Compute the translation to be applied to our meshes so that we work with smaller coordinates
|
||||||
{
|
{
|
||||||
|
@ -97,6 +103,18 @@ PrintObject::~PrintObject()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Print*
|
||||||
|
PrintObject::print()
|
||||||
|
{
|
||||||
|
return this->_print;
|
||||||
|
}
|
||||||
|
|
||||||
|
ModelObject*
|
||||||
|
PrintObject::model_object()
|
||||||
|
{
|
||||||
|
return this->_model_object;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PrintObject::add_region_volume(int region_id, int volume_id)
|
PrintObject::add_region_volume(int region_id, int volume_id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,11 +46,13 @@ class PrintRegion
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PrintRegionConfig config;
|
PrintRegionConfig config;
|
||||||
Print* print;
|
|
||||||
|
|
||||||
|
Print* print();
|
||||||
PrintConfig &print_config();
|
PrintConfig &print_config();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Print* _print;
|
||||||
|
|
||||||
PrintRegion(Print* print);
|
PrintRegion(Print* print);
|
||||||
virtual ~PrintRegion();
|
virtual ~PrintRegion();
|
||||||
};
|
};
|
||||||
|
@ -65,9 +67,6 @@ class PrintObject
|
||||||
friend class Print;
|
friend class Print;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Print* print;
|
|
||||||
ModelObject* model_object;
|
|
||||||
|
|
||||||
// vector of (vectors of volume ids), indexed by region_id
|
// vector of (vectors of volume ids), indexed by region_id
|
||||||
std::vector<std::vector<int> > region_volumes;
|
std::vector<std::vector<int> > region_volumes;
|
||||||
Points copies; // Slic3r::Point objects in scaled G-code coordinates
|
Points copies; // Slic3r::Point objects in scaled G-code coordinates
|
||||||
|
@ -89,6 +88,10 @@ class PrintObject
|
||||||
// TODO: Fill* fill_maker => (is => 'lazy');
|
// TODO: Fill* fill_maker => (is => 'lazy');
|
||||||
PrintState _state;
|
PrintState _state;
|
||||||
|
|
||||||
|
|
||||||
|
Print* print();
|
||||||
|
ModelObject* model_object();
|
||||||
|
|
||||||
// adds region_id, too, if necessary
|
// adds region_id, too, if necessary
|
||||||
void add_region_volume(int region_id, int volume_id);
|
void add_region_volume(int region_id, int volume_id);
|
||||||
|
|
||||||
|
@ -107,6 +110,9 @@ class PrintObject
|
||||||
void delete_support_layer(int idx);
|
void delete_support_layer(int idx);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Print* _print;
|
||||||
|
ModelObject* _model_object;
|
||||||
|
|
||||||
// TODO: call model_object->get_bounding_box() instead of accepting
|
// TODO: call model_object->get_bounding_box() instead of accepting
|
||||||
// parameter
|
// parameter
|
||||||
PrintObject(Print* print, ModelObject* model_object,
|
PrintObject(Print* print, ModelObject* model_object,
|
||||||
|
|
|
@ -9,10 +9,8 @@
|
||||||
%name{Slic3r::Layer::Region} class LayerRegion {
|
%name{Slic3r::Layer::Region} class LayerRegion {
|
||||||
// owned by Layer, no constructor/destructor
|
// owned by Layer, no constructor/destructor
|
||||||
|
|
||||||
Ref<Layer> layer()
|
Ref<Layer> layer();
|
||||||
%code%{ RETVAL = THIS->layer; %};
|
Ref<PrintRegion> region();
|
||||||
Ref<PrintRegion> region()
|
|
||||||
%code%{ RETVAL = THIS->region; %};
|
|
||||||
|
|
||||||
Ref<SurfaceCollection> slices()
|
Ref<SurfaceCollection> slices()
|
||||||
%code%{ RETVAL = &THIS->slices; %};
|
%code%{ RETVAL = &THIS->slices; %};
|
||||||
|
@ -33,10 +31,8 @@
|
||||||
%name{Slic3r::Layer} class Layer {
|
%name{Slic3r::Layer} class Layer {
|
||||||
// owned by PrintObject, no constructor/destructor
|
// owned by PrintObject, no constructor/destructor
|
||||||
|
|
||||||
int id()
|
int id();
|
||||||
%code%{ RETVAL = THIS->id; %};
|
Ref<PrintObject> object();
|
||||||
Ref<PrintObject> object()
|
|
||||||
%code%{ RETVAL = THIS->object; %};
|
|
||||||
Ref<Layer> upper_layer()
|
Ref<Layer> upper_layer()
|
||||||
%code%{ RETVAL = THIS->upper_layer; %};
|
%code%{ RETVAL = THIS->upper_layer; %};
|
||||||
Ref<Layer> lower_layer()
|
Ref<Layer> lower_layer()
|
||||||
|
|
|
@ -47,8 +47,7 @@ _constant()
|
||||||
|
|
||||||
Ref<PrintRegionConfig> config()
|
Ref<PrintRegionConfig> config()
|
||||||
%code%{ RETVAL = &THIS->config; %};
|
%code%{ RETVAL = &THIS->config; %};
|
||||||
Ref<Print> print()
|
Ref<Print> print();
|
||||||
%code%{ RETVAL = THIS->print; %};
|
|
||||||
Ref<PrintConfig> print_config()
|
Ref<PrintConfig> print_config()
|
||||||
%code%{ RETVAL = &THIS->print_config(); %};
|
%code%{ RETVAL = &THIS->print_config(); %};
|
||||||
};
|
};
|
||||||
|
@ -64,12 +63,10 @@ _constant()
|
||||||
RETVAL = THIS->region_volumes[region_id];
|
RETVAL = THIS->region_volumes[region_id];
|
||||||
%};
|
%};
|
||||||
int region_count()
|
int region_count()
|
||||||
%code%{ RETVAL = THIS->print->regions.size(); %};
|
%code%{ RETVAL = THIS->print()->regions.size(); %};
|
||||||
|
|
||||||
Ref<Print> print()
|
Ref<Print> print();
|
||||||
%code%{ RETVAL = THIS->print; %};
|
Ref<ModelObject> model_object();
|
||||||
Ref<ModelObject> model_object()
|
|
||||||
%code%{ RETVAL = THIS->model_object; %};
|
|
||||||
Ref<PrintObjectConfig> config()
|
Ref<PrintObjectConfig> config()
|
||||||
%code%{ RETVAL = &THIS->config; %};
|
%code%{ RETVAL = &THIS->config; %};
|
||||||
Points copies()
|
Points copies()
|
||||||
|
|
Loading…
Reference in a new issue