Thu, 09 Feb 2017 22:46:37 +0200
Moved LDComment and LDEmpty into their own source file pairs.
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 |
1072 | 3 | * Copyright (C) 2013 - 2017 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 | |
1082
1738bdaf36d6
The "all objects have valid models" invariant seems to be holding up now. At least basic drawing works again.
Teemu Piippo <teemu@hecknology.net>
parents:
1081
diff
changeset
|
19 | #include <assert.h> |
1084
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
20 | #include "documentmanager.h" |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include "ldObject.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include "ldDocument.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include "miscallenous.h" |
962
a4b463a7ee82
Rename MainWindow files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
959
diff
changeset
|
24 | #include "mainwindow.h" |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | #include "editHistory.h" |
1103
ac7db4c076c3
Created a new GLRenderer derivative class "Canvas" and made MainWindow use it
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
26 | #include "canvas.h" |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | #include "colors.h" |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
28 | #include "glCompiler.h" |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | |
970
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
30 | ConfigOption (QString DefaultName = "") |
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
31 | ConfigOption (QString DefaultUser = "") |
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
32 | ConfigOption (bool UseCaLicense = true) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | // List of all LDObjects |
945
c310073e4f22
More sharedpointer removal
Teemu Piippo <crimsondusk64@gmail.com>
parents:
944
diff
changeset
|
35 | QMap<int32, LDObject*> g_allObjects; |
943
af81220741d9
Commit work done on code cleanup
Teemu Piippo <crimsondusk64@gmail.com>
parents:
920
diff
changeset
|
36 | |
af81220741d9
Commit work done on code cleanup
Teemu Piippo <crimsondusk64@gmail.com>
parents:
920
diff
changeset
|
37 | enum { MAX_LDOBJECT_IDS = (1 << 24) }; |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
38 | |
770
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
39 | #define LDOBJ_DEFAULT_CTOR(T,BASE) \ |
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
|
40 | T :: T (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
|
41 | BASE {model} {} |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | // LDObject constructors |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | // |
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
|
46 | LDObject::LDObject (Model* model) : |
1082
1738bdaf36d6
The "all objects have valid models" invariant seems to be holding up now. At least basic drawing works again.
Teemu Piippo <teemu@hecknology.net>
parents:
1081
diff
changeset
|
47 | m_isHidden {false}, |
1738bdaf36d6
The "all objects have valid models" invariant seems to be holding up now. At least basic drawing works again.
Teemu Piippo <teemu@hecknology.net>
parents:
1081
diff
changeset
|
48 | m_isSelected {false}, |
1738bdaf36d6
The "all objects have valid models" invariant seems to be holding up now. At least basic drawing works again.
Teemu Piippo <teemu@hecknology.net>
parents:
1081
diff
changeset
|
49 | _model {model}, |
1738bdaf36d6
The "all objects have valid models" invariant seems to be holding up now. At least basic drawing works again.
Teemu Piippo <teemu@hecknology.net>
parents:
1081
diff
changeset
|
50 | m_coords {Origin} |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | { |
1082
1738bdaf36d6
The "all objects have valid models" invariant seems to be holding up now. At least basic drawing works again.
Teemu Piippo <teemu@hecknology.net>
parents:
1081
diff
changeset
|
52 | assert(_model != nullptr); |
943
af81220741d9
Commit work done on code cleanup
Teemu Piippo <crimsondusk64@gmail.com>
parents:
920
diff
changeset
|
53 | |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
54 | // Let's hope that nobody goes to create 17 million objects anytime soon... |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
55 | static int32 nextId = 1; // 0 shalt be null |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
56 | if (nextId < MAX_LDOBJECT_IDS) |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
57 | m_id = nextId++; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
58 | else |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
59 | m_id = 0; |
943
af81220741d9
Commit work done on code cleanup
Teemu Piippo <crimsondusk64@gmail.com>
parents:
920
diff
changeset
|
60 | |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
61 | if (m_id != 0) |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
62 | g_allObjects[m_id] = this; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
63 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
64 | m_randomColor = QColor::fromHsv (rand() % 360, rand() % 256, rand() % 96 + 128); |
770
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
65 | } |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
66 | |
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
|
67 | LDSubfileReference::LDSubfileReference (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
|
68 | LDMatrixObject (model) {} |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
69 | |
770
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
70 | LDOBJ_DEFAULT_CTOR (LDError, LDObject) |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
71 | LDOBJ_DEFAULT_CTOR (LDLine, LDObject) |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
72 | LDOBJ_DEFAULT_CTOR (LDTriangle, LDObject) |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
73 | LDOBJ_DEFAULT_CTOR (LDCondLine, LDLine) |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
74 | LDOBJ_DEFAULT_CTOR (LDQuad, LDObject) |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
75 | LDOBJ_DEFAULT_CTOR (LDBfc, LDObject) |
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:
998
diff
changeset
|
76 | LDOBJ_DEFAULT_CTOR (LDBezierCurve, LDObject) |
770
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
77 | |
944 | 78 | LDObject::~LDObject() |
79 | { | |
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
|
80 | // Delete the GL lists |
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
|
81 | if (g_win) |
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
|
82 | g_win->renderer()->forgetObject(this); |
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
|
83 | |
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
|
84 | // Remove this object from the list of LDObjects |
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
|
85 | g_allObjects.erase(g_allObjects.find(id())); |
944 | 86 | } |
87 | ||
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | // |
1011
4fdd74a04790
Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1008
diff
changeset
|
90 | QString LDSubfileReference::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
92 | QString val = format ("1 %1 %2 ", color(), position()); |
1045
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
Teemu Piippo <teemu@hecknology.net>
parents:
1031
diff
changeset
|
93 | val += transformationMatrix().toString(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | val += ' '; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | val += fileInfo()->name(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | return val; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
97 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
98 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
100 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
101 | QString LDLine::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
103 | QString val = format ("2 %1", color()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
105 | for (int i = 0; i < 2; ++i) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
106 | val += format (" %1", vertex (i)); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
107 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
108 | return val; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
112 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
113 | QString LDTriangle::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
115 | QString val = format ("3 %1", color()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
116 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
117 | for (int i = 0; i < 3; ++i) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
118 | val += format (" %1", vertex (i)); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | return val; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
121 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
122 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
123 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
124 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
125 | QString LDQuad::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
126 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
127 | QString val = format ("4 %1", color()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
128 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | for (int i = 0; i < 4; ++i) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | val += format (" %1", vertex (i)); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
131 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
132 | return val; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
133 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
134 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
135 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
136 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
137 | QString LDCondLine::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
139 | QString val = format ("5 %1", color()); |
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:
998
diff
changeset
|
140 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
141 | // Add the coordinates |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
142 | for (int i = 0; i < 4; ++i) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
143 | val += format (" %1", vertex (i)); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
144 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
145 | return val; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
146 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
147 | |
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:
998
diff
changeset
|
148 | QString LDBezierCurve::asText() const |
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:
998
diff
changeset
|
149 | { |
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:
998
diff
changeset
|
150 | QString result = format ("0 !LDFORGE BEZIER_CURVE %1", color()); |
1008
74cb432812d3
Fixed circle, rectangle and line path modes not working anymore. Add blip coordinates to curve and line path modes. Circle mode for now only can show the coordinates of the initial blip
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1006
diff
changeset
|
151 | |
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:
998
diff
changeset
|
152 | // Add the coordinates |
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:
998
diff
changeset
|
153 | for (int i = 0; i < 4; ++i) |
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:
998
diff
changeset
|
154 | result += format (" %1", vertex (i)); |
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:
998
diff
changeset
|
155 | |
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:
998
diff
changeset
|
156 | return result; |
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:
998
diff
changeset
|
157 | } |
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:
998
diff
changeset
|
158 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
159 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
160 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
161 | QString LDError::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
162 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
163 | return contents(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
164 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
165 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
166 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
167 | // |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
168 | QString LDBfc::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
169 | { |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
170 | return format ("0 BFC %1", statementToString()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
171 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
172 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
173 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
174 | // |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
175 | // Swap this object with another. |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
176 | // |
945
c310073e4f22
More sharedpointer removal
Teemu Piippo <crimsondusk64@gmail.com>
parents:
944
diff
changeset
|
177 | void LDObject::swap (LDObject* other) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
178 | { |
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
|
179 | if (model() == other->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
|
180 | model()->swapObjects (this, other); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
181 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
182 | |
1015
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
183 | int LDObject::triangleCount() const |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
184 | { |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
185 | return 0; |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
186 | } |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
187 | |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
188 | int LDSubfileReference::triangleCount() const |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
189 | { |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
190 | return fileInfo()->triangleCount(); |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
191 | } |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
192 | |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
193 | int LDTriangle::triangleCount() const |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
194 | { |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
195 | return 1; |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
196 | } |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
197 | |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
198 | int LDQuad::triangleCount() const |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
199 | { |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
200 | return 2; |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
201 | } |
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
202 | |
1117
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
203 | int LDObject::numVertices() const |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
204 | { |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
205 | return 0; |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
206 | } |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
207 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
208 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
209 | // |
1077
952d6b3e7d11
Replaced uses of LDSpawn with the Model class in edit modes
Teemu Piippo <teemu@hecknology.net>
parents:
1076
diff
changeset
|
210 | LDLine::LDLine (Vertex v1, Vertex v2, Model* model) : |
952d6b3e7d11
Replaced uses of LDSpawn with the Model class in edit modes
Teemu Piippo <teemu@hecknology.net>
parents:
1076
diff
changeset
|
211 | LDObject {model} |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
212 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
213 | setVertex (0, v1); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
214 | setVertex (1, v2); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
215 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
216 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
217 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
218 | // |
1077
952d6b3e7d11
Replaced uses of LDSpawn with the Model class in edit modes
Teemu Piippo <teemu@hecknology.net>
parents:
1076
diff
changeset
|
219 | LDTriangle::LDTriangle (const Vertex& v1, const Vertex& v2, const Vertex& v3, Model* model) : |
952d6b3e7d11
Replaced uses of LDSpawn with the Model class in edit modes
Teemu Piippo <teemu@hecknology.net>
parents:
1076
diff
changeset
|
220 | LDObject {model} |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
221 | { |
805
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
222 | setVertex (0, v1); |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
223 | setVertex (1, v2); |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
224 | setVertex (2, v3); |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
225 | } |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
226 | |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
227 | // ============================================================================= |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
228 | // |
1077
952d6b3e7d11
Replaced uses of LDSpawn with the Model class in edit modes
Teemu Piippo <teemu@hecknology.net>
parents:
1076
diff
changeset
|
229 | LDQuad::LDQuad (const Vertex& v1, const Vertex& v2, const Vertex& v3, const Vertex& v4, Model* model) : |
952d6b3e7d11
Replaced uses of LDSpawn with the Model class in edit modes
Teemu Piippo <teemu@hecknology.net>
parents:
1076
diff
changeset
|
230 | LDObject {model} |
805
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
231 | { |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
232 | setVertex (0, v1); |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
233 | setVertex (1, v2); |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
234 | setVertex (2, v3); |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
235 | setVertex (3, v4); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
236 | } |
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 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
239 | // |
1077
952d6b3e7d11
Replaced uses of LDSpawn with the Model class in edit modes
Teemu Piippo <teemu@hecknology.net>
parents:
1076
diff
changeset
|
240 | LDCondLine::LDCondLine (const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3, Model* model) : |
952d6b3e7d11
Replaced uses of LDSpawn with the Model class in edit modes
Teemu Piippo <teemu@hecknology.net>
parents:
1076
diff
changeset
|
241 | LDLine {model} |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
242 | { |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
243 | setVertex (0, v0); |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
244 | setVertex (1, v1); |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
245 | setVertex (2, v2); |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
246 | setVertex (3, v3); |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
247 | } |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
248 | |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
249 | // ============================================================================= |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
250 | // |
1077
952d6b3e7d11
Replaced uses of LDSpawn with the Model class in edit modes
Teemu Piippo <teemu@hecknology.net>
parents:
1076
diff
changeset
|
251 | LDBezierCurve::LDBezierCurve(const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3, Model* model) : |
952d6b3e7d11
Replaced uses of LDSpawn with the Model class in edit modes
Teemu Piippo <teemu@hecknology.net>
parents:
1076
diff
changeset
|
252 | LDObject {model} |
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:
998
diff
changeset
|
253 | { |
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:
998
diff
changeset
|
254 | setVertex (0, v0); |
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:
998
diff
changeset
|
255 | setVertex (1, v1); |
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:
998
diff
changeset
|
256 | setVertex (2, v2); |
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:
998
diff
changeset
|
257 | setVertex (3, v3); |
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:
998
diff
changeset
|
258 | } |
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:
998
diff
changeset
|
259 | |
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:
998
diff
changeset
|
260 | // ============================================================================= |
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:
998
diff
changeset
|
261 | // |
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
|
262 | void LDObject::setDocument (Model* model) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
263 | { |
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
|
264 | _model = model; |
880
5dcd2e741d1c
- fixed documentless objects being selected on document close
Teemu Piippo <crimsondusk64@gmail.com>
parents:
867
diff
changeset
|
265 | } |
5dcd2e741d1c
- fixed documentless objects being selected on document close
Teemu Piippo <crimsondusk64@gmail.com>
parents:
867
diff
changeset
|
266 | |
5dcd2e741d1c
- fixed documentless objects being selected on document close
Teemu Piippo <crimsondusk64@gmail.com>
parents:
867
diff
changeset
|
267 | // ============================================================================= |
5dcd2e741d1c
- fixed documentless objects being selected on document close
Teemu Piippo <crimsondusk64@gmail.com>
parents:
867
diff
changeset
|
268 | // |
945
c310073e4f22
More sharedpointer removal
Teemu Piippo <crimsondusk64@gmail.com>
parents:
944
diff
changeset
|
269 | static void TransformObject (LDObject* obj, Matrix transform, Vertex pos, LDColor parentcolor) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
270 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
271 | switch (obj->type()) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
272 | { |
944 | 273 | case OBJ_Line: |
274 | case OBJ_CondLine: | |
275 | case OBJ_Triangle: | |
276 | case OBJ_Quad: | |
277 | for (int i = 0; i < obj->numVertices(); ++i) | |
278 | { | |
279 | Vertex v = obj->vertex (i); | |
280 | v.transform (transform, pos); | |
281 | obj->setVertex (i, v); | |
282 | } | |
283 | break; | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
284 | |
1011
4fdd74a04790
Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1008
diff
changeset
|
285 | case OBJ_SubfileReference: |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
286 | { |
1011
4fdd74a04790
Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1008
diff
changeset
|
287 | LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj); |
1045
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
Teemu Piippo <teemu@hecknology.net>
parents:
1031
diff
changeset
|
288 | Matrix newMatrix = transform * ref->transformationMatrix(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
289 | Vertex newpos = ref->position(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
290 | newpos.transform (transform, pos); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
291 | ref->setPosition (newpos); |
1045
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
Teemu Piippo <teemu@hecknology.net>
parents:
1031
diff
changeset
|
292 | ref->setTransformationMatrix (newMatrix); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
293 | } |
944 | 294 | break; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
295 | |
944 | 296 | default: |
297 | break; | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
298 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
299 | |
946 | 300 | if (obj->color() == MainColor) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
301 | obj->setColor (parentcolor); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
302 | } |
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 | // ============================================================================= |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
305 | // ----------------------------------------------------------------------------- |
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
|
306 | void LDSubfileReference::inlineContents(Model& model, bool deep, bool render) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
307 | { |
1079
67c6e5d32e68
More rework on model stuff, removals of LDSpawn calls. Most importantly, the LDraw code parsing function was moved to Model.
Teemu Piippo <teemu@hecknology.net>
parents:
1078
diff
changeset
|
308 | Model inlined {this->model()->documentManager()}; |
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
|
309 | fileInfo()->inlineContents(inlined, deep, render); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
310 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
311 | // Transform the objects |
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
|
312 | for (LDObject* object : inlined) |
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
|
313 | TransformObject(object, transformationMatrix(), position(), color()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
314 | |
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
|
315 | model.merge(inlined); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
316 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
317 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
318 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
319 | // |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
320 | LDPolygon* LDObject::getPolygon() |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
321 | { |
786
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
322 | LDObjectType ot = type(); |
847 | 323 | int num = (ot == OBJ_Line) ? 2 |
324 | : (ot == OBJ_Triangle) ? 3 | |
325 | : (ot == OBJ_Quad) ? 4 | |
326 | : (ot == OBJ_CondLine) ? 5 | |
327 | : 0; | |
328 | ||
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
329 | if (num == 0) |
984 | 330 | return nullptr; |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
331 | |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
332 | LDPolygon* data = new LDPolygon; |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
333 | data->id = id(); |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
334 | data->num = num; |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
805
diff
changeset
|
335 | data->color = color().index(); |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
336 | |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
337 | for (int i = 0; i < data->numVertices(); ++i) |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
338 | data->vertices[i] = vertex (i); |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
339 | |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
340 | return data; |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
341 | } |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
342 | |
1117
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
343 | LDColor LDObject::defaultColor() const |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
344 | { |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
345 | return MainColor; |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
346 | } |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
347 | |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
348 | bool LDObject::isColored() const |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
349 | { |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
350 | return true; |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
351 | } |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
352 | |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
353 | bool LDObject::isScemantic() const |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
354 | { |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
355 | return true; |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
356 | } |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
357 | |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
358 | bool LDObject::hasMatrix() const |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
359 | { |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
360 | return false; |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
361 | } |
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
362 | |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
363 | // ============================================================================= |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
364 | // |
1011
4fdd74a04790
Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1008
diff
changeset
|
365 | QList<LDPolygon> LDSubfileReference::inlinePolygons() |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
366 | { |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
367 | QList<LDPolygon> data = fileInfo()->inlinePolygons(); |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
368 | |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
369 | for (LDPolygon& entry : data) |
847 | 370 | { |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
371 | for (int i = 0; i < entry.numVertices(); ++i) |
1045
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
Teemu Piippo <teemu@hecknology.net>
parents:
1031
diff
changeset
|
372 | entry.vertices[i].transform (transformationMatrix(), position()); |
847 | 373 | } |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
374 | |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
375 | return data; |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
376 | } |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
377 | |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
378 | // ============================================================================= |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
379 | // |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
380 | // Index (i.e. line number) of this object |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
381 | // |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
382 | int LDObject::lineNumber() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
383 | { |
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
|
384 | if (model()) |
847 | 385 | { |
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
|
386 | for (int i = 0; i < model()->size(); ++i) |
949
a9ba8ffd9534
actually added updaterevision.py, more fixing
Teemu Piippo <crimsondusk64@gmail.com>
parents:
946
diff
changeset
|
387 | { |
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
|
388 | if (model()->getObject(i) == this) |
949
a9ba8ffd9534
actually added updaterevision.py, more fixing
Teemu Piippo <crimsondusk64@gmail.com>
parents:
946
diff
changeset
|
389 | return i; |
a9ba8ffd9534
actually added updaterevision.py, more fixing
Teemu Piippo <crimsondusk64@gmail.com>
parents:
946
diff
changeset
|
390 | } |
847 | 391 | } |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
392 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
393 | return -1; |
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 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
396 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
397 | // |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
398 | // Object after this in the current file |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
399 | // |
945
c310073e4f22
More sharedpointer removal
Teemu Piippo <crimsondusk64@gmail.com>
parents:
944
diff
changeset
|
400 | LDObject* LDObject::next() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
401 | { |
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
|
402 | return model()->getObject(lineNumber() + 1); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
403 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
404 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
405 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
406 | // |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
407 | // Object prior to this in the current file |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
408 | // |
945
c310073e4f22
More sharedpointer removal
Teemu Piippo <crimsondusk64@gmail.com>
parents:
944
diff
changeset
|
409 | LDObject* LDObject::previous() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
410 | { |
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
|
411 | return model()->getObject(lineNumber() - 1); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
412 | } |
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 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
415 | // |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
416 | // Is the previous object INVERTNEXT? |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
417 | // |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
418 | bool LDObject::previousIsInvertnext (LDBfc*& ptr) |
776
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
419 | { |
943
af81220741d9
Commit work done on code cleanup
Teemu Piippo <crimsondusk64@gmail.com>
parents:
920
diff
changeset
|
420 | LDObject* prev = previous(); |
776
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
421 | |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
422 | if (prev and prev->type() == OBJ_Bfc and static_cast<LDBfc*> (prev)->statement() == BfcStatement::InvertNext) |
776
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
423 | { |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
424 | ptr = static_cast<LDBfc*> (prev); |
776
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
425 | return true; |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
426 | } |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
427 | |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
428 | return false; |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
429 | } |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
430 | |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
431 | // ============================================================================= |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
432 | // |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
433 | // Moves this object using the given vertex as a movement List |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
434 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
435 | void LDObject::move (Vertex vect) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
436 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
437 | if (hasMatrix()) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
438 | { |
943
af81220741d9
Commit work done on code cleanup
Teemu Piippo <crimsondusk64@gmail.com>
parents:
920
diff
changeset
|
439 | LDMatrixObject* mo = static_cast<LDMatrixObject*> (this); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
440 | mo->setPosition (mo->position() + vect); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
441 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
442 | else |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
443 | { |
767
44f0d5322628
- slight refactor in ldobject methods
Santeri Piippo <crimsondusk64@gmail.com>
parents:
764
diff
changeset
|
444 | for (int i = 0; i < numVertices(); ++i) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
445 | setVertex (i, vertex (i) + vect); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
446 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
447 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
448 | |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
449 | bool LDObject::isHidden() const |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
450 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
451 | return m_isHidden; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
452 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
453 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
454 | void LDObject::setHidden (bool value) |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
455 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
456 | m_isHidden = value; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
457 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
458 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
459 | bool LDObject::isSelected() const |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
460 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
461 | return m_isSelected; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
462 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
463 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
464 | qint32 LDObject::id() const |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
465 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
466 | return m_id; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
467 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
468 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
469 | LDColor LDObject::color() const |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
470 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
471 | return m_color; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
472 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
473 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
474 | QColor LDObject::randomColor() const |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
475 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
476 | return m_randomColor; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
477 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
478 | |
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
|
479 | Model* LDObject::model() const |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
480 | { |
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
|
481 | return _model; |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
482 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
483 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
484 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
485 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
486 | void LDObject::invert() {} |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
487 | void LDBfc::invert() {} |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
488 | void LDError::invert() {} |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
489 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
490 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
491 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
492 | void LDTriangle::invert() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
493 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
494 | // Triangle goes 0 -> 1 -> 2, reversed: 0 -> 2 -> 1. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
495 | // Thus, we swap 1 and 2. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
496 | Vertex tmp = vertex (1); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
497 | setVertex (1, vertex (2)); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
498 | setVertex (2, tmp); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
499 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
500 | return; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
501 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
502 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
503 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
504 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
505 | void LDQuad::invert() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
506 | { |
943
af81220741d9
Commit work done on code cleanup
Teemu Piippo <crimsondusk64@gmail.com>
parents:
920
diff
changeset
|
507 | // Quad: 0 -> 1 -> 2 -> 3 |
af81220741d9
Commit work done on code cleanup
Teemu Piippo <crimsondusk64@gmail.com>
parents:
920
diff
changeset
|
508 | // reversed: 0 -> 3 -> 2 -> 1 |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
509 | // Thus, we swap 1 and 3. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
510 | Vertex tmp = vertex (1); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
511 | setVertex (1, vertex (3)); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
512 | setVertex (3, tmp); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
513 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
514 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
515 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
516 | // |
1011
4fdd74a04790
Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1008
diff
changeset
|
517 | void LDSubfileReference::invert() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
518 | { |
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
|
519 | if (model() == nullptr) |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
520 | return; |
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
521 | |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
522 | // Check whether subfile is flat |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
523 | int axisSet = (1 << X) | (1 << Y) | (1 << Z); |
1079
67c6e5d32e68
More rework on model stuff, removals of LDSpawn calls. Most importantly, the LDraw code parsing function was moved to Model.
Teemu Piippo <teemu@hecknology.net>
parents:
1078
diff
changeset
|
524 | Model model {this->model()->documentManager()}; |
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
|
525 | fileInfo()->inlineContents(model, true, false); |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
526 | |
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
|
527 | for (LDObject* obj : model.objects()) |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
528 | { |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
529 | for (int i = 0; i < obj->numVertices(); ++i) |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
530 | { |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
531 | Vertex const& vrt = obj->vertex (i); |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
532 | |
840
d077dd19bf9a
- changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents:
835
diff
changeset
|
533 | if (axisSet & (1 << X) and vrt.x() != 0.0) |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
534 | axisSet &= ~(1 << X); |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
535 | |
840
d077dd19bf9a
- changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents:
835
diff
changeset
|
536 | if (axisSet & (1 << Y) and vrt.y() != 0.0) |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
537 | axisSet &= ~(1 << Y); |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
538 | |
840
d077dd19bf9a
- changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents:
835
diff
changeset
|
539 | if (axisSet & (1 << Z) and vrt.z() != 0.0) |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
540 | axisSet &= ~(1 << Z); |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
541 | } |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
542 | |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
543 | if (axisSet == 0) |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
544 | break; |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
545 | } |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
546 | |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
547 | if (axisSet != 0) |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
548 | { |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
549 | // Subfile has all vertices zero on one specific plane, so it is flat. |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
550 | // Let's flip it. |
1070
292c64cb2a75
Moved the identity matrix constant into Matrix's namespace
Teemu Piippo <teemu@hecknology.net>
parents:
1068
diff
changeset
|
551 | Matrix matrixModifier = Matrix::identity; |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
552 | |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
553 | if (axisSet & (1 << X)) |
1068
283de3bd8b0e
Reworked the Matrix interface so that less index math is involved
Teemu Piippo <teemu@hecknology.net>
parents:
1065
diff
changeset
|
554 | matrixModifier(0, 0) = -1; |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
555 | |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
556 | if (axisSet & (1 << Y)) |
1068
283de3bd8b0e
Reworked the Matrix interface so that less index math is involved
Teemu Piippo <teemu@hecknology.net>
parents:
1065
diff
changeset
|
557 | matrixModifier(1, 1) = -1; |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
558 | |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
559 | if (axisSet & (1 << Z)) |
1068
283de3bd8b0e
Reworked the Matrix interface so that less index math is involved
Teemu Piippo <teemu@hecknology.net>
parents:
1065
diff
changeset
|
560 | matrixModifier(2, 2) = -1; |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
561 | |
1045
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
Teemu Piippo <teemu@hecknology.net>
parents:
1031
diff
changeset
|
562 | setTransformationMatrix (transformationMatrix() * matrixModifier); |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
563 | return; |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
564 | } |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
565 | |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
566 | // Subfile is not flat. Resort to invertnext. |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
567 | int idx = lineNumber(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
568 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
569 | if (idx > 0) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
570 | { |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
571 | LDBfc* bfc = dynamic_cast<LDBfc*> (previous()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
572 | |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
573 | if (bfc and bfc->statement() == BfcStatement::InvertNext) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
574 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
575 | // This is prefixed with an invertnext, thus remove it. |
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
|
576 | this->model()->remove(bfc); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
577 | return; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
578 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
579 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
580 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
581 | // Not inverted, thus prefix it with a new invertnext. |
1081
47cde4087cc5
Made all LDObject constructors protected. Emplacement is now the only way to create objects.
Teemu Piippo <teemu@hecknology.net>
parents:
1080
diff
changeset
|
582 | this->model()->emplaceAt<LDBfc>(idx, BfcStatement::InvertNext); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
583 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
584 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
585 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
586 | // |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
587 | void LDLine::invert() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
588 | { |
775
4661d6e83630
- don't crash when inverting conditional lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
773
diff
changeset
|
589 | // For lines, we swap the vertices. |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
590 | Vertex tmp = vertex (0); |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
591 | setVertex (0, vertex (1)); |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
592 | setVertex (1, tmp); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
593 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
594 | |
775
4661d6e83630
- don't crash when inverting conditional lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
773
diff
changeset
|
595 | // ============================================================================= |
4661d6e83630
- don't crash when inverting conditional lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
773
diff
changeset
|
596 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
597 | void LDCondLine::invert() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
598 | { |
943
af81220741d9
Commit work done on code cleanup
Teemu Piippo <crimsondusk64@gmail.com>
parents:
920
diff
changeset
|
599 | // I don't think that a conditional line's control points need to be swapped, do they? |
775
4661d6e83630
- don't crash when inverting conditional lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
773
diff
changeset
|
600 | Vertex tmp = vertex (0); |
4661d6e83630
- don't crash when inverting conditional lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
773
diff
changeset
|
601 | setVertex (0, vertex (1)); |
4661d6e83630
- don't crash when inverting conditional lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
773
diff
changeset
|
602 | setVertex (1, tmp); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
603 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
604 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
605 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
606 | // |
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:
998
diff
changeset
|
607 | void LDBezierCurve::invert() |
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:
998
diff
changeset
|
608 | { |
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:
998
diff
changeset
|
609 | // A Bézier curve's control points probably need to be, though. |
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:
998
diff
changeset
|
610 | Vertex tmp = vertex (1); |
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:
998
diff
changeset
|
611 | setVertex (1, vertex (0)); |
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:
998
diff
changeset
|
612 | setVertex (0, tmp); |
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:
998
diff
changeset
|
613 | tmp = vertex (3); |
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:
998
diff
changeset
|
614 | setVertex (3, vertex (2)); |
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:
998
diff
changeset
|
615 | setVertex (2, tmp); |
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:
998
diff
changeset
|
616 | } |
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:
998
diff
changeset
|
617 | |
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:
998
diff
changeset
|
618 | // ============================================================================= |
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:
998
diff
changeset
|
619 | // |
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
|
620 | LDLine* LDCondLine::becomeEdgeLine() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
621 | { |
1081
47cde4087cc5
Made all LDObject constructors protected. Emplacement is now the only way to create objects.
Teemu Piippo <teemu@hecknology.net>
parents:
1080
diff
changeset
|
622 | LDLine* replacement = model()->emplaceReplacement<LDLine>(this); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
623 | |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
624 | for (int i = 0; i < replacement->numVertices(); ++i) |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
625 | replacement->setVertex (i, vertex (i)); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
626 | |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
627 | replacement->setColor (color()); |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
628 | return replacement; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
629 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
630 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
631 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
632 | // |
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
|
633 | LDObject* LDObject::fromID(int32 id) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
634 | { |
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
|
635 | return g_allObjects.value(id); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
636 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
637 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
638 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
639 | // |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
640 | void LDObject::setColor (LDColor color) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
641 | { |
1117
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
642 | changeProperty(&m_color, color); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
643 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
644 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
645 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
646 | // |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
647 | // Get a vertex by index |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
648 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
649 | const Vertex& LDObject::vertex (int i) const |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
650 | { |
805
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
651 | return m_coords[i]; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
652 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
653 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
654 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
655 | // |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
656 | // Set a vertex to the given value |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
657 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
658 | void LDObject::setVertex (int i, const Vertex& vert) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
659 | { |
1117
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
660 | changeProperty(&m_coords[i], vert); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
661 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
662 | |
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
|
663 | LDMatrixObject::LDMatrixObject (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
|
664 | LDObject (model), |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
665 | m_position (Origin) {} |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
666 | |
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
|
667 | LDMatrixObject::LDMatrixObject (const Matrix& transform, const Vertex& pos, 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
|
668 | LDObject (model), |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
669 | m_position (pos), |
1045
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
Teemu Piippo <teemu@hecknology.net>
parents:
1031
diff
changeset
|
670 | m_transformationMatrix (transform) {} |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
671 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
672 | void LDMatrixObject::setCoordinate (const Axis ax, double value) |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
673 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
674 | Vertex v = position(); |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
675 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
676 | switch (ax) |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
677 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
678 | case X: v.setX (value); break; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
679 | case Y: v.setY (value); break; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
680 | case Z: v.setZ (value); break; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
681 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
682 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
683 | setPosition (v); |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
684 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
685 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
686 | const Vertex& LDMatrixObject::position() const |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
687 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
688 | return m_position; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
689 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
690 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
691 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
692 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
693 | void LDMatrixObject::setPosition (const Vertex& a) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
694 | { |
1117
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
695 | changeProperty(&m_position, a); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
696 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
697 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
698 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
699 | // |
1045
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
Teemu Piippo <teemu@hecknology.net>
parents:
1031
diff
changeset
|
700 | const Matrix& LDMatrixObject::transformationMatrix() const |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
701 | { |
1045
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
Teemu Piippo <teemu@hecknology.net>
parents:
1031
diff
changeset
|
702 | return m_transformationMatrix; |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
703 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
704 | |
1045
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
Teemu Piippo <teemu@hecknology.net>
parents:
1031
diff
changeset
|
705 | void LDMatrixObject::setTransformationMatrix (const Matrix& val) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
706 | { |
1117
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
707 | changeProperty(&m_transformationMatrix, val); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
708 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
709 | |
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
|
710 | LDError::LDError (QString contents, QString reason, 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
|
711 | LDObject (model), |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
712 | m_contents (contents), |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
713 | m_reason (reason) {} |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
714 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
715 | QString LDError::reason() const |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
716 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
717 | return m_reason; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
718 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
719 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
720 | QString LDError::contents() const |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
721 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
722 | return m_contents; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
723 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
724 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
725 | QString LDError::fileReferenced() const |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
726 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
727 | return m_fileReferenced; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
728 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
729 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
730 | void LDError::setFileReferenced (QString value) |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
731 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
732 | m_fileReferenced = value; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
733 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
734 | |
1078
c72e3115a297
Removed uses of LDSpawn in the algorithm toolset
Teemu Piippo <teemu@hecknology.net>
parents:
1077
diff
changeset
|
735 | LDBfc::LDBfc (const BfcStatement type, Model* model) : |
c72e3115a297
Removed uses of LDSpawn in the algorithm toolset
Teemu Piippo <teemu@hecknology.net>
parents:
1077
diff
changeset
|
736 | LDObject {model}, |
c72e3115a297
Removed uses of LDSpawn in the algorithm toolset
Teemu Piippo <teemu@hecknology.net>
parents:
1077
diff
changeset
|
737 | m_statement {type} {} |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
738 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
739 | BfcStatement LDBfc::statement() const |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
740 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
741 | return m_statement; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
742 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
743 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
744 | void LDBfc::setStatement (BfcStatement value) |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
745 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
746 | m_statement = value; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
747 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
748 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
749 | QString LDBfc::statementToString() const |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
750 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
751 | return LDBfc::statementToString (statement()); |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
752 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
753 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
754 | QString LDBfc::statementToString (BfcStatement statement) |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
755 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
756 | static const char* statementStrings[] = |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
757 | { |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
758 | "CERTIFY CCW", |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
759 | "CCW", |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
760 | "CERTIFY CW", |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
761 | "CW", |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
762 | "NOCERTIFY", |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
763 | "INVERTNEXT", |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
764 | "CLIP", |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
765 | "CLIP CCW", |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
766 | "CLIP CW", |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
767 | "NOCLIP", |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
768 | }; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
769 | |
1065
c8ecddbd99e9
Actually, let's call it countof(). Makes more sense.
Teemu Piippo <teemu@hecknology.net>
parents:
1063
diff
changeset
|
770 | if ((int) statement >= 0 and (int) statement < countof (statementStrings)) |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
771 | return QString::fromLatin1 (statementStrings[(int) statement]); |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
772 | else |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
773 | return ""; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
774 | } |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
775 | |
1002
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
776 | Vertex LDBezierCurve::pointAt (qreal t) const |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
777 | { |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
778 | if (t >= 0.0 and t <= 1.0) |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
779 | { |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
780 | Vertex result; |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
781 | result += pow (1.0 - t, 3) * vertex (0); |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
782 | result += (3 * pow (1.0 - t, 2) * t) * vertex (2); |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
783 | result += (3 * (1.0 - t) * pow (t, 2)) * vertex (3); |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
784 | result += pow (t, 3) * vertex (1); |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
785 | return result; |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
786 | } |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
787 | else |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
788 | return Vertex(); |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
789 | } |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
790 | |
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
|
791 | void LDBezierCurve::rasterize(Model& model, int segments) |
1002
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
792 | { |
1023
9450ac3cd930
Split grid stuff into a new class Grid in grid.cpp/grid.h
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1017
diff
changeset
|
793 | QVector<LDPolygon> polygons = rasterizePolygons(segments); |
1004
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
794 | |
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
795 | for (LDPolygon& poly : polygons) |
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
796 | { |
1080
6dac2d52bd9a
Removed the LDSpawn function and replaced its last use cases.
Teemu Piippo <teemu@hecknology.net>
parents:
1079
diff
changeset
|
797 | LDLine* line = model.emplace<LDLine>(poly.vertices[0], poly.vertices[1]); |
1004
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
798 | line->setColor (poly.color); |
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
799 | } |
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
800 | } |
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
801 | |
1023
9450ac3cd930
Split grid stuff into a new class Grid in grid.cpp/grid.h
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1017
diff
changeset
|
802 | QVector<LDPolygon> LDBezierCurve::rasterizePolygons(int segments) |
1004
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
803 | { |
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
804 | QVector<LDPolygon> result; |
1002
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
805 | QVector<Vertex> parms; |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
806 | parms.append (pointAt (0.0)); |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
807 | |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
808 | for (int i = 1; i < segments; ++i) |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
809 | parms.append (pointAt (double (i) / segments)); |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
810 | |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
811 | parms.append (pointAt (1.0)); |
1004
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
812 | LDPolygon poly; |
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
813 | poly.color = color().index(); |
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
814 | poly.id = id(); |
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
815 | poly.num = 2; |
1002
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
816 | |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
817 | for (int i = 0; i < segments; ++i) |
1003
31873c3cbdbc
Bézier curves are now parsed correctly
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1002
diff
changeset
|
818 | { |
1004
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
819 | poly.vertices[0] = parms[i]; |
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
820 | poly.vertices[1] = parms[i + 1]; |
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1003
diff
changeset
|
821 | result << poly; |
1003
31873c3cbdbc
Bézier curves are now parsed correctly
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1002
diff
changeset
|
822 | } |
1002
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
823 | |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
824 | return result; |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
825 | } |
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
826 | |
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
|
827 | LDSubfileReference::LDSubfileReference(LDDocument* reference, const Matrix& transformationMatrix, |
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
|
828 | const Vertex& position, 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
|
829 | LDMatrixObject {transformationMatrix, position, 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
|
830 | m_fileInfo {reference} {} |
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
|
831 | |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
832 | // ============================================================================= |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
833 | // |
1011
4fdd74a04790
Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1008
diff
changeset
|
834 | LDDocument* LDSubfileReference::fileInfo() const |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
835 | { |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
836 | return m_fileInfo; |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
837 | } |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
838 | |
1015
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
839 | void LDSubfileReference::setFileInfo (LDDocument* newReferee) |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
840 | { |
1117
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
Teemu Piippo <teemu@hecknology.net>
parents:
1103
diff
changeset
|
841 | changeProperty(&m_fileInfo, newReferee); |
1015
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
842 | |
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
|
843 | if (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
|
844 | model()->recountTriangles(); |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
845 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
846 | // If it's an immediate subfile reference (i.e. this subfile is in an opened document), we need to pre-compile the |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
987
diff
changeset
|
847 | // GL polygons for the document if they don't exist already. |
1015
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
848 | if (newReferee and |
1090
ed73c4f48ca4
The current document pointer may no longer be null.
Teemu Piippo <teemu@hecknology.net>
parents:
1086
diff
changeset
|
849 | newReferee->isFrozen() == false and |
1015
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
850 | newReferee->polygonData().isEmpty()) |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
851 | { |
1015
92c6ec099075
Added triangle count to viewport, added compile-time line length check
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
852 | newReferee->initializeCachedData(); |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
853 | } |
1084
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
854 | } |
725
37b71daf4cb5
- added ability to draw with random colors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
724
diff
changeset
|
855 | |
1031
55c0d3beea0d
removed removeDuplicates in favor of QSet, and the unused ObjectList class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1028
diff
changeset
|
856 | void LDObject::getVertices (QSet<Vertex>& verts) const |
835
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
857 | { |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
858 | for (int i = 0; i < numVertices(); ++i) |
1031
55c0d3beea0d
removed removeDuplicates in favor of QSet, and the unused ObjectList class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1028
diff
changeset
|
859 | verts.insert(vertex(i)); |
835
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
860 | } |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
861 | |
1031
55c0d3beea0d
removed removeDuplicates in favor of QSet, and the unused ObjectList class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1028
diff
changeset
|
862 | void LDSubfileReference::getVertices (QSet<Vertex>& verts) const |
835
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
863 | { |
1031
55c0d3beea0d
removed removeDuplicates in favor of QSet, and the unused ObjectList class
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1028
diff
changeset
|
864 | verts.unite(fileInfo()->inlineVertices()); |
1045
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
Teemu Piippo <teemu@hecknology.net>
parents:
1031
diff
changeset
|
865 | } |
1084
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
866 | |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
867 | QString LDObject::objectListText() const |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
868 | { |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
869 | if (numVertices() > 0) |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
870 | { |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
871 | QString result; |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
872 | |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
873 | for (int i = 0; i < numVertices(); ++i) |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
874 | { |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
875 | if (i != 0) |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
876 | result += ", "; |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
877 | |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
878 | result += vertex(i).toString (true); |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
879 | } |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
880 | |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
881 | return result; |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
882 | } |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
883 | else |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
884 | { |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
885 | return typeName(); |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
886 | } |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
887 | } |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
888 | |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
889 | QString LDError::objectListText() const |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
890 | { |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
891 | return "ERROR: " + asText(); |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
892 | } |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
893 | |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
894 | QString LDSubfileReference::objectListText() const |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
895 | { |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
896 | QString result = format ("%1 %2, (", fileInfo()->getDisplayName(), position().toString(true)); |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
897 | |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
898 | for (int i = 0; i < 9; ++i) |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
899 | result += format("%1%2", transformationMatrix().value(i), (i != 8) ? " " : ""); |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
900 | |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
901 | result += ')'; |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
902 | return result; |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
903 | } |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
904 | |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
905 | QString LDBfc::objectListText() const |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
906 | { |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
907 | return statementToString(); |
63daaf652454
Split object list representation into virtual methods
Teemu Piippo <teemu@hecknology.net>
parents:
1082
diff
changeset
|
908 | } |