Sat, 14 Dec 2019 23:00:01 +0200
fixed build
3 | 1 | #pragma once |
2 | #include <QPointF> | |
3 | #include <QString> | |
4 | #include <QStringView> | |
5 | #include "main.h" | |
6 | #include "colors.h" | |
7 | #include "vertex.h" | |
8 | ||
13 | 9 | namespace linetypes |
3 | 10 | { |
17 | 11 | struct Id { unsigned int value; }; |
3 | 12 | enum class Property; |
13 | 13 | class Object; |
14 | class ColoredObject; | |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
15 | class Empty; |
3 | 16 | } |
17 | ||
13 | 18 | /** |
19 | * @brief Different properties that can be queried with getProperty | |
20 | */ | |
21 | enum class linetypes::Property | |
3 | 22 | { |
13 | 23 | Color, // Color of the object |
24 | Text, // Text contained in a comment | |
25 | Point1, // First vertex in a polygon or edge line | |
26 | Point2, // Second vertex in a polygon or edge line | |
27 | Point3, // Third vertex in a polygon | |
28 | Point4, // Fourth vertex in a quadrilateral | |
29 | ControlPoint1, // First control point in a conditional edge line | |
30 | ControlPoint2, // Second control point in a conditional edge line | |
31 | Position, // Position of a subfile reference | |
32 | Transformation, // Transformation matrix of a subfile reference | |
33 | ReferenceName, // Subfile reference name | |
34 | IsInverted, // Whether or not the object has been inverted with BFC INVERTNEXT | |
35 | ErrorMessage // For error lines, why parsing failed | |
3 | 36 | }; |
37 | ||
13 | 38 | class linetypes::Object |
3 | 39 | { |
40 | public: | |
41 | enum class SetPropertyResult | |
42 | { | |
43 | Success = 0, | |
44 | PropertyNotHandled, | |
45 | InvalidValue | |
46 | }; | |
13 | 47 | Object(); |
48 | Object(const Object&) = delete; | |
49 | virtual ~Object(); | |
17 | 50 | const Id id; |
3 | 51 | //virtual void toString(QTextStream &out) = 0; |
52 | virtual bool hasColor() const; | |
53 | virtual QVariant getProperty(Property id) const; | |
54 | virtual SetPropertyResult setProperty(Property id, const QVariant& value); | |
6 | 55 | virtual QString textRepresentation() const = 0; |
56 | virtual QBrush textRepresentationForeground() const; | |
57 | virtual QBrush textRepresentationBackground() const; | |
58 | virtual QFont textRepresentationFont() const; | |
3 | 59 | }; |
60 | ||
13 | 61 | class linetypes::ColoredObject : public Object |
3 | 62 | { |
63 | public: | |
13 | 64 | ColoredObject(const Color colorIndex = colors::main); |
3 | 65 | bool hasColor() const override final; |
66 | QVariant getProperty(Property id) const override; | |
67 | SetPropertyResult setProperty(Property id, const QVariant& value) override; | |
68 | private: | |
13 | 69 | Color colorIndex = colors::main; |
3 | 70 | }; |
6 | 71 | |
13 | 72 | /** |
73 | * @brief Represents an empty line. | |
74 | */ | |
75 | class linetypes::Empty : public Object | |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
76 | { |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
77 | QString textRepresentation() const override; |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
78 | }; |