diff -r 6de5ac1fb471 -r 3a9e761e4faa src/modeleditcontext.cpp --- a/src/modeleditcontext.cpp Sun Jan 19 14:25:57 2020 +0200 +++ b/src/modeleditcontext.cpp Wed Jan 22 00:23:29 2020 +0200 @@ -23,9 +23,12 @@ { } -void Model::EditContext::append(std::unique_ptr&& object) +linetypes::Id Model::EditContext::append(std::unique_ptr&& object) { + const linetypes::Id id = object->id; + this->model.objectsById[id] = object.get(); this->model.append(std::move(object)); + return id; } void Model::EditContext::setObjectProperty( @@ -35,3 +38,13 @@ { object->setProperty(property, value); } + +void Model::EditContext::invertObject(linetypes::Id id) +{ + auto it = this->model.objectsById.find(id); + if (it != this->model.objectsById.end()) + { + linetypes::Object* object = it->second; + object->invert(); + } +}