Set typedef (via using directive) for object references (iterators) and object indices.

This commit is contained in:
Joseph Lenox 2018-05-11 22:38:00 -05:00
parent 872fd61706
commit 1d4e5775ae
2 changed files with 10 additions and 4 deletions

View File

@ -328,7 +328,7 @@ std::vector<int> Plater::load_model_objects(ModelObjectPtrs model_objects) {
MainFrame* Plater::GetFrame() { return dynamic_cast<MainFrame*>(wxGetTopLevelParent(this)); }
int Plater::get_object_index(size_t object_id) {
int Plater::get_object_index(ObjIdx object_id) {
for (size_t i = 0U; i < this->objects.size(); i++) {
if (this->objects.at(i).identifier == object_id) return static_cast<int>(i);
}

View File

@ -28,7 +28,8 @@
namespace Slic3r { namespace GUI {
using UndoOperation = int;
using obj_index = unsigned int;
using ObjIdx = unsigned int;
using ObjRef = std::vector<PlaterObject>::iterator;
class PlaterObject;
class Plate2D;
@ -99,8 +100,13 @@ private:
/// Method to get the top-level window and cast it as a MainFrame.
MainFrame* GetFrame();
void select_object(size_t& obj_idx) { };
int get_object_index(size_t object_id);
void select_object(ObjRef obj_idx);
void select_object(ObjIdx obj_idx);
/// Overload to unselect objects
void select_object();
int get_object_index(ObjIdx object_id);
/// Get the center of the configured bed's bounding box.
Slic3r::Pointf bed_centerf() {