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