src/linetypes/edge.cpp

changeset 86
4bec0525ef1b
parent 81
62373840e33a
child 87
93ec4d630346
equal deleted inserted replaced
85:40e2940605a3 86:4bec0525ef1b
17 17
18 QVariant ldraw::Edge::getProperty(Property property) const 18 QVariant ldraw::Edge::getProperty(Property property) const
19 { 19 {
20 switch (property) 20 switch (property)
21 { 21 {
22 case Property::Point0:
23 return QVariant::fromValue(point_1);
22 case Property::Point1: 24 case Property::Point1:
23 return QVariant::fromValue(point_1);
24 case Property::Point2:
25 return QVariant::fromValue(point_2); 25 return QVariant::fromValue(point_2);
26 default: 26 default:
27 return BaseClass::getProperty(property); 27 return BaseClass::getProperty(property);
28 } 28 }
29 } 29 }
30 30
31 auto ldraw::Edge::setProperty(Property property, const QVariant& value) 31 void ldraw::Edge::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair)
32 -> SetPropertyResult
33 { 32 {
34 switch (property) 33 LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point0, {this->point_1 = value;})
35 { 34 LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point1, {this->point_2 = value;})
36 case Property::Point1: 35 BaseClass::setProperty(result, pair);
37 point_1 = value.value<glm::vec3>();
38 return SetPropertyResult::Success;
39 case Property::Point2:
40 point_2 = value.value<glm::vec3>();
41 return SetPropertyResult::Success;
42 default:
43 return BaseClass::setProperty(property, value);
44 }
45 } 36 }
46 37
47 QString ldraw::Edge::textRepresentation() const 38 QString ldraw::Edge::textRepresentation() const
48 { 39 {
49 return utility::format("%1 %2", utility::vertexToStringParens(point_1), utility::vertexToStringParens(point_2)); 40 return utility::format("%1 %2", utility::vertexToStringParens(point_1), utility::vertexToStringParens(point_2));

mercurial