Made Plater::arrange a little less noisy, noted TODO for the background process pause.

Also finished implemented bed_centerf()
This commit is contained in:
Joseph Lenox 2018-05-09 21:48:16 -05:00 committed by Joseph Lenox
parent 66bca83b57
commit 6e9cd3bfdd
2 changed files with 12 additions and 8 deletions

View File

@ -373,12 +373,15 @@ void Plater::refresh_canvases() {
}
void Plater::arrange() {
// pause background process
Slic3r::Log::info(LogChannel, L"Called arrange()");
auto bb {Slic3r::BoundingBoxf(this->config->get<ConfigOptionPoints>("bed_shape").values)};
bool success {this->model->arrange_objects(5, &bb)};
// TODO pause background process
const Slic3r::BoundingBoxf bb {Slic3r::BoundingBoxf(this->config->get<ConfigOptionPoints>("bed_shape").values)};
bool success {this->model->arrange_objects(this->config->min_object_distance(), &bb)};
if (success) {
GetFrame()->statusbar->SetStatusText(_("Objects were arranged."));
} else {
GetFrame()->statusbar->SetStatusText(_("Arrange failed."));
}
this->on_model_change(true);
}

View File

@ -39,7 +39,7 @@ public:
Plater(wxWindow* parent, const wxString& title, std::shared_ptr<Settings> _settings);
void add();
/// Arrange models
/// Arrange models via a simple packing mechanism based on bounding boxes.
void arrange();
/// Ask if there are any unsaved changes.
@ -90,8 +90,9 @@ private:
int get_object_index(size_t object_id);
Slic3r::Pointf bed_centerf() {
auto bed_shape { Slic3r::Polygon::new_scale(this->config->get<ConfigOptionPoints>("bed_shape").values) };
return Slic3r::Pointf();
const auto& bed_shape { Slic3r::Polygon::new_scale(this->config->get<ConfigOptionPoints>("bed_shape").values) };
const auto& bed_center {BoundingBox(bed_shape).center()};
return Slic3r::Pointf::new_unscale(bed_center);
}
/// Build thumbnails for the models