src/linetypes/quadrilateral.cpp

changeset 33
4c41bfe2ec6e
parent 26
3a9e761e4faa
child 35
98906a94732f
--- a/src/linetypes/quadrilateral.cpp	Sun Jan 26 01:06:27 2020 +0200
+++ b/src/linetypes/quadrilateral.cpp	Sun Jan 26 14:29:30 2020 +0200
@@ -1,17 +1,17 @@
 #include "quadrilateral.h"
 
 linetypes::Quadrilateral::Quadrilateral(
-	const Point3D& point_1,
-	const Point3D& point_2,
-	const Point3D& point_3,
-	const Point3D& point_4,
+	const glm::vec3& point_1,
+	const glm::vec3& point_2,
+	const glm::vec3& point_3,
+	const glm::vec3& point_4,
 	Color color_index) :
 	ColoredObject{color_index},
 	points{point_1, point_2, point_3, point_4}
 {
 }
 
-linetypes::Quadrilateral::Quadrilateral(const QVector<Point3D>& vertices, const Color color) :
+linetypes::Quadrilateral::Quadrilateral(const QVector<glm::vec3>& vertices, const Color color) :
 	ColoredObject{color},
 	points{vertices[0], vertices[1], vertices[2], vertices[3]}
 {
@@ -22,13 +22,13 @@
 	switch (id)
 	{
 	case Property::Point1:
-		return points[0];
+		return QVariant::fromValue(points[0]);
 	case Property::Point2:
-		return points[1];
+		return QVariant::fromValue(points[1]);
 	case Property::Point3:
-		return points[2];
+		return QVariant::fromValue(points[2]);
 	case Property::Point4:
-		return points[3];
+		return QVariant::fromValue(points[3]);
 	default:
 		return ColoredObject::getProperty(id);
 	}
@@ -42,16 +42,16 @@
 	switch (id)
 	{
 	case Property::Point1:
-		points[0] = value.value<Point3D>();
+		points[0] = value.value<glm::vec3>();
 		return SetPropertyResult::Success;
 	case Property::Point2:
-		points[1] = value.value<Point3D>();
+		points[1] = value.value<glm::vec3>();
 		return SetPropertyResult::Success;
 	case Property::Point3:
-		points[2] = value.value<Point3D>();
+		points[2] = value.value<glm::vec3>();
 		return SetPropertyResult::Success;
 	case Property::Point4:
-		points[3] = value.value<Point3D>();
+		points[3] = value.value<glm::vec3>();
 		return SetPropertyResult::Success;
 	default:
 		return ColoredObject::setProperty(id, value);
@@ -61,10 +61,10 @@
 QString linetypes::Quadrilateral::textRepresentation() const
 {
 	return utility::format("%1 %2 %3 %4",
-		vertexToStringParens(points[0]),
-		vertexToStringParens(points[1]),
-		vertexToStringParens(points[2]),
-			vertexToStringParens(points[3]));
+		utility::vertexToStringParens(points[0]),
+		utility::vertexToStringParens(points[1]),
+		utility::vertexToStringParens(points[2]),
+		utility::vertexToStringParens(points[3]));
 }
 
 void linetypes::Quadrilateral::getPolygons(

mercurial