Thu, 05 Mar 2020 15:58:35 +0200
grid autorotation
3 | 1 | #include "conditionaledge.h" |
2 | ||
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
3 | ldraw::ConditionalEdge::ConditionalEdge( |
33
4c41bfe2ec6e
replaced matrix and vertex classes with glm
Teemu Piippo <teemu@hecknology.net>
parents:
18
diff
changeset
|
4 | const glm::vec3& point_1, |
4c41bfe2ec6e
replaced matrix and vertex classes with glm
Teemu Piippo <teemu@hecknology.net>
parents:
18
diff
changeset
|
5 | const glm::vec3& point_2, |
4c41bfe2ec6e
replaced matrix and vertex classes with glm
Teemu Piippo <teemu@hecknology.net>
parents:
18
diff
changeset
|
6 | const glm::vec3& controlPoint_1, |
4c41bfe2ec6e
replaced matrix and vertex classes with glm
Teemu Piippo <teemu@hecknology.net>
parents:
18
diff
changeset
|
7 | const glm::vec3& 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 | ||
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
15 | ldraw::ConditionalEdge::ConditionalEdge(const QVector<glm::vec3>& 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 | |
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
22 | QVariant ldraw::ConditionalEdge::getProperty(Property property) const |
3 | 23 | { |
24 | switch (property) | |
25 | { | |
26 | case Property::ControlPoint1: | |
33
4c41bfe2ec6e
replaced matrix and vertex classes with glm
Teemu Piippo <teemu@hecknology.net>
parents:
18
diff
changeset
|
27 | return QVariant::fromValue(controlPoint_1); |
3 | 28 | case Property::ControlPoint2: |
33
4c41bfe2ec6e
replaced matrix and vertex classes with glm
Teemu Piippo <teemu@hecknology.net>
parents:
18
diff
changeset
|
29 | return QVariant::fromValue(controlPoint_2); |
3 | 30 | default: |
31 | return Edge::getProperty(property); | |
32 | } | |
33 | } | |
34 | ||
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
35 | auto ldraw::ConditionalEdge::setProperty( |
3 | 36 | Property property, |
37 | const QVariant& value) | |
38 | -> SetPropertyResult | |
39 | { | |
40 | switch (property) | |
41 | { | |
42 | case Property::ControlPoint1: | |
33
4c41bfe2ec6e
replaced matrix and vertex classes with glm
Teemu Piippo <teemu@hecknology.net>
parents:
18
diff
changeset
|
43 | controlPoint_1 = value.value<glm::vec3>(); |
3 | 44 | case Property::ControlPoint2: |
33
4c41bfe2ec6e
replaced matrix and vertex classes with glm
Teemu Piippo <teemu@hecknology.net>
parents:
18
diff
changeset
|
45 | controlPoint_2 = value.value<glm::vec3>(); |
3 | 46 | default: |
47 | return Edge::setProperty(property, value); | |
48 | } | |
49 | } | |
6 | 50 | |
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
51 | QString ldraw::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", |
33
4c41bfe2ec6e
replaced matrix and vertex classes with glm
Teemu Piippo <teemu@hecknology.net>
parents:
18
diff
changeset
|
54 | utility::vertexToStringParens(controlPoint_1), |
4c41bfe2ec6e
replaced matrix and vertex classes with glm
Teemu Piippo <teemu@hecknology.net>
parents:
18
diff
changeset
|
55 | utility::vertexToStringParens(controlPoint_2)); |
6 | 56 | } |