Sun, 03 Nov 2019 18:09:47 +0200
renamings
3 | 1 | #include "subfilereference.h" |
2 | ||
13 | 3 | linetypes::SubfileReference::SubfileReference( |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
4 | const Vertex& position, |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
5 | const Matrix3x3& transformation, |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
6 | const QString& referenceName, |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
7 | const Color color) : |
13 | 8 | ColoredObject{color}, |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
9 | position{position}, |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
10 | transformation{transformation}, |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
11 | referenceName{referenceName} |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
12 | { |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
13 | } |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
14 | |
13 | 15 | QVariant linetypes::SubfileReference::getProperty(Property property) const |
3 | 16 | { |
17 | switch (property) | |
18 | { | |
19 | case Property::Position: | |
20 | return this->position; | |
21 | case Property::Transformation: | |
22 | return QVariant::fromValue(this->transformation); | |
23 | case Property::ReferenceName: | |
24 | return this->referenceName; | |
25 | default: | |
13 | 26 | return ColoredObject::getProperty(property); |
3 | 27 | } |
28 | } | |
6 | 29 | |
13 | 30 | auto linetypes::SubfileReference::setProperty( |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
31 | Property property, |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
32 | const QVariant& value) |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
33 | -> SetPropertyResult |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
34 | { |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
35 | switch (property) |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
36 | { |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
37 | case Property::Position: |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
38 | this->position = value.value<Vertex>(); |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
39 | return SetPropertyResult::Success; |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
40 | case Property::Transformation: |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
41 | this->transformation = value.value<Matrix3x3>(); |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
42 | return SetPropertyResult::Success; |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
43 | case Property::ReferenceName: |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
44 | this->referenceName = value.toString(); |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
45 | return SetPropertyResult::Success; |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
46 | default: |
13 | 47 | return ColoredObject::setProperty(property, value); |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
48 | } |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
49 | } |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
50 | |
13 | 51 | QString linetypes::SubfileReference::textRepresentation() const |
6 | 52 | { |
53 | return referenceName + " " + vertexToStringParens(this->position); | |
54 | } |