33 return new LD##T##Object (*this); \ |
33 return new LD##T##Object (*this); \ |
34 } \ |
34 } \ |
35 virtual void move (vertex vVector); \ |
35 virtual void move (vertex vVector); \ |
36 virtual void invert(); |
36 virtual void invert(); |
37 |
37 |
38 #define LDOBJ_NAME( N ) virtual str typeName() const override { return #N; } |
38 #define LDOBJ_NAME(N) virtual str typeName() const override { return #N; } |
39 #define LDOBJ_VERTICES( V ) virtual short vertices() const override { return V; } |
39 #define LDOBJ_VERTICES(V) virtual short vertices() const override { return V; } |
40 #define LDOBJ_SETCOLORED( V ) virtual bool isColored() const override { return V; } |
40 #define LDOBJ_SETCOLORED(V) virtual bool isColored() const override { return V; } |
41 #define LDOBJ_COLORED LDOBJ_SETCOLORED( true ) |
41 #define LDOBJ_COLORED LDOBJ_SETCOLORED (true) |
42 #define LDOBJ_UNCOLORED LDOBJ_SETCOLORED( false ) |
42 #define LDOBJ_UNCOLORED LDOBJ_SETCOLORED (false) |
43 |
43 |
44 #define LDOBJ_CUSTOM_SCEMANTIC virtual bool isScemantic() const override |
44 #define LDOBJ_CUSTOM_SCEMANTIC virtual bool isScemantic() const override |
45 #define LDOBJ_SCEMANTIC LDOBJ_CUSTOM_SCEMANTIC { return true; } |
45 #define LDOBJ_SCEMANTIC LDOBJ_CUSTOM_SCEMANTIC { return true; } |
46 #define LDOBJ_NON_SCEMANTIC LDOBJ_CUSTOM_SCEMANTIC { return false; } |
46 #define LDOBJ_NON_SCEMANTIC LDOBJ_CUSTOM_SCEMANTIC { return false; } |
47 |
47 |
48 #define LDOBJ_SETMATRIX(V) virtual bool hasMatrix() const override { return V; } |
48 #define LDOBJ_SETMATRIX(V) virtual bool hasMatrix() const override { return V; } |
49 #define LDOBJ_HAS_MATRIX LDOBJ_SETMATRIX( true ) |
49 #define LDOBJ_HAS_MATRIX LDOBJ_SETMATRIX (true) |
50 #define LDOBJ_NO_MATRIX LDOBJ_SETMATRIX( false ) |
50 #define LDOBJ_NO_MATRIX LDOBJ_SETMATRIX (false) |
51 |
51 |
52 class QListWidgetItem; |
52 class QListWidgetItem; |
53 class LDSubfileObject; |
53 class LDSubfileObject; |
54 class LDFile; |
54 class LDFile; |
55 |
55 |
64 class LDObject { |
64 class LDObject { |
65 PROPERTY (bool, hidden, setHidden) |
65 PROPERTY (bool, hidden, setHidden) |
66 PROPERTY (bool, selected, setSelected) |
66 PROPERTY (bool, selected, setSelected) |
67 PROPERTY (LDObject*, parent, setParent) |
67 PROPERTY (LDObject*, parent, setParent) |
68 PROPERTY (LDFile*, file, setFile) |
68 PROPERTY (LDFile*, file, setFile) |
69 READ_PROPERTY (qint32, id, setID) |
69 READ_PROPERTY (int32, id, setID) |
70 DECLARE_PROPERTY (short, color, setColor) |
70 DECLARE_PROPERTY (short, color, setColor) |
71 |
71 |
72 public: |
72 public: |
73 // Object type codes. Codes are sorted in order of significance. |
73 // Object type codes. Codes are sorted in order of significance. |
74 enum Type { |
74 enum Type { |
89 |
89 |
90 LDObject(); |
90 LDObject(); |
91 virtual ~LDObject(); |
91 virtual ~LDObject(); |
92 |
92 |
93 virtual LDObject* clone() {return 0;} // Creates a new LDObject identical to this one. |
93 virtual LDObject* clone() {return 0;} // Creates a new LDObject identical to this one. |
94 long getIndex () const; // Index (i.e. line number) of this object |
94 long getIndex() const; // Index (i.e. line number) of this object |
95 virtual LDObject::Type getType() const; // Type enumerator of this object |
95 virtual LDObject::Type getType() const; // Type enumerator of this object |
96 const vertex& getVertex (int i) const; // Get a vertex by index |
96 const vertex& getVertex (int i) const; // Get a vertex by index |
97 virtual bool hasMatrix() const; // Does this object have a matrix and position? (see LDMatrixObject) |
97 virtual bool hasMatrix() const; // Does this object have a matrix and position? (see LDMatrixObject) |
98 virtual void invert(); // Inverts this object (winding is reversed) |
98 virtual void invert(); // Inverts this object (winding is reversed) |
99 virtual bool isColored() const; // Is this object colored? |
99 virtual bool isColored() const; // Is this object colored? |