Sat, 05 Oct 2019 23:47:03 +0300
added the settings editor
3 | 1 | #include "edge.h" |
2 | ||
3 | modelobjects::Edge::Edge( | |
4 | const Vertex& point_1, | |
5 | const Vertex& point_2, | |
6 | const Color color_index) : | |
7 | ColoredBaseObject{color_index}, | |
8 | point_1{point_1}, | |
9 | point_2{point_2} {} | |
10 | ||
11 | QVariant modelobjects::Edge::getProperty(Property property) const | |
12 | { | |
13 | switch (property) | |
14 | { | |
15 | case Property::Point1: | |
16 | return point_1; | |
17 | case Property::Point2: | |
18 | return point_2; | |
19 | default: | |
20 | return BaseClass::getProperty(property); | |
21 | } | |
22 | } | |
23 | ||
24 | auto modelobjects::Edge::setProperty(Property property, const QVariant& value) | |
25 | -> SetPropertyResult | |
26 | { | |
27 | switch (property) | |
28 | { | |
29 | case Property::Point1: | |
30 | point_1 = value.value<Vertex>(); | |
31 | return SetPropertyResult::Success; | |
32 | case Property::Point2: | |
33 | point_2 = value.value<Vertex>(); | |
34 | return SetPropertyResult::Success; | |
35 | default: | |
36 | return BaseClass::setProperty(property, value); | |
37 | } | |
38 | } | |
6 | 39 | |
40 | QString modelobjects::Edge::textRepresentation() const | |
41 | { | |
42 | return format("%1 %2", vertexToStringParens(point_1), vertexToStringParens(point_2)); | |
43 | } |