src/objecttypes/edge.cpp

changeset 3
55a55a9ec2c2
child 6
73e448b2943d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/objecttypes/edge.cpp	Sun Sep 22 11:51:41 2019 +0300
@@ -0,0 +1,38 @@
+#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