Sun, 03 Nov 2019 13:07:04 +0200
fixed translations being updated twice at the same time, that's bad
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 | ||
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
11 | modelobjects::Edge::Edge(const QVector<Vertex>& vertices, const Color color) : |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
12 | ColoredBaseObject{color}, |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
13 | point_1{vertices[0]}, |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
14 | point_2{vertices[1]} |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
15 | { |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
16 | } |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
17 | |
3 | 18 | QVariant modelobjects::Edge::getProperty(Property property) const |
19 | { | |
20 | switch (property) | |
21 | { | |
22 | case Property::Point1: | |
23 | return point_1; | |
24 | case Property::Point2: | |
25 | return point_2; | |
26 | default: | |
27 | return BaseClass::getProperty(property); | |
28 | } | |
29 | } | |
30 | ||
31 | auto modelobjects::Edge::setProperty(Property property, const QVariant& value) | |
32 | -> SetPropertyResult | |
33 | { | |
34 | switch (property) | |
35 | { | |
36 | case Property::Point1: | |
37 | point_1 = value.value<Vertex>(); | |
38 | return SetPropertyResult::Success; | |
39 | case Property::Point2: | |
40 | point_2 = value.value<Vertex>(); | |
41 | return SetPropertyResult::Success; | |
42 | default: | |
43 | return BaseClass::setProperty(property, value); | |
44 | } | |
45 | } | |
6 | 46 | |
47 | QString modelobjects::Edge::textRepresentation() const | |
48 | { | |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
49 | return utility::format("%1 %2", vertexToStringParens(point_1), vertexToStringParens(point_2)); |
6 | 50 | } |