Sun, 03 Nov 2019 12:56:42 +0200
added saving of splitter state and recent files
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 | ||
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
15 | modelobjects::ConditionalEdge::ConditionalEdge(const QVector<Vertex>& vertices, const Color color) : |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
16 | Edge{vertices[0], vertices[1], color}, |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
17 | controlPoint_1{vertices[2]}, |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
18 | controlPoint_2{vertices[3]} |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
19 | { |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
20 | } |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
21 | |
3 | 22 | QVariant modelobjects::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 modelobjects::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 | } | |
6 | 50 | |
51 | QString modelobjects::ConditionalEdge::textRepresentation() const | |
52 | { | |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
53 | return Edge::textRepresentation() + utility::format("%1 %2", |
6 | 54 | vertexToStringParens(controlPoint_1), |
55 | vertexToStringParens(controlPoint_2)); | |
56 | } |