src/objecttypes/polygon.cpp

changeset 8
44679e468ba9
parent 6
73e448b2943d
child 13
6e838748867b
equal deleted inserted replaced
7:68443f5be176 8:44679e468ba9
5 const Vertex& point_2, 5 const Vertex& point_2,
6 const Vertex& point_3, 6 const Vertex& point_3,
7 Color color_index) : 7 Color color_index) :
8 ColoredBaseObject{color_index}, 8 ColoredBaseObject{color_index},
9 points{point_1, point_2, point_3} 9 points{point_1, point_2, point_3}
10 {
11 }
12
13 modelobjects::Triangle::Triangle(const QVector<Vertex>& vertices, const Color color) :
14 ColoredBaseObject{color},
15 points{vertices[0], vertices[1], vertices[2]}
10 { 16 {
11 } 17 }
12 18
13 QVariant modelobjects::Triangle::getProperty(const Property id) const 19 QVariant modelobjects::Triangle::getProperty(const Property id) const
14 { 20 {
44 } 50 }
45 } 51 }
46 52
47 QString modelobjects::Triangle::textRepresentation() const 53 QString modelobjects::Triangle::textRepresentation() const
48 { 54 {
49 return format("%1 %2 %3", 55 return utility::format("%1 %2 %3",
50 vertexToStringParens(points[0]), 56 vertexToStringParens(points[0]),
51 vertexToStringParens(points[1]), 57 vertexToStringParens(points[1]),
52 vertexToStringParens(points[2])); 58 vertexToStringParens(points[2]));
53 } 59 }
54 60
58 const Vertex& point_3, 64 const Vertex& point_3,
59 const Vertex& point_4, 65 const Vertex& point_4,
60 Color color_index) : 66 Color color_index) :
61 ColoredBaseObject{color_index}, 67 ColoredBaseObject{color_index},
62 points{point_1, point_2, point_3, point_4} 68 points{point_1, point_2, point_3, point_4}
69 {
70 }
71
72 modelobjects::Quadrilateral::Quadrilateral(const QVector<Vertex>& vertices, const Color color) :
73 ColoredBaseObject{color},
74 points{vertices[0], vertices[1], vertices[2], vertices[3]}
63 { 75 {
64 } 76 }
65 77
66 QVariant modelobjects::Quadrilateral::getProperty(const Property id) const 78 QVariant modelobjects::Quadrilateral::getProperty(const Property id) const
67 { 79 {
104 } 116 }
105 } 117 }
106 118
107 QString modelobjects::Quadrilateral::textRepresentation() const 119 QString modelobjects::Quadrilateral::textRepresentation() const
108 { 120 {
109 return format("%1 %2 %3 %4", 121 return utility::format("%1 %2 %3 %4",
110 vertexToStringParens(points[0]), 122 vertexToStringParens(points[0]),
111 vertexToStringParens(points[1]), 123 vertexToStringParens(points[1]),
112 vertexToStringParens(points[2]), 124 vertexToStringParens(points[2]),
113 vertexToStringParens(points[3])); 125 vertexToStringParens(points[3]));
114 } 126 }

mercurial