Sat, 05 Oct 2019 23:47:03 +0300
added the settings editor
3 | 1 | #include "conditionaledge.h" |
2 | ||
3 | modelobjects::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 | QVariant modelobjects::ConditionalEdge::getProperty(Property property) const | |
16 | { | |
17 | switch (property) | |
18 | { | |
19 | case Property::ControlPoint1: | |
20 | return controlPoint_1; | |
21 | case Property::ControlPoint2: | |
22 | return controlPoint_2; | |
23 | default: | |
24 | return Edge::getProperty(property); | |
25 | } | |
26 | } | |
27 | ||
28 | auto modelobjects::ConditionalEdge::setProperty( | |
29 | Property property, | |
30 | const QVariant& value) | |
31 | -> SetPropertyResult | |
32 | { | |
33 | switch (property) | |
34 | { | |
35 | case Property::ControlPoint1: | |
36 | controlPoint_1 = value.value<Vertex>(); | |
37 | case Property::ControlPoint2: | |
38 | controlPoint_2 = value.value<Vertex>(); | |
39 | default: | |
40 | return Edge::setProperty(property, value); | |
41 | } | |
42 | } | |
6 | 43 | |
44 | QString modelobjects::ConditionalEdge::textRepresentation() const | |
45 | { | |
46 | return Edge::textRepresentation() + format("%1 %2", | |
47 | vertexToStringParens(controlPoint_1), | |
48 | vertexToStringParens(controlPoint_2)); | |
49 | } |