Thu, 19 Mar 2020 21:06:06 +0200
PolygonObjectEditor can now modify the object properly
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 | ||
77
028798a72591
added some meta stuff, simplified quadrilateral splitting and tested it
Teemu Piippo <teemu@hecknology.net>
parents:
35
diff
changeset
|
15 | ldraw::ConditionalEdge::ConditionalEdge(const std::array<glm::vec3, 4>& 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 | { | |
86
4bec0525ef1b
PolygonObjectEditor can now modify the object properly
Teemu Piippo <teemu@hecknology.net>
parents:
81
diff
changeset
|
26 | case Property::ControlPoint0: |
33
4c41bfe2ec6e
replaced matrix and vertex classes with glm
Teemu Piippo <teemu@hecknology.net>
parents:
18
diff
changeset
|
27 | return QVariant::fromValue(controlPoint_1); |
86
4bec0525ef1b
PolygonObjectEditor can now modify the object properly
Teemu Piippo <teemu@hecknology.net>
parents:
81
diff
changeset
|
28 | case Property::ControlPoint1: |
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 | ||
86
4bec0525ef1b
PolygonObjectEditor can now modify the object properly
Teemu Piippo <teemu@hecknology.net>
parents:
81
diff
changeset
|
35 | void ldraw::ConditionalEdge::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair) |
3 | 36 | { |
86
4bec0525ef1b
PolygonObjectEditor can now modify the object properly
Teemu Piippo <teemu@hecknology.net>
parents:
81
diff
changeset
|
37 | LDRAW_OBJECT_HANDLE_SET_PROPERTY(ControlPoint0, {this->controlPoint_1 = value;}) |
4bec0525ef1b
PolygonObjectEditor can now modify the object properly
Teemu Piippo <teemu@hecknology.net>
parents:
81
diff
changeset
|
38 | LDRAW_OBJECT_HANDLE_SET_PROPERTY(ControlPoint1, {this->controlPoint_2 = value;}) |
4bec0525ef1b
PolygonObjectEditor can now modify the object properly
Teemu Piippo <teemu@hecknology.net>
parents:
81
diff
changeset
|
39 | BaseClass::setProperty(result, pair); |
3 | 40 | } |
6 | 41 | |
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
42 | QString ldraw::ConditionalEdge::textRepresentation() const |
6 | 43 | { |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
44 | 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
|
45 | utility::vertexToStringParens(controlPoint_1), |
4c41bfe2ec6e
replaced matrix and vertex classes with glm
Teemu Piippo <teemu@hecknology.net>
parents:
18
diff
changeset
|
46 | utility::vertexToStringParens(controlPoint_2)); |
6 | 47 | } |
81
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
48 | |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
49 | int ldraw::ConditionalEdge::numPoints() const |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
50 | { |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
51 | return 4; |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
52 | } |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
53 | |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
54 | const glm::vec3& ldraw::ConditionalEdge::getPoint(int index) const |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
55 | { |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
56 | switch(index) |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
57 | { |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
58 | case 3: |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
59 | return this->controlPoint_1; |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
60 | case 4: |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
61 | return this->controlPoint_2; |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
62 | default: |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
63 | return ldraw::Edge::getPoint(index); |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
64 | } |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
65 | } |