--- a/src/modeleditcontext.cpp Fri Mar 06 23:45:44 2020 +0200 +++ b/src/modeleditcontext.cpp Mon Mar 09 14:21:54 2020 +0200 @@ -19,15 +19,15 @@ #include "modeleditcontext.h" Model::EditContext::EditContext(Model& model) : - model{model} + storedModel{model} { } -ldraw::Id Model::EditContext::append(std::unique_ptr<ldraw::Object>&& object) +ldraw::id_t Model::EditContext::append(std::unique_ptr<ldraw::Object>&& object) { - const ldraw::Id id = object->id; - this->model.objectsById[id] = object.get(); - this->model.append(std::move(object)); + const ldraw::id_t id = object->id; + this->model().objectsById[id] = object.get(); + this->model().append(std::move(object)); return id; } @@ -39,12 +39,32 @@ object->setProperty(property, value); } -void Model::EditContext::invertObject(ldraw::Id id) +void Model::EditContext::invertObject(ldraw::id_t id) { - auto it = this->model.objectsById.find(id); - if (it != this->model.objectsById.end()) + auto it = this->model().objectsById.find(id); + if (it != this->model().objectsById.end()) { ldraw::Object* object = it->second; object->invert(); } } + +Model& Model::EditContext::model() +{ + return this->storedModel; +} + +auto ldraw::splitQuadrilateral( + Model::EditContext& editor, + ldraw::quadrilateralid_t quadrilateral_id, + ldraw::QuadrilateralSplit splitType +) -> std::optional<std::pair<ldraw::triangleid_t, ldraw::triangleid_t>> +{ + std::optional<std::pair<ldraw::triangleid_t, ldraw::triangleid_t>> result; + const ldraw::Quadrilateral* quadrilateral = editor.model().get(quadrilateral_id); + if (quadrilateral != nullptr) + { + + } + return result; +}