src/objecttypes/conditionaledge.cpp

changeset 14
20d2ed3af73d
parent 13
6e838748867b
child 15
9e18ec63eec3
equal deleted inserted replaced
13:6e838748867b 14:20d2ed3af73d
1 #include "conditionaledge.h"
2
3 linetypes::ConditionalEdge::ConditionalEdge(
4 const Vertex& point_1,
5 const Vertex& point_2,
6 const Vertex& controlPoint_1,
7 const Vertex& controlPoint_2,
8 const Color color_index) :
9 Edge{point_1, point_2, color_index},
10 controlPoint_1{controlPoint_1},
11 controlPoint_2{controlPoint_2}
12 {
13 }
14
15 linetypes::ConditionalEdge::ConditionalEdge(const QVector<Vertex>& vertices, const Color color) :
16 Edge{vertices[0], vertices[1], color},
17 controlPoint_1{vertices[2]},
18 controlPoint_2{vertices[3]}
19 {
20 }
21
22 QVariant linetypes::ConditionalEdge::getProperty(Property property) const
23 {
24 switch (property)
25 {
26 case Property::ControlPoint1:
27 return controlPoint_1;
28 case Property::ControlPoint2:
29 return controlPoint_2;
30 default:
31 return Edge::getProperty(property);
32 }
33 }
34
35 auto linetypes::ConditionalEdge::setProperty(
36 Property property,
37 const QVariant& value)
38 -> SetPropertyResult
39 {
40 switch (property)
41 {
42 case Property::ControlPoint1:
43 controlPoint_1 = value.value<Vertex>();
44 case Property::ControlPoint2:
45 controlPoint_2 = value.value<Vertex>();
46 default:
47 return Edge::setProperty(property, value);
48 }
49 }
50
51 QString linetypes::ConditionalEdge::textRepresentation() const
52 {
53 return Edge::textRepresentation() + utility::format("%1 %2",
54 vertexToStringParens(controlPoint_1),
55 vertexToStringParens(controlPoint_2));
56 }

mercurial