Sat, 23 Jul 2022 01:38:06 +0300
Add SIG macro
264
76a025db4948
Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
262
diff
changeset
|
1 | #include "src/ldrawalgorithm.h" |
154 | 2 | |
200 | 3 | std::pair<Triangle, Triangle> splitTriangles( |
4 | const Quadrilateral& q, | |
5 | ldraw::Diagonal diagonal) | |
154 | 6 | { |
200 | 7 | std::pair<Triangle, Triangle> result; |
154 | 8 | switch (diagonal) |
9 | { | |
10 | case ldraw::Diagonal::Diagonal_13: | |
200 | 11 | result = {Triangle{q.p1, q.p2, q.p3}, {q.p1, q.p3, q.p4}}; |
154 | 12 | break; |
13 | case ldraw::Diagonal::Diagonal_24: | |
200 | 14 | result = {Triangle{q.p1, q.p2, q.p3}, {q.p2, q.p3, q.p4}}; |
154 | 15 | break; |
16 | } | |
17 | return result; | |
18 | } | |
19 | ||
262
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
248
diff
changeset
|
20 | std::vector<ModelAction> ldraw::makeUnofficial(const Model* model) |
154 | 21 | { |
262
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
248
diff
changeset
|
22 | std::vector<ModelAction> actions; |
333
07e65a4c6611
Experiment to delete the Model class and rely solely on text documents
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
23 | #if 0 |
262
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
248
diff
changeset
|
24 | if (model->size() >= 4) { |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
248
diff
changeset
|
25 | if (const Comment* comment = std::get_if<Comment>(&(*model)[3])) { |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
248
diff
changeset
|
26 | const QString& body = comment->text; |
154 | 27 | if (body.startsWith("!LDRAW_ORG ") and not body.startsWith("!LDRAW_ORG Unofficial_")) |
28 | { | |
29 | // Add Unofficial_ to part type | |
30 | QStringList tokens = body.split(" "); | |
31 | tokens[1] = "Unofficial_" + tokens[1]; | |
32 | // Remove the UPDATE tag if it's there | |
33 | if (tokens.size() >= 4 && tokens[2] == "UPDATE") | |
34 | { | |
35 | tokens.removeAt(3); | |
36 | tokens.removeAt(2); | |
37 | } | |
262
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
248
diff
changeset
|
38 | actions.push_back(ModifyModel{ |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
248
diff
changeset
|
39 | .position = 3, |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
248
diff
changeset
|
40 | .newElement = Comment{.text = tokens.join(" ")} |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
248
diff
changeset
|
41 | }); |
154 | 42 | } |
43 | } | |
44 | } | |
333
07e65a4c6611
Experiment to delete the Model class and rely solely on text documents
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
45 | #endif |
262
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
248
diff
changeset
|
46 | return actions; |
200 | 47 | } |