1 #include "conditionaledge.h" |
1 #include "conditionaledge.h" |
2 |
2 |
3 linetypes::ConditionalEdge::ConditionalEdge( |
3 linetypes::ConditionalEdge::ConditionalEdge( |
4 const Point3D& point_1, |
4 const glm::vec3& point_1, |
5 const Point3D& point_2, |
5 const glm::vec3& point_2, |
6 const Point3D& controlPoint_1, |
6 const glm::vec3& controlPoint_1, |
7 const Point3D& controlPoint_2, |
7 const glm::vec3& controlPoint_2, |
8 const Color color_index) : |
8 const Color color_index) : |
9 Edge{point_1, point_2, color_index}, |
9 Edge{point_1, point_2, color_index}, |
10 controlPoint_1{controlPoint_1}, |
10 controlPoint_1{controlPoint_1}, |
11 controlPoint_2{controlPoint_2} |
11 controlPoint_2{controlPoint_2} |
12 { |
12 { |
13 } |
13 } |
14 |
14 |
15 linetypes::ConditionalEdge::ConditionalEdge(const QVector<Point3D>& vertices, const Color color) : |
15 linetypes::ConditionalEdge::ConditionalEdge(const QVector<glm::vec3>& vertices, const Color color) : |
16 Edge{vertices[0], vertices[1], color}, |
16 Edge{vertices[0], vertices[1], color}, |
17 controlPoint_1{vertices[2]}, |
17 controlPoint_1{vertices[2]}, |
18 controlPoint_2{vertices[3]} |
18 controlPoint_2{vertices[3]} |
19 { |
19 { |
20 } |
20 } |
22 QVariant linetypes::ConditionalEdge::getProperty(Property property) const |
22 QVariant linetypes::ConditionalEdge::getProperty(Property property) const |
23 { |
23 { |
24 switch (property) |
24 switch (property) |
25 { |
25 { |
26 case Property::ControlPoint1: |
26 case Property::ControlPoint1: |
27 return controlPoint_1; |
27 return QVariant::fromValue(controlPoint_1); |
28 case Property::ControlPoint2: |
28 case Property::ControlPoint2: |
29 return controlPoint_2; |
29 return QVariant::fromValue(controlPoint_2); |
30 default: |
30 default: |
31 return Edge::getProperty(property); |
31 return Edge::getProperty(property); |
32 } |
32 } |
33 } |
33 } |
34 |
34 |
38 -> SetPropertyResult |
38 -> SetPropertyResult |
39 { |
39 { |
40 switch (property) |
40 switch (property) |
41 { |
41 { |
42 case Property::ControlPoint1: |
42 case Property::ControlPoint1: |
43 controlPoint_1 = value.value<Point3D>(); |
43 controlPoint_1 = value.value<glm::vec3>(); |
44 case Property::ControlPoint2: |
44 case Property::ControlPoint2: |
45 controlPoint_2 = value.value<Point3D>(); |
45 controlPoint_2 = value.value<glm::vec3>(); |
46 default: |
46 default: |
47 return Edge::setProperty(property, value); |
47 return Edge::setProperty(property, value); |
48 } |
48 } |
49 } |
49 } |
50 |
50 |
51 QString linetypes::ConditionalEdge::textRepresentation() const |
51 QString linetypes::ConditionalEdge::textRepresentation() const |
52 { |
52 { |
53 return Edge::textRepresentation() + utility::format("%1 %2", |
53 return Edge::textRepresentation() + utility::format("%1 %2", |
54 vertexToStringParens(controlPoint_1), |
54 utility::vertexToStringParens(controlPoint_1), |
55 vertexToStringParens(controlPoint_2)); |
55 utility::vertexToStringParens(controlPoint_2)); |
56 } |
56 } |