src/linetypes/quadrilateral.cpp

changeset 87
93ec4d630346
parent 86
4bec0525ef1b
child 132
488d0ba6070b
--- a/src/linetypes/quadrilateral.cpp	Thu Mar 19 21:06:06 2020 +0200
+++ b/src/linetypes/quadrilateral.cpp	Wed Mar 25 16:07:20 2020 +0200
@@ -1,61 +1,12 @@
 #include "quadrilateral.h"
 
-ldraw::Quadrilateral::Quadrilateral
-(
-	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}
-{
-}
-
-ldraw::Quadrilateral::Quadrilateral
-(
-	const std::array<glm::vec3, 4>& vertices,
-	const Color color
-) :
-	ColoredObject{color},
-	points{vertices[0], vertices[1], vertices[2], vertices[3]}
-{
-}
-
-QVariant ldraw::Quadrilateral::getProperty(const Property id) const
-{
-	switch (id)
-	{
-	case Property::Point0:
-		return QVariant::fromValue(points[0]);
-	case Property::Point1:
-		return QVariant::fromValue(points[1]);
-	case Property::Point2:
-		return QVariant::fromValue(points[2]);
-	case Property::Point3:
-		return QVariant::fromValue(points[3]);
-	default:
-		return ColoredObject::getProperty(id);
-	}
-}
-
-void ldraw::Quadrilateral::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair)
-{
-	LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point0, {points[0] = value;})
-	LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point1, {points[1] = value;})
-	LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point2, {points[2] = value;})
-	LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point3, {points[3] = value;})
-	ColoredObject::setProperty(result, pair);
-}
-
 QString ldraw::Quadrilateral::textRepresentation() const
 {
 	return utility::format("%1 %2 %3 %4",
-		utility::vertexToStringParens(points[0]),
-		utility::vertexToStringParens(points[1]),
-		utility::vertexToStringParens(points[2]),
-		utility::vertexToStringParens(points[3]));
+		utility::vertexToStringParens(this->points[0]),
+		utility::vertexToStringParens(this->points[1]),
+		utility::vertexToStringParens(this->points[2]),
+		utility::vertexToStringParens(this->points[3]));
 }
 
 void ldraw::Quadrilateral::getPolygons(
@@ -69,7 +20,7 @@
 		this->points[2],
 		this->points[3],
 		this->colorIndex,
-			this->id));
+		this->id));
 }
 
 void ldraw::Quadrilateral::invert()
@@ -78,20 +29,3 @@
 	// -> 2 1 0 3
 	std::swap(this->points[0], this->points[2]);
 }
-
-int ldraw::Quadrilateral::numPoints() const
-{
-	return 4;
-}
-
-const glm::vec3& ldraw::Quadrilateral::getPoint(int index) const
-{
-	if (index >= 0 and index < 4)
-	{
-		return points[index];
-	}
-	else
-	{
-		return ldraw::ColoredObject::getPoint(index);
-	}
-}

mercurial