src/linetypes/subfilereference.cpp

changeset 86
4bec0525ef1b
parent 81
62373840e33a
child 132
488d0ba6070b
--- a/src/linetypes/subfilereference.cpp	Wed Mar 18 17:11:23 2020 +0200
+++ b/src/linetypes/subfilereference.cpp	Thu Mar 19 21:06:06 2020 +0200
@@ -2,9 +2,12 @@
 #include "documentmanager.h"
 #include "invert.h"
 
-ldraw::SubfileReference::SubfileReference(const glm::mat4& transformation,
+ldraw::SubfileReference::SubfileReference
+(
+	const glm::mat4& transformation,
 	const QString& referenceName,
-	const Color color) :
+	const Color color
+) :
 	ColoredObject{color},
 	transformation{transformation},
 	referenceName{referenceName}
@@ -24,22 +27,11 @@
 	}
 }
 
-auto ldraw::SubfileReference::setProperty(
-	Property property,
-	const QVariant& value)
-	-> SetPropertyResult
+void ldraw::SubfileReference::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair)
 {
-	switch (property)
-	{
-	case Property::Transformation:
-		this->transformation = value.value<glm::mat4>();
-		return SetPropertyResult::Success;
-	case Property::ReferenceName:
-		this->referenceName = value.toString();
-		return SetPropertyResult::Success;
-	default:
-		return ColoredObject::setProperty(property, value);
-	}
+	LDRAW_OBJECT_HANDLE_SET_PROPERTY(Transformation, {this->transformation = value;});
+	LDRAW_OBJECT_HANDLE_SET_PROPERTY(ReferenceName, {this->referenceName = value;});
+	ldraw::ColoredObject::setProperty(result, pair);
 }
 
 QString ldraw::SubfileReference::textRepresentation() const
@@ -47,9 +39,11 @@
 	return referenceName + " " + utility::vertexToStringParens(this->position());
 }
 
-void ldraw::SubfileReference::getPolygons(
+void ldraw::SubfileReference::getPolygons
+(
 	std::vector<gl::Polygon>& polygons,
-	GetPolygonsContext* context) const
+	GetPolygonsContext* context
+) const
 {
 	Model* model = this->resolve(context->documents);
 	if (model != nullptr)

mercurial