src/modeleditcontext.cpp

changeset 35
98906a94732f
parent 26
3a9e761e4faa
child 73
97df974b5ed5
equal deleted inserted replaced
34:1de2b8d64e9f 35:98906a94732f
21 Model::EditContext::EditContext(Model& model) : 21 Model::EditContext::EditContext(Model& model) :
22 model{model} 22 model{model}
23 { 23 {
24 } 24 }
25 25
26 linetypes::Id Model::EditContext::append(std::unique_ptr<linetypes::Object>&& object) 26 ldraw::Id Model::EditContext::append(std::unique_ptr<ldraw::Object>&& object)
27 { 27 {
28 const linetypes::Id id = object->id; 28 const ldraw::Id id = object->id;
29 this->model.objectsById[id] = object.get(); 29 this->model.objectsById[id] = object.get();
30 this->model.append(std::move(object)); 30 this->model.append(std::move(object));
31 return id; 31 return id;
32 } 32 }
33 33
34 void Model::EditContext::setObjectProperty( 34 void Model::EditContext::setObjectProperty(
35 linetypes::Object* object, 35 ldraw::Object* object,
36 linetypes::Property property, 36 ldraw::Property property,
37 const QVariant& value) 37 const QVariant& value)
38 { 38 {
39 object->setProperty(property, value); 39 object->setProperty(property, value);
40 } 40 }
41 41
42 void Model::EditContext::invertObject(linetypes::Id id) 42 void Model::EditContext::invertObject(ldraw::Id id)
43 { 43 {
44 auto it = this->model.objectsById.find(id); 44 auto it = this->model.objectsById.find(id);
45 if (it != this->model.objectsById.end()) 45 if (it != this->model.objectsById.end())
46 { 46 {
47 linetypes::Object* object = it->second; 47 ldraw::Object* object = it->second;
48 object->invert(); 48 object->invert();
49 } 49 }
50 } 50 }

mercurial