src/linetypes/conditionaledge.cpp

changeset 87
93ec4d630346
parent 86
4bec0525ef1b
child 132
488d0ba6070b
--- a/src/linetypes/conditionaledge.cpp	Thu Mar 19 21:06:06 2020 +0200
+++ b/src/linetypes/conditionaledge.cpp	Wed Mar 25 16:07:20 2020 +0200
@@ -1,65 +1,10 @@
 #include "conditionaledge.h"
 
-ldraw::ConditionalEdge::ConditionalEdge(
-	const glm::vec3& point_1,
-	const glm::vec3& point_2,
-	const glm::vec3& controlPoint_1,
-	const glm::vec3& controlPoint_2,
-	const Color color_index) :
-	Edge{point_1, point_2, color_index},
-	controlPoint_1{controlPoint_1},
-	controlPoint_2{controlPoint_2}
-{
-}
-
-ldraw::ConditionalEdge::ConditionalEdge(const std::array<glm::vec3, 4>& vertices, const Color color) :
-	Edge{vertices[0], vertices[1], color},
-	controlPoint_1{vertices[2]},
-	controlPoint_2{vertices[3]}
-{
-}
-
-QVariant ldraw::ConditionalEdge::getProperty(Property property) const
-{
-	switch (property)
-	{
-	case Property::ControlPoint0:
-		return QVariant::fromValue(controlPoint_1);
-	case Property::ControlPoint1:
-		return QVariant::fromValue(controlPoint_2);
-	default:
-		return Edge::getProperty(property);
-	}
-}
-
-void ldraw::ConditionalEdge::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair)
-{
-	LDRAW_OBJECT_HANDLE_SET_PROPERTY(ControlPoint0, {this->controlPoint_1 = value;})
-	LDRAW_OBJECT_HANDLE_SET_PROPERTY(ControlPoint1, {this->controlPoint_2 = value;})
-	BaseClass::setProperty(result, pair);
-}
-
 QString ldraw::ConditionalEdge::textRepresentation() const
 {
-	return Edge::textRepresentation() + utility::format("%1 %2",
-		utility::vertexToStringParens(controlPoint_1),
-		utility::vertexToStringParens(controlPoint_2));
-}
-
-int ldraw::ConditionalEdge::numPoints() const
-{
-	return 4;
+	return utility::format("%1 %2 %3 %4",
+		utility::vertexToStringParens(this->points[0]),
+		utility::vertexToStringParens(this->points[1]),
+		utility::vertexToStringParens(this->points[2]),
+		utility::vertexToStringParens(this->points[3]));
 }
-
-const glm::vec3& ldraw::ConditionalEdge::getPoint(int index) const
-{
-	switch(index)
-	{
-	case 3:
-		return this->controlPoint_1;
-	case 4:
-		return this->controlPoint_2;
-	default:
-		return ldraw::Edge::getPoint(index);
-	}
-}

mercurial