src/linetypes/triangle.cpp

changeset 86
4bec0525ef1b
parent 81
62373840e33a
child 87
93ec4d630346
equal deleted inserted replaced
85:40e2940605a3 86:4bec0525ef1b
24 24
25 QVariant ldraw::Triangle::getProperty(const Property id) const 25 QVariant ldraw::Triangle::getProperty(const Property id) const
26 { 26 {
27 switch (id) 27 switch (id)
28 { 28 {
29 case Property::Point0:
30 return QVariant::fromValue(points[0]);
29 case Property::Point1: 31 case Property::Point1:
30 return QVariant::fromValue(points[0]); 32 return QVariant::fromValue(points[1]);
31 case Property::Point2: 33 case Property::Point2:
32 return QVariant::fromValue(points[1]);
33 case Property::Point3:
34 return QVariant::fromValue(points[2]); 34 return QVariant::fromValue(points[2]);
35 default: 35 default:
36 return ColoredObject::getProperty(id); 36 return ColoredObject::getProperty(id);
37 } 37 }
38 } 38 }
39 39
40 auto ldraw::Triangle::setProperty(Property id, const QVariant& value) 40 void ldraw::Triangle::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair)
41 -> SetPropertyResult
42 { 41 {
43 switch (id) 42 LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point0, {points[0] = value;})
44 { 43 LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point1, {points[1] = value;})
45 case Property::Point1: 44 LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point2, {points[2] = value;})
46 points[0] = value.value<glm::vec3>(); 45 ColoredObject::setProperty(result, pair);
47 return SetPropertyResult::Success;
48 case Property::Point2:
49 points[1] = value.value<glm::vec3>();
50 return SetPropertyResult::Success;
51 case Property::Point3:
52 points[2] = value.value<glm::vec3>();
53 return SetPropertyResult::Success;
54 default:
55 return ColoredObject::setProperty(id, value);
56 }
57 } 46 }
58 47
59 QString ldraw::Triangle::textRepresentation() const 48 QString ldraw::Triangle::textRepresentation() const
60 { 49 {
61 return utility::format("%1 %2 %3", 50 return utility::format("%1 %2 %3",

mercurial