src/linetypes/conditionaledge.cpp

Fri, 07 Feb 2020 02:02:16 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Fri, 07 Feb 2020 02:02:16 +0200
changeset 50
0f80a2e5e42b
parent 35
98906a94732f
child 77
028798a72591
permissions
-rw-r--r--

fix some warnings

#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 QVector<glm::vec3>& 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::ControlPoint1:
		return QVariant::fromValue(controlPoint_1);
	case Property::ControlPoint2:
		return QVariant::fromValue(controlPoint_2);
	default:
		return Edge::getProperty(property);
	}
}

auto ldraw::ConditionalEdge::setProperty(
	Property property,
	const QVariant& value)
	-> SetPropertyResult
{
	switch (property)
	{
	case Property::ControlPoint1:
		controlPoint_1 = value.value<glm::vec3>();
	case Property::ControlPoint2:
		controlPoint_2 = value.value<glm::vec3>();
	default:
		return Edge::setProperty(property, value);
	}
}

QString ldraw::ConditionalEdge::textRepresentation() const
{
	return Edge::textRepresentation() + utility::format("%1 %2",
		utility::vertexToStringParens(controlPoint_1),
		utility::vertexToStringParens(controlPoint_2));
}

mercurial