src/ldObject.h

Sat, 06 Jan 2018 17:57:03 +0200

author
Santeri Piippo
date
Sat, 06 Jan 2018 17:57:03 +0200
changeset 1225
ffcbdce88978
parent 1222
34def2630300
permissions
-rw-r--r--

simplify

655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
1222
34def2630300 happy new year 2018
Santeri Piippo
parents: 1217
diff changeset
3 * Copyright (C) 2013 - 2018 Teemu Piippo
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #pragma once
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 767
diff changeset
20 #include <type_traits>
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include "main.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include "basics.h"
706
d79083b9f74d Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
23 #include "glShared.h"
795
195fa1fff9c3 - changed all color usage to use LDColor classes instead of color indices. Added support for direct colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
24 #include "colors.h"
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 767
diff changeset
26 #define LDOBJ(T) \
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 767
diff changeset
27 public: \
860
a496e72af069 - more refactor, updated .hgignore
Teemu Piippo <crimsondusk64@gmail.com>
parents: 855
diff changeset
28 static constexpr LDObjectType SubclassType = OBJ_##T; \
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
29 LD##T(LDDocument* document = nullptr); \
860
a496e72af069 - more refactor, updated .hgignore
Teemu Piippo <crimsondusk64@gmail.com>
parents: 855
diff changeset
30 \
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 785
diff changeset
31 virtual LDObjectType type() const override \
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 767
diff changeset
32 { \
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 785
diff changeset
33 return OBJ_##T; \
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 767
diff changeset
34 } \
860
a496e72af069 - more refactor, updated .hgignore
Teemu Piippo <crimsondusk64@gmail.com>
parents: 855
diff changeset
35 \
855
e16f1587ef44 - fixed compilation on windows systems
Santeri Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
36 virtual QString asText() const override; \
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 767
diff changeset
37 virtual void invert() override; \
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 787
diff changeset
39 #define LDOBJ_NAME(N) public: virtual QString typeName() const override { return #N; }
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 767
diff changeset
40 #define LDOBJ_VERTICES(V) public: virtual int numVertices() const override { return V; }
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 767
diff changeset
41 #define LDOBJ_SETCOLORED(V) public: virtual bool isColored() const override { return V; }
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
42 #define LDOBJ_COLORED LDOBJ_SETCOLORED(true)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
43 #define LDOBJ_UNCOLORED LDOBJ_SETCOLORED(false) LDOBJ_DEFAULTCOLOR(MainColor)
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
44 #define LDOBJ_DEFAULTCOLOR(V) public: virtual LDColor defaultColor() const override { return (V); }
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 767
diff changeset
46 #define LDOBJ_CUSTOM_SCEMANTIC public: virtual bool isScemantic() const override
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 #define LDOBJ_SCEMANTIC LDOBJ_CUSTOM_SCEMANTIC { return true; }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 #define LDOBJ_NON_SCEMANTIC LDOBJ_CUSTOM_SCEMANTIC { return false; }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 767
diff changeset
50 #define LDOBJ_SETMATRIX(V) public: virtual bool hasMatrix() const override { return V; }
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
51 #define LDOBJ_HAS_MATRIX LDOBJ_SETMATRIX(true)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
52 #define LDOBJ_NO_MATRIX LDOBJ_SETMATRIX(false)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 class QListWidgetItem;
1011
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
55 class LDSubfileReference;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 class LDDocument;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
58 class LDBfc;
776
624131d0163d - selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents: 771
diff changeset
59
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
60 //
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 785
diff changeset
61 // Object type codes.
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
62 //
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 785
diff changeset
63 enum LDObjectType
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 785
diff changeset
64 {
1011
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
65 OBJ_SubfileReference, // Object represents a sub-file reference
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
66 OBJ_Quad, // Object represents a quadrilateral
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
67 OBJ_Triangle, // Object represents a triangle
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
68 OBJ_Line, // Object represents a line
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
69 OBJ_CondLine, // Object represents a conditional line
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
70 OBJ_Bfc, // Object represents a BFC statement
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
71 OBJ_Overlay, // Object contains meta-info about an overlay image.
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
72 OBJ_Comment, // Object represents a comment
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
73 OBJ_Error, // Object is the result of failed parsing
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
74 OBJ_Empty, // Object represents an empty line
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
75 OBJ_BezierCurve, // Object represents a Bézier curve
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 785
diff changeset
76
1011
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
77 OBJ_NumTypes, // Amount of object types
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
78 OBJ_FirstType = OBJ_SubfileReference
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 785
diff changeset
79 };
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 785
diff changeset
80
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
81 MAKE_ITERABLE_ENUM(LDObjectType)
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
82
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
83 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 // LDObject
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 //
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86 // Base class object for all object types. Each LDObject represents a single line
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87 // in the LDraw code file. The virtual method getType returns an enumerator
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88 // which is a token of the object's type. The object can be casted into
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 // sub-classes based on this enumerator.
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
90 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 class LDObject
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92 {
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 785
diff changeset
93 public:
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
94 LDObject(LDDocument* document = nullptr);
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 785
diff changeset
95
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
96 virtual QString asText() const = 0; // This object as LDraw code
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
97 LDColor color() const;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
98 LDObject* createCopy() const;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
99 virtual LDColor defaultColor() const = 0; // What color does the object default to?
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
100 void deselect();
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
101 void destroy();
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
102 LDDocument* document() const;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
103 LDPolygon* getPolygon();
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
104 virtual void getVertices(QVector<Vertex>& verts) const;
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
105 virtual bool hasMatrix() const = 0; // Does this object have a matrix and position?(see LDMatrixObject)
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
106 qint32 id() const;
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
107 virtual void invert() = 0; // Inverts this object(winding is reversed)
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
108 virtual bool isColored() const = 0;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
109 bool isDestroyed() const;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
110 bool isHidden() const;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
111 virtual bool isScemantic() const = 0; // Does this object have meaning in the part model?
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
112 bool isSelected() const;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
113 int lineNumber() const;
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
114 void move(Vertex vect);
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
115 LDObject* next() const;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
116 virtual int numVertices() const = 0;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
117 LDObject* previous() const;
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
118 bool previousIsInvertnext(LDBfc*& ptr);
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
119 QColor randomColor() const;
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
120 void replace(LDObject* other);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
121 void replace(const LDObjectList& others);
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
122 void select();
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
123 void setColor(LDColor color);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
124 void setDocument(LDDocument* document);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
125 void setHidden(bool value);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
126 void setVertex(int i, const Vertex& vert);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
127 void swap(LDObject* other);
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
128 LDObject* topLevelParent();
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
129 virtual LDObjectType type() const = 0;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
130 virtual QString typeName() const = 0;
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
131 const Vertex& vertex(int i) const;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
132
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
133 static QString describeObjects(const LDObjectList& objs);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
134 static LDObject* fromID(int id);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
135 static LDObject* getDefault(const LDObjectType type);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
136 static void moveObjects(LDObjectList objs, const bool up); // TODO: move this to LDDocument?
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
137 static QString typeName(LDObjectType type);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
138
956
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents: 946
diff changeset
139 protected:
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents: 946
diff changeset
140 virtual ~LDObject();
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents: 946
diff changeset
141
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 785
diff changeset
142 private:
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
143 bool m_isHidden;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
144 bool m_isSelected;
956
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents: 946
diff changeset
145 bool m_isDestroyed;
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
146 LDObject* m_parent;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
147 LDDocument* m_document;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
148 qint32 m_id;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
149 LDColor m_color;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
150 QColor m_randomColor;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
151 Vertex m_coords[4];
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
152 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
153
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 767
diff changeset
154 template<typename T, typename... Args>
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
155 T* LDSpawn(Args... args)
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 767
diff changeset
156 {
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
157 static_assert(std::is_base_of<LDObject, T>::value,
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
158 "spawn may only be used with LDObject-derivatives");
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
159 T* result = new T(args..., nullptr);
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
160
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
161 // Set default color. Relying on virtual functions, this cannot be done in the c-tor.
943
af81220741d9 Commit work done on code cleanup
Teemu Piippo <crimsondusk64@gmail.com>
parents: 890
diff changeset
162 // TODO: store -1 as the default color
af81220741d9 Commit work done on code cleanup
Teemu Piippo <crimsondusk64@gmail.com>
parents: 890
diff changeset
163 if (result->isColored())
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
164 result->setColor(result->defaultColor());
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
165
943
af81220741d9 Commit work done on code cleanup
Teemu Piippo <crimsondusk64@gmail.com>
parents: 890
diff changeset
166 return result;
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 767
diff changeset
167 }
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 767
diff changeset
168
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 767
diff changeset
169 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
170 //
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
171 // Common code for objects with matrices. This class is multiple-derived in
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
172 // and thus not used directly other than as a common storage point for matrices
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
173 // and vertices.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
174 //
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
175 // In 0.1-alpha, there was a separate 'radial' type which had a position and
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
176 // matrix as well. Even though right now only LDSubfile uses this, I'm keeping
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
177 // this class distinct in case I get new extension ideas. :)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
178 //
843
9ac9060877cc - moved LDMatrixObject to be an abstract class deriving from LDObject. LDSubfile only inherits from LDMatrixObject.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 835
diff changeset
179 class LDMatrixObject : public LDObject
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
180 {
843
9ac9060877cc - moved LDMatrixObject to be an abstract class deriving from LDObject. LDSubfile only inherits from LDMatrixObject.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 835
diff changeset
181 Vertex m_position;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
182
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
183 public:
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
184 LDMatrixObject(LDDocument* document = nullptr);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
185 LDMatrixObject(const Matrix& transform, const Vertex& pos, LDDocument* document = nullptr);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
186
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
187 const Vertex& position() const;
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
188 void setCoordinate(const Axis ax, double value);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
189 void setPosition(const Vertex& a);
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
190 const Matrix& transform() const;
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
191 void setTransform(const Matrix& value);
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
192
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
193 private:
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
194 Matrix m_transform;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
195 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
196
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
197 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
198 //
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
199 // Represents a line in the LDraw file that could not be properly parsed. It is
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
200 // represented by a(!) ERROR in the code view. It exists for the purpose of
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
201 // allowing garbage lines be debugged and corrected within LDForge.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
202 //
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
203 class LDError : public LDObject
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
204 {
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
205 LDOBJ(Error)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
206 LDOBJ_NAME(error)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
207 LDOBJ_VERTICES(0)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
208 LDOBJ_UNCOLORED
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
209 LDOBJ_SCEMANTIC
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
210 LDOBJ_NO_MATRIX
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
211
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
212 public:
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
213 LDError(QString contents, QString reason, LDDocument* document = nullptr);
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
214 QString reason() const;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
215 QString contents() const;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
216 QString fileReferenced() const;
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
217 void setFileReferenced(QString value);
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
218
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
219 private:
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
220 QString m_fileReferenced; // If this error was caused by inability to open a file, what file was that?
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
221 QString m_contents; // The LDraw code that was being parsed
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
222 QString m_reason;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
223 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
224
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
225 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
226 //
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
227 // Represents an empty line in the LDraw code file.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
228 //
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
229 class LDEmpty : public LDObject
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
230 {
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
231 LDOBJ(Empty)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
232 LDOBJ_NAME(empty)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
233 LDOBJ_VERTICES(0)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
234 LDOBJ_UNCOLORED
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
235 LDOBJ_NON_SCEMANTIC
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
236 LDOBJ_NO_MATRIX
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
237 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
238
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
239 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
240 //
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
241 // Represents a code-0 comment in the LDraw code file.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
242 //
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
243 class LDComment : public LDObject
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
244 {
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
245 LDOBJ(Comment)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
246 LDOBJ_NAME(comment)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
247 LDOBJ_VERTICES(0)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
248 LDOBJ_UNCOLORED
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
249 LDOBJ_NON_SCEMANTIC
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
250 LDOBJ_NO_MATRIX
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
251
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
252 public:
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
253 LDComment(QString text, LDDocument* document = nullptr);
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
254 QString text() const;
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
255 void setText(QString value);
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
256
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
257 private:
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
258 QString m_text;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
259 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
260
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
261 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
262 //
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
263 // Represents a 0 BFC statement in the LDraw code.
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
264 //
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
265 enum class BfcStatement
847
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
266 {
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
267 CertifyCCW,
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
268 CCW,
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
269 CertifyCW,
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
270 CW,
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
271 NoCertify,
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
272 InvertNext,
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
273 Clip,
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
274 ClipCCW,
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
275 ClipCW,
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
276 NoClip,
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
277
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
278 NumValues,
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
279 FirstValue = CertifyCCW
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
280 };
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
281
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
282 class LDBfc : public LDObject
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
283 {
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
284 public:
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
285 LDOBJ(Bfc)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
286 LDOBJ_NAME(bfc)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
287 LDOBJ_VERTICES(0)
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
288 LDOBJ_UNCOLORED
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
289 LDOBJ_CUSTOM_SCEMANTIC { return (statement() == BfcStatement::InvertNext); }
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
290 LDOBJ_NO_MATRIX
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
291
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
292 public:
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
293 LDBfc(const BfcStatement type, LDDocument* document = nullptr);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
294
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
295 BfcStatement statement() const;
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
296 void setStatement(BfcStatement value);
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
297 QString statementToString() const;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
298
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
299 static QString statementToString(BfcStatement statement);
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
300
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
301 private:
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
302 BfcStatement m_statement;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
303 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
304
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
305 //
1011
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
306 // LDReference
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
307 //
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
308 // Represents a single code-1 subfile reference.
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
309 //
1011
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1006
diff changeset
310 class LDSubfileReference : public LDMatrixObject
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
311 {
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
312 LDOBJ(SubfileReference)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
313 LDOBJ_NAME(subfilereference)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
314 LDOBJ_VERTICES(0)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
315 LDOBJ_COLORED
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
316 LDOBJ_DEFAULTCOLOR(MainColor)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
317 LDOBJ_SCEMANTIC
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
318 LDOBJ_HAS_MATRIX
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
319
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
320 public:
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
321 // Inlines this subfile.
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
322 LDDocument* fileInfo() const;
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
323 virtual void getVertices(QVector<Vertex>& verts) const override;
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
324 LDObjectList inlineContents(bool deep, bool render);
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
325 QList<LDPolygon> inlinePolygons();
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
326 void setFileInfo(LDDocument* fileInfo);
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
327
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
328 private:
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
329 LDDocument* m_fileInfo;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
330 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
331
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
332 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
333 // LDLine
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
334 //
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
335 // Represents a single code-2 line in the LDraw code file.
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
336 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
337 class LDLine : public LDObject
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
338 {
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
339 LDOBJ(Line)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
340 LDOBJ_NAME(line)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
341 LDOBJ_VERTICES(2)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
342 LDOBJ_COLORED
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
343 LDOBJ_DEFAULTCOLOR(EdgeColor)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
344 LDOBJ_SCEMANTIC
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
345 LDOBJ_NO_MATRIX
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
346
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
347 public:
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
348 LDLine(Vertex v1, Vertex v2, LDDocument* document = nullptr);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
349 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
350
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
351 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
352 // LDCondLine
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
353 //
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
354 // Represents a single code-5 conditional line.
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
355 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
356 class LDCondLine : public LDLine
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
357 {
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
358 LDOBJ(CondLine)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
359 LDOBJ_NAME(condline)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
360 LDOBJ_VERTICES(4)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
361 LDOBJ_COLORED
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
362 LDOBJ_DEFAULTCOLOR(EdgeColor)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
363 LDOBJ_SCEMANTIC
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
364 LDOBJ_NO_MATRIX
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
365
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
366 public:
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
367 LDCondLine(const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3, LDDocument* document = nullptr);
945
c310073e4f22 More sharedpointer removal
Teemu Piippo <crimsondusk64@gmail.com>
parents: 944
diff changeset
368 LDLine* toEdgeLine();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
369 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
370
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
371 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
372 // LDTriangle
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
373 //
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
374 // Represents a single code-3 triangle in the LDraw code file. Vertices v0, v1
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
375 // and v2 contain the end-points of this triangle. dColor is the color the
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
376 // triangle is colored with.
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
377 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
378 class LDTriangle : public LDObject
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
379 {
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
380 LDOBJ(Triangle)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
381 LDOBJ_NAME(triangle)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
382 LDOBJ_VERTICES(3)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
383 LDOBJ_COLORED
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
384 LDOBJ_DEFAULTCOLOR(MainColor)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
385 LDOBJ_SCEMANTIC
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
386 LDOBJ_NO_MATRIX
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
387
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
388 public:
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
389 LDTriangle(Vertex const& v1, Vertex const& v2, Vertex const& v3, LDDocument* document = nullptr);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
390 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
391
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
392 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
393 // LDQuad
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
394 //
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
395 // Represents a single code-4 quadrilateral. v0, v1, v2 and v3 are the end points
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
396 // of the quad, dColor is the color used for the quad.
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
397 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
398 class LDQuad : public LDObject
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
399 {
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
400 LDOBJ(Quad)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
401 LDOBJ_NAME(quad)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
402 LDOBJ_VERTICES(4)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
403 LDOBJ_COLORED
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
404 LDOBJ_DEFAULTCOLOR(MainColor)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
405 LDOBJ_SCEMANTIC
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
406 LDOBJ_NO_MATRIX
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
407
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
408 public:
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
409 LDQuad(const Vertex& v1, const Vertex& v2, const Vertex& v3, const Vertex& v4, LDDocument* document = nullptr);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
410
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
411 // Split this quad into two triangles
945
c310073e4f22 More sharedpointer removal
Teemu Piippo <crimsondusk64@gmail.com>
parents: 944
diff changeset
412 QList<LDTriangle*> splitToTriangles();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
413 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
414
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
415 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
416 // LDOverlay
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
417 //
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
418 // Overlay image meta, stored in the header of parts so as to preserve overlay information.
805
d88c0354de97 - refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
419 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
420 class LDOverlay : public LDObject
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
421 {
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
422 LDOBJ(Overlay)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
423 LDOBJ_NAME(overlay)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
424 LDOBJ_VERTICES(0)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
425 LDOBJ_UNCOLORED
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
426 LDOBJ_NON_SCEMANTIC
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
427 LDOBJ_NO_MATRIX
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
428
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
429 public:
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
430 int camera() const;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
431 QString fileName() const;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
432 int height() const;
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
433 void setCamera(int value);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
434 void setFileName(QString value);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
435 void setHeight(int value);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
436 void setWidth(int value);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
437 void setX(int value);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
438 void setY(int value);
988
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
439 int width() const;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
440 int x() const;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
441 int y() const;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
442
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
443 private:
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
444 int m_camera;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
445 int m_x;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
446 int m_y;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
447 int m_width;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
448 int m_height;
ac4a2ae54f76 Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
449 QString m_fileName;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
450 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
451
1000
c064cc048f14 Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 995
diff changeset
452 class LDBezierCurve : public LDObject
c064cc048f14 Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 995
diff changeset
453 {
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
454 LDOBJ(BezierCurve)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
455 LDOBJ_NAME(beziercurve)
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
456 LDOBJ_VERTICES(4)
1000
c064cc048f14 Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 995
diff changeset
457 LDOBJ_COLORED
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
458 LDOBJ_DEFAULTCOLOR(EdgeColor)
1000
c064cc048f14 Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 995
diff changeset
459 LDOBJ_SCEMANTIC
c064cc048f14 Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 995
diff changeset
460 LDOBJ_NO_MATRIX
c064cc048f14 Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 995
diff changeset
461
c064cc048f14 Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 995
diff changeset
462 public:
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
463 LDBezierCurve(const Vertex& v0, const Vertex& v1,
1000
c064cc048f14 Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 995
diff changeset
464 const Vertex& v2, const Vertex& v3, LDDocument* document = nullptr);
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
465 Vertex pointAt(qreal t) const;
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
466 LDObjectList rasterize(int segments = 0);
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
467 QVector<LDPolygon> rasterizePolygons(int segments = 0);
1000
c064cc048f14 Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 995
diff changeset
468 };
c064cc048f14 Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 995
diff changeset
469
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
470 // Other common LDraw stuff
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
471 static const QString CALicenseText("!LICENSE Redistributable under CCAL version 2.0 : "
848
68410477c8bb - refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents: 847
diff changeset
472 "see CAreadme.txt");
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
473
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
474 enum
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
475 {
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
476 LowResolution = 16,
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
477 HighResolution = 48
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
478 };
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
479
956
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents: 946
diff changeset
480 QString PreferredLicenseText();

mercurial