|
1 #pragma once |
|
2 #include <QPointF> |
|
3 #include <QString> |
|
4 #include <QStringView> |
|
5 #include "main.h" |
|
6 #include "colors.h" |
|
7 #include "uuid.h" |
|
8 #include "vertex.h" |
|
9 |
|
10 namespace modelobjects |
|
11 { |
|
12 enum class Property; |
|
13 class BaseObject; |
|
14 class ColoredBaseObject; |
|
15 } |
|
16 |
|
17 enum class modelobjects::Property |
|
18 { |
|
19 Color, |
|
20 Text, |
|
21 Point1, |
|
22 Point2, |
|
23 Point3, |
|
24 Point4, |
|
25 ControlPoint1, |
|
26 ControlPoint2, |
|
27 Position, |
|
28 Transformation, |
|
29 ReferenceName, |
|
30 IsInverted, |
|
31 }; |
|
32 |
|
33 class modelobjects::BaseObject |
|
34 { |
|
35 public: |
|
36 enum class SetPropertyResult |
|
37 { |
|
38 Success = 0, |
|
39 PropertyNotHandled, |
|
40 InvalidValue |
|
41 }; |
|
42 BaseObject(); |
|
43 BaseObject(const BaseObject&) = delete; |
|
44 virtual ~BaseObject(); |
|
45 const Uuid id; |
|
46 //virtual void toString(QTextStream &out) = 0; |
|
47 virtual bool hasColor() const; |
|
48 virtual QVariant getProperty(Property id) const; |
|
49 virtual SetPropertyResult setProperty(Property id, const QVariant& value); |
|
50 }; |
|
51 |
|
52 class modelobjects::ColoredBaseObject : public BaseObject |
|
53 { |
|
54 public: |
|
55 ColoredBaseObject(const Color color_index = colors::main); |
|
56 bool hasColor() const override final; |
|
57 QVariant getProperty(Property id) const override; |
|
58 SetPropertyResult setProperty(Property id, const QVariant& value) override; |
|
59 private: |
|
60 Color color_index = colors::main; |
|
61 }; |