src/objecttypes/edge.cpp

Thu, 03 Oct 2019 11:45:44 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 03 Oct 2019 11:45:44 +0300
changeset 5
593a658cba8e
parent 3
55a55a9ec2c2
child 6
73e448b2943d
permissions
-rw-r--r--

stuff

#include "edge.h"

modelobjects::Edge::Edge(
	const Vertex& point_1,
	const Vertex& point_2,
	const Color color_index) :
	ColoredBaseObject{color_index},
	point_1{point_1},
	point_2{point_2} {}

QVariant modelobjects::Edge::getProperty(Property property) const
{
	switch (property)
	{
	case Property::Point1:
		return point_1;
	case Property::Point2:
		return point_2;
	default:
		return BaseClass::getProperty(property);
	}
}

auto modelobjects::Edge::setProperty(Property property, const QVariant& value)
	-> SetPropertyResult
{
	switch (property)
	{
	case Property::Point1:
		point_1 = value.value<Vertex>();
		return SetPropertyResult::Success;
	case Property::Point2:
		point_2 = value.value<Vertex>();
		return SetPropertyResult::Success;
	default:
		return BaseClass::setProperty(property, value);
	}
}

mercurial