src/linetypes/subfilereference.cpp

changeset 14
20d2ed3af73d
parent 13
6e838748867b
child 18
918b6c0f8b5b
equal deleted inserted replaced
13:6e838748867b 14:20d2ed3af73d
1 #include "subfilereference.h"
2
3 linetypes::SubfileReference::SubfileReference(
4 const Vertex& position,
5 const Matrix3x3& transformation,
6 const QString& referenceName,
7 const Color color) :
8 ColoredObject{color},
9 position{position},
10 transformation{transformation},
11 referenceName{referenceName}
12 {
13 }
14
15 QVariant linetypes::SubfileReference::getProperty(Property property) const
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:
26 return ColoredObject::getProperty(property);
27 }
28 }
29
30 auto linetypes::SubfileReference::setProperty(
31 Property property,
32 const QVariant& value)
33 -> SetPropertyResult
34 {
35 switch (property)
36 {
37 case Property::Position:
38 this->position = value.value<Vertex>();
39 return SetPropertyResult::Success;
40 case Property::Transformation:
41 this->transformation = value.value<Matrix3x3>();
42 return SetPropertyResult::Success;
43 case Property::ReferenceName:
44 this->referenceName = value.toString();
45 return SetPropertyResult::Success;
46 default:
47 return ColoredObject::setProperty(property, value);
48 }
49 }
50
51 QString linetypes::SubfileReference::textRepresentation() const
52 {
53 return referenceName + " " + vertexToStringParens(this->position);
54 }

mercurial