|
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 } |