Wed, 22 Jan 2020 22:41:17 +0200
modelview matrix set up
3 | 1 | #include "conditionaledge.h" |
2 | ||
13 | 3 | linetypes::ConditionalEdge::ConditionalEdge( |
18 | 4 | const Point3D& point_1, |
5 | const Point3D& point_2, | |
6 | const Point3D& controlPoint_1, | |
7 | const Point3D& controlPoint_2, | |
3 | 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 | ||
18 | 15 | linetypes::ConditionalEdge::ConditionalEdge(const QVector<Point3D>& vertices, const Color color) : |
8
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 | |
13 | 22 | QVariant linetypes::ConditionalEdge::getProperty(Property property) const |
3 | 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 | ||
13 | 35 | auto linetypes::ConditionalEdge::setProperty( |
3 | 36 | Property property, |
37 | const QVariant& value) | |
38 | -> SetPropertyResult | |
39 | { | |
40 | switch (property) | |
41 | { | |
42 | case Property::ControlPoint1: | |
18 | 43 | controlPoint_1 = value.value<Point3D>(); |
3 | 44 | case Property::ControlPoint2: |
18 | 45 | controlPoint_2 = value.value<Point3D>(); |
3 | 46 | default: |
47 | return Edge::setProperty(property, value); | |
48 | } | |
49 | } | |
6 | 50 | |
13 | 51 | QString linetypes::ConditionalEdge::textRepresentation() const |
6 | 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 | } |