src/ldobjectiterator.h

Thu, 23 Feb 2017 20:21:40 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 23 Feb 2017 20:21:40 +0200
changeset 1160
2cf16ba952bf
parent 1147
a26568aa3cce
child 1186
eae8b3bce545
child 1326
69a90bd2dba2
permissions
-rw-r--r--

At long last, the g_win pointer has been removed. Down with global variables!

1006
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
1 /*
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
2 * LDForge: LDraw parts authoring CAD
1072
9ce9496427f2 Happy new year 2017!
Teemu Piippo <teemu@hecknology.net>
parents: 1065
diff changeset
3 * Copyright (C) 2013 - 2017 Teemu Piippo
1006
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
4 *
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
5 * This program is free software: you can redistribute it and/or modify
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
6 * it under the terms of the GNU General Public License as published by
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
8 * (at your option) any later version.
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
9 *
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
10 * This program is distributed in the hope that it will be useful,
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
13 * GNU General Public License for more details.
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
14 *
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
15 * You should have received a copy of the GNU General Public License
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
17 */
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1005
diff changeset
18
956
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #pragma once
1147
a26568aa3cce Renamed ldObject.cpp → linetypes/modelobject.cpp
Teemu Piippo <teemu@hecknology.net>
parents: 1145
diff changeset
20 #include "linetypes/modelobject.h"
1145
02264bf0108d Renamed ldDocument.cpp → lddocument.cpp
Teemu Piippo <teemu@hecknology.net>
parents: 1073
diff changeset
21 #include "lddocument.h"
956
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 template<typename T>
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 class LDObjectIterator
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 {
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 public:
1073
a0a0d581309b Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
Teemu Piippo <teemu@hecknology.net>
parents: 1072
diff changeset
27 LDObjectIterator (Model* model) :
a0a0d581309b Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
Teemu Piippo <teemu@hecknology.net>
parents: 1072
diff changeset
28 m_list (model->objects()),
956
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 m_i (-1)
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 {
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 seekTillValid();
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 }
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33
1073
a0a0d581309b Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
Teemu Piippo <teemu@hecknology.net>
parents: 1072
diff changeset
34 LDObjectIterator (const QVector<LDObject*>& objs) :
956
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 m_list (objs),
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 m_i (-1)
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 {
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 seekTillValid();
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 }
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 bool outOfBounds() const
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 {
1065
c8ecddbd99e9 Actually, let's call it countof(). Makes more sense.
Teemu Piippo <teemu@hecknology.net>
parents: 1063
diff changeset
43 return m_i < 0 or m_i >= countof(m_list);
956
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 }
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 T* get() const
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 {
1005
a88cf5a32246 Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 956
diff changeset
48 return static_cast<T*> (m_list[m_i]);
956
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 }
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 bool isValid() const
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 {
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 return not outOfBounds() and get()->type() == T::SubclassType;
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 }
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 void seek (int i)
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 {
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 m_i = i;
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 }
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 void seekTillValid()
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 {
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 do ++m_i;
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 while (not outOfBounds() and not isValid());
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
65 }
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 void rewindTillValid()
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68 {
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69 do --m_i;
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70 while (m_i >= 0 and not isValid());
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 }
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 int tell() const
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
74 {
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 return m_i;
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76 }
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78 T* operator*() const
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 {
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 return get();
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81 }
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83 T* operator->() const
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 {
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 return get();
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86 }
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88 void operator++()
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 {
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90 seekTillValid();
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 }
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93 void operator++ (int)
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
94 {
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
95 seekTillValid();
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96 }
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
98 void operator--()
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99 {
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
100 rewindTillValid();
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101 }
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
102
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103 void operator-- (int)
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104 {
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105 rewindTillValid();
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 }
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107
1005
a88cf5a32246 Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 956
diff changeset
108 operator T*()
a88cf5a32246 Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 956
diff changeset
109 {
a88cf5a32246 Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 956
diff changeset
110 return get();
a88cf5a32246 Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 956
diff changeset
111 }
a88cf5a32246 Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 956
diff changeset
112
956
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
113 private:
1073
a0a0d581309b Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
Teemu Piippo <teemu@hecknology.net>
parents: 1072
diff changeset
114 const QVector<LDObject*>& m_list;
956
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
115 int m_i;
2af18ba2665f Replace LDIterate function with LDObjectIterator class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
116 };
1005
a88cf5a32246 Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 956
diff changeset
117
a88cf5a32246 Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 956
diff changeset
118 template<typename T, typename R>
a88cf5a32246 Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 956
diff changeset
119 QVector<T*> filterByType (const R& stuff)
a88cf5a32246 Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 956
diff changeset
120 {
a88cf5a32246 Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 956
diff changeset
121 QVector<T*> result;
a88cf5a32246 Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 956
diff changeset
122
1073
a0a0d581309b Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
Teemu Piippo <teemu@hecknology.net>
parents: 1072
diff changeset
123 for (LDObject* object : stuff)
a0a0d581309b Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
Teemu Piippo <teemu@hecknology.net>
parents: 1072
diff changeset
124 {
a0a0d581309b Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
Teemu Piippo <teemu@hecknology.net>
parents: 1072
diff changeset
125 T* casted = dynamic_cast<T*>(object);
a0a0d581309b Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
Teemu Piippo <teemu@hecknology.net>
parents: 1072
diff changeset
126 if (casted != nullptr)
a0a0d581309b Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
Teemu Piippo <teemu@hecknology.net>
parents: 1072
diff changeset
127 result << casted;
a0a0d581309b Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
Teemu Piippo <teemu@hecknology.net>
parents: 1072
diff changeset
128 }
1005
a88cf5a32246 Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 956
diff changeset
129
a88cf5a32246 Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 956
diff changeset
130 return result;
a88cf5a32246 Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 956
diff changeset
131 }

mercurial