src/linetypes/object.h

changeset 21
0133e565e072
parent 17
a5111f4e6412
child 26
3a9e761e4faa
equal deleted inserted replaced
20:cef43609a374 21:0133e565e072
3 #include <QString> 3 #include <QString>
4 #include <QStringView> 4 #include <QStringView>
5 #include "main.h" 5 #include "main.h"
6 #include "colors.h" 6 #include "colors.h"
7 #include "vertex.h" 7 #include "vertex.h"
8 #include "gl/common.h"
8 9
9 namespace linetypes 10 namespace linetypes
10 { 11 {
11 struct Id { unsigned int value; }; 12 struct GetPolygonsContext;
12 enum class Property; 13 enum class Property;
13 class Object; 14 class Object;
14 class ColoredObject; 15 class ColoredObject;
15 class Empty; 16 class Empty;
16 } 17 }
18
19 class DocumentManager;
20
21 struct linetypes::GetPolygonsContext
22 {
23 ::DocumentManager* documents;
24 };
17 25
18 /** 26 /**
19 * @brief Different properties that can be queried with getProperty 27 * @brief Different properties that can be queried with getProperty
20 */ 28 */
21 enum class linetypes::Property 29 enum class linetypes::Property
26 Point2, // Second vertex in a polygon or edge line 34 Point2, // Second vertex in a polygon or edge line
27 Point3, // Third vertex in a polygon 35 Point3, // Third vertex in a polygon
28 Point4, // Fourth vertex in a quadrilateral 36 Point4, // Fourth vertex in a quadrilateral
29 ControlPoint1, // First control point in a conditional edge line 37 ControlPoint1, // First control point in a conditional edge line
30 ControlPoint2, // Second control point in a conditional edge line 38 ControlPoint2, // Second control point in a conditional edge line
31 Position, // Position of a subfile reference 39 Transformation, // 4x4 transformation matrix of a subfile reference
32 Transformation, // Transformation matrix of a subfile reference
33 ReferenceName, // Subfile reference name 40 ReferenceName, // Subfile reference name
34 IsInverted, // Whether or not the object has been inverted with BFC INVERTNEXT 41 IsInverted, // Whether or not the object has been inverted with BFC INVERTNEXT
35 ErrorMessage // For error lines, why parsing failed 42 ErrorMessage // For error lines, why parsing failed
36 }; 43 };
37 44
54 virtual SetPropertyResult setProperty(Property id, const QVariant& value); 61 virtual SetPropertyResult setProperty(Property id, const QVariant& value);
55 virtual QString textRepresentation() const = 0; 62 virtual QString textRepresentation() const = 0;
56 virtual QBrush textRepresentationForeground() const; 63 virtual QBrush textRepresentationForeground() const;
57 virtual QBrush textRepresentationBackground() const; 64 virtual QBrush textRepresentationBackground() const;
58 virtual QFont textRepresentationFont() const; 65 virtual QFont textRepresentationFont() const;
66 virtual void getPolygons(std::vector<gl::Polygon>& polygons, GetPolygonsContext* context) const;
59 }; 67 };
60 68
61 class linetypes::ColoredObject : public Object 69 class linetypes::ColoredObject : public Object
62 { 70 {
63 public: 71 public:
64 ColoredObject(const Color colorIndex = colors::main); 72 ColoredObject(const Color colorIndex = colors::main);
65 bool hasColor() const override final; 73 bool hasColor() const override final;
66 QVariant getProperty(Property id) const override; 74 QVariant getProperty(Property id) const override;
67 SetPropertyResult setProperty(Property id, const QVariant& value) override; 75 SetPropertyResult setProperty(Property id, const QVariant& value) override;
68 private: 76 protected:
69 Color colorIndex = colors::main; 77 Color colorIndex = colors::main;
70 }; 78 };
71 79
72 /** 80 /**
73 * @brief Represents an empty line. 81 * @brief Represents an empty line.

mercurial