Removed two useless methods in Print
This commit is contained in:
parent
b28fb2ef17
commit
050f9ff61a
3 changed files with 23 additions and 43 deletions
|
@ -76,46 +76,20 @@ Print::get_object(size_t idx)
|
||||||
return objects.at(idx);
|
return objects.at(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintObject*
|
|
||||||
Print::add_object(ModelObject *model_object, const BoundingBoxf3 &modobj_bbox)
|
|
||||||
{
|
|
||||||
PrintObject *object = new PrintObject(this, model_object, modobj_bbox);
|
|
||||||
objects.push_back(object);
|
|
||||||
|
|
||||||
// invalidate steps
|
|
||||||
this->invalidate_step(psSkirt);
|
|
||||||
this->invalidate_step(psBrim);
|
|
||||||
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
|
|
||||||
PrintObject*
|
|
||||||
Print::set_new_object(size_t idx, ModelObject *model_object, const BoundingBoxf3 &modobj_bbox)
|
|
||||||
{
|
|
||||||
if (idx >= this->objects.size()) throw "bad idx";
|
|
||||||
|
|
||||||
PrintObjectPtrs::iterator old_it = this->objects.begin() + idx;
|
|
||||||
// before deleting object, invalidate all of its steps in order to
|
|
||||||
// invalidate all of the dependent ones in Print
|
|
||||||
(*old_it)->invalidate_all_steps();
|
|
||||||
delete *old_it;
|
|
||||||
|
|
||||||
PrintObject *object = new PrintObject(this, model_object, modobj_bbox);
|
|
||||||
this->objects[idx] = object;
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Print::delete_object(size_t idx)
|
Print::delete_object(size_t idx)
|
||||||
{
|
{
|
||||||
PrintObjectPtrs::iterator i = this->objects.begin() + idx;
|
PrintObjectPtrs::iterator i = this->objects.begin() + idx;
|
||||||
|
|
||||||
|
// before deleting object, invalidate all of its steps in order to
|
||||||
|
// invalidate all of the dependent ones in Print
|
||||||
|
(*i)->invalidate_all_steps();
|
||||||
|
|
||||||
|
// destroy object and remove it from our container
|
||||||
delete *i;
|
delete *i;
|
||||||
this->objects.erase(i);
|
this->objects.erase(i);
|
||||||
|
|
||||||
// TODO: purge unused regions
|
// TODO: purge unused regions
|
||||||
|
|
||||||
this->state.invalidate(psSkirt);
|
|
||||||
this->state.invalidate(psBrim);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -375,9 +349,23 @@ Print::add_model_object(ModelObject* model_object, int idx)
|
||||||
{
|
{
|
||||||
BoundingBoxf3 bb;
|
BoundingBoxf3 bb;
|
||||||
model_object->raw_bounding_box(&bb);
|
model_object->raw_bounding_box(&bb);
|
||||||
o = (idx != -1)
|
if (idx != -1) {
|
||||||
? this->set_new_object(idx, model_object, bb)
|
// replacing existing object
|
||||||
: this->add_object(model_object, bb);
|
PrintObjectPtrs::iterator old_it = this->objects.begin() + idx;
|
||||||
|
// before deleting object, invalidate all of its steps in order to
|
||||||
|
// invalidate all of the dependent ones in Print
|
||||||
|
(*old_it)->invalidate_all_steps();
|
||||||
|
delete *old_it;
|
||||||
|
|
||||||
|
this->objects[idx] = o = new PrintObject(this, model_object, bb);
|
||||||
|
} else {
|
||||||
|
o = new PrintObject(this, model_object, bb);
|
||||||
|
objects.push_back(o);
|
||||||
|
|
||||||
|
// invalidate steps
|
||||||
|
this->invalidate_step(psSkirt);
|
||||||
|
this->invalidate_step(psBrim);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ModelVolumePtrs::const_iterator v_i = model_object->volumes.begin(); v_i != model_object->volumes.end(); ++v_i) {
|
for (ModelVolumePtrs::const_iterator v_i = model_object->volumes.begin(); v_i != model_object->volumes.end(); ++v_i) {
|
||||||
|
|
|
@ -168,8 +168,6 @@ class Print
|
||||||
// methods for handling objects
|
// methods for handling objects
|
||||||
void clear_objects();
|
void clear_objects();
|
||||||
PrintObject* get_object(size_t idx);
|
PrintObject* get_object(size_t idx);
|
||||||
PrintObject* add_object(ModelObject *model_object, const BoundingBoxf3 &modobj_bbox);
|
|
||||||
PrintObject* set_new_object(size_t idx, ModelObject *model_object, const BoundingBoxf3 &modobj_bbox);
|
|
||||||
void delete_object(size_t idx);
|
void delete_object(size_t idx);
|
||||||
void reload_object(size_t idx);
|
void reload_object(size_t idx);
|
||||||
|
|
||||||
|
|
|
@ -139,12 +139,6 @@ _constant()
|
||||||
%code%{ RETVAL = &THIS->objects; %};
|
%code%{ RETVAL = &THIS->objects; %};
|
||||||
void clear_objects();
|
void clear_objects();
|
||||||
Ref<PrintObject> get_object(int idx);
|
Ref<PrintObject> get_object(int idx);
|
||||||
Ref<PrintObject> add_object(ModelObject* model_object,
|
|
||||||
BoundingBoxf3 *modobj_bbox)
|
|
||||||
%code%{ RETVAL = THIS->add_object(model_object, *modobj_bbox); %};
|
|
||||||
Ref<PrintObject> set_new_object(size_t idx, ModelObject* model_object,
|
|
||||||
BoundingBoxf3 *modobj_bbox)
|
|
||||||
%code%{ RETVAL = THIS->set_new_object(idx, model_object, *modobj_bbox); %};
|
|
||||||
void delete_object(int idx);
|
void delete_object(int idx);
|
||||||
void reload_object(int idx);
|
void reload_object(int idx);
|
||||||
size_t object_count()
|
size_t object_count()
|
||||||
|
|
Loading…
Add table
Reference in a new issue