1 #include "quadrilateral.h" |
1 #include "quadrilateral.h" |
2 |
2 |
3 linetypes::Quadrilateral::Quadrilateral( |
3 ldraw::Quadrilateral::Quadrilateral( |
4 const glm::vec3& point_1, |
4 const glm::vec3& point_1, |
5 const glm::vec3& point_2, |
5 const glm::vec3& point_2, |
6 const glm::vec3& point_3, |
6 const glm::vec3& point_3, |
7 const glm::vec3& point_4, |
7 const glm::vec3& point_4, |
8 Color color_index) : |
8 Color color_index) : |
9 ColoredObject{color_index}, |
9 ColoredObject{color_index}, |
10 points{point_1, point_2, point_3, point_4} |
10 points{point_1, point_2, point_3, point_4} |
11 { |
11 { |
12 } |
12 } |
13 |
13 |
14 linetypes::Quadrilateral::Quadrilateral(const QVector<glm::vec3>& vertices, const Color color) : |
14 ldraw::Quadrilateral::Quadrilateral(const QVector<glm::vec3>& vertices, const Color color) : |
15 ColoredObject{color}, |
15 ColoredObject{color}, |
16 points{vertices[0], vertices[1], vertices[2], vertices[3]} |
16 points{vertices[0], vertices[1], vertices[2], vertices[3]} |
17 { |
17 { |
18 } |
18 } |
19 |
19 |
20 QVariant linetypes::Quadrilateral::getProperty(const Property id) const |
20 QVariant ldraw::Quadrilateral::getProperty(const Property id) const |
21 { |
21 { |
22 switch (id) |
22 switch (id) |
23 { |
23 { |
24 case Property::Point1: |
24 case Property::Point1: |
25 return QVariant::fromValue(points[0]); |
25 return QVariant::fromValue(points[0]); |
56 default: |
56 default: |
57 return ColoredObject::setProperty(id, value); |
57 return ColoredObject::setProperty(id, value); |
58 } |
58 } |
59 } |
59 } |
60 |
60 |
61 QString linetypes::Quadrilateral::textRepresentation() const |
61 QString ldraw::Quadrilateral::textRepresentation() const |
62 { |
62 { |
63 return utility::format("%1 %2 %3 %4", |
63 return utility::format("%1 %2 %3 %4", |
64 utility::vertexToStringParens(points[0]), |
64 utility::vertexToStringParens(points[0]), |
65 utility::vertexToStringParens(points[1]), |
65 utility::vertexToStringParens(points[1]), |
66 utility::vertexToStringParens(points[2]), |
66 utility::vertexToStringParens(points[2]), |
67 utility::vertexToStringParens(points[3])); |
67 utility::vertexToStringParens(points[3])); |
68 } |
68 } |
69 |
69 |
70 void linetypes::Quadrilateral::getPolygons( |
70 void ldraw::Quadrilateral::getPolygons( |
71 std::vector<gl::Polygon>& polygons, |
71 std::vector<gl::Polygon>& polygons, |
72 GetPolygonsContext* context) const |
72 GetPolygonsContext* context) const |
73 { |
73 { |
74 Q_UNUSED(context) |
74 Q_UNUSED(context) |
75 polygons.push_back(gl::quadrilateral( |
75 polygons.push_back(gl::quadrilateral( |