4 #include <QStringView> |
4 #include <QStringView> |
5 #include "main.h" |
5 #include "main.h" |
6 #include "colors.h" |
6 #include "colors.h" |
7 #include "gl/common.h" |
7 #include "gl/common.h" |
8 |
8 |
9 namespace linetypes |
9 namespace ldraw |
10 { |
10 { |
11 struct GetPolygonsContext; |
11 struct GetPolygonsContext; |
12 enum class Property; |
12 enum class Property; |
13 class Object; |
13 class Object; |
14 class ColoredObject; |
14 class ColoredObject; |
15 class Empty; |
15 class Empty; |
16 } |
16 } |
17 |
17 |
18 class DocumentManager; |
18 class DocumentManager; |
19 |
19 |
20 struct linetypes::GetPolygonsContext |
20 struct ldraw::GetPolygonsContext |
21 { |
21 { |
22 ::DocumentManager* documents; |
22 ::DocumentManager* documents; |
23 }; |
23 }; |
24 |
24 |
25 /** |
25 /** |
26 * @brief Different properties that can be queried with getProperty |
26 * @brief Different properties that can be queried with getProperty |
27 */ |
27 */ |
28 enum class linetypes::Property |
28 enum class ldraw::Property |
29 { |
29 { |
30 Color, // Color of the object |
30 Color, // Color of the object |
31 Text, // Text contained in a comment |
31 Text, // Text contained in a comment |
32 Point1, // First vertex in a polygon or edge line |
32 Point1, // First vertex in a polygon or edge line |
33 Point2, // Second vertex in a polygon or edge line |
33 Point2, // Second vertex in a polygon or edge line |
39 ReferenceName, // Subfile reference name |
39 ReferenceName, // Subfile reference name |
40 IsInverted, // Whether or not the object has been inverted with BFC INVERTNEXT |
40 IsInverted, // Whether or not the object has been inverted with BFC INVERTNEXT |
41 ErrorMessage // For error lines, why parsing failed |
41 ErrorMessage // For error lines, why parsing failed |
42 }; |
42 }; |
43 |
43 |
44 class linetypes::Object |
44 class ldraw::Object |
45 { |
45 { |
46 public: |
46 public: |
47 enum class SetPropertyResult |
47 enum class SetPropertyResult |
48 { |
48 { |
49 Success = 0, |
49 Success = 0, |
64 virtual QFont textRepresentationFont() const; |
64 virtual QFont textRepresentationFont() const; |
65 virtual void getPolygons(std::vector<gl::Polygon>& polygons, GetPolygonsContext* context) const; |
65 virtual void getPolygons(std::vector<gl::Polygon>& polygons, GetPolygonsContext* context) const; |
66 virtual void invert() {} |
66 virtual void invert() {} |
67 }; |
67 }; |
68 |
68 |
69 class linetypes::ColoredObject : public Object |
69 class ldraw::ColoredObject : public Object |
70 { |
70 { |
71 public: |
71 public: |
72 ColoredObject(const Color colorIndex = colors::main); |
72 ColoredObject(const Color colorIndex = ldraw::mainColor); |
73 bool hasColor() const override final; |
73 bool hasColor() const override final; |
74 QVariant getProperty(Property id) const override; |
74 QVariant getProperty(Property id) const override; |
75 SetPropertyResult setProperty(Property id, const QVariant& value) override; |
75 SetPropertyResult setProperty(Property id, const QVariant& value) override; |
76 protected: |
76 protected: |
77 Color colorIndex = colors::main; |
77 Color colorIndex = ldraw::mainColor; |
78 }; |
78 }; |
79 |
79 |
80 /** |
80 /** |
81 * @brief Represents an empty line. |
81 * @brief Represents an empty line. |
82 */ |
82 */ |
83 class linetypes::Empty : public Object |
83 class ldraw::Empty : public Object |
84 { |
84 { |
85 QString textRepresentation() const override; |
85 QString textRepresentation() const override; |
86 }; |
86 }; |