src/linetypes/edge.cpp

changeset 35
98906a94732f
parent 33
4c41bfe2ec6e
child 77
028798a72591
equal deleted inserted replaced
34:1de2b8d64e9f 35:98906a94732f
1 #include "edge.h" 1 #include "edge.h"
2 2
3 linetypes::Edge::Edge( 3 ldraw::Edge::Edge(
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 Color color_index) : 6 const Color color_index) :
7 ColoredObject{color_index}, 7 ColoredObject{color_index},
8 point_1{point_1}, 8 point_1{point_1},
9 point_2{point_2} {} 9 point_2{point_2} {}
10 10
11 linetypes::Edge::Edge(const QVector<glm::vec3>& vertices, const Color color) : 11 ldraw::Edge::Edge(const QVector<glm::vec3>& vertices, const Color color) :
12 ColoredObject{color}, 12 ColoredObject{color},
13 point_1{vertices[0]}, 13 point_1{vertices[0]},
14 point_2{vertices[1]} 14 point_2{vertices[1]}
15 { 15 {
16 } 16 }
17 17
18 QVariant linetypes::Edge::getProperty(Property property) const 18 QVariant ldraw::Edge::getProperty(Property property) const
19 { 19 {
20 switch (property) 20 switch (property)
21 { 21 {
22 case Property::Point1: 22 case Property::Point1:
23 return QVariant::fromValue(point_1); 23 return QVariant::fromValue(point_1);
26 default: 26 default:
27 return BaseClass::getProperty(property); 27 return BaseClass::getProperty(property);
28 } 28 }
29 } 29 }
30 30
31 auto linetypes::Edge::setProperty(Property property, const QVariant& value) 31 auto ldraw::Edge::setProperty(Property property, const QVariant& value)
32 -> SetPropertyResult 32 -> SetPropertyResult
33 { 33 {
34 switch (property) 34 switch (property)
35 { 35 {
36 case Property::Point1: 36 case Property::Point1:
42 default: 42 default:
43 return BaseClass::setProperty(property, value); 43 return BaseClass::setProperty(property, value);
44 } 44 }
45 } 45 }
46 46
47 QString linetypes::Edge::textRepresentation() const 47 QString ldraw::Edge::textRepresentation() const
48 { 48 {
49 return utility::format("%1 %2", utility::vertexToStringParens(point_1), utility::vertexToStringParens(point_2)); 49 return utility::format("%1 %2", utility::vertexToStringParens(point_1), utility::vertexToStringParens(point_2));
50 } 50 }
51 51
52 void linetypes::Edge::getPolygons( 52 void ldraw::Edge::getPolygons(
53 std::vector<gl::Polygon>& polygons, 53 std::vector<gl::Polygon>& polygons,
54 GetPolygonsContext* context) const 54 GetPolygonsContext* context) const
55 { 55 {
56 Q_UNUSED(context) 56 Q_UNUSED(context)
57 polygons.push_back(gl::edgeLine(this->point_1, this->point_2, this->colorIndex, this->id)); 57 polygons.push_back(gl::edgeLine(this->point_1, this->point_2, this->colorIndex, this->id));

mercurial