src/ldrawalgorithm.cpp

changeset 333
07e65a4c6611
parent 264
76a025db4948
child 336
e07425ac5834
equal deleted inserted replaced
332:ae7f7fbb9cda 333:07e65a4c6611
18 } 18 }
19 19
20 std::vector<ModelAction> ldraw::makeUnofficial(const Model* model) 20 std::vector<ModelAction> ldraw::makeUnofficial(const Model* model)
21 { 21 {
22 std::vector<ModelAction> actions; 22 std::vector<ModelAction> actions;
23 #if 0
23 if (model->size() >= 4) { 24 if (model->size() >= 4) {
24 if (const Comment* comment = std::get_if<Comment>(&(*model)[3])) { 25 if (const Comment* comment = std::get_if<Comment>(&(*model)[3])) {
25 const QString& body = comment->text; 26 const QString& body = comment->text;
26 if (body.startsWith("!LDRAW_ORG ") and not body.startsWith("!LDRAW_ORG Unofficial_")) 27 if (body.startsWith("!LDRAW_ORG ") and not body.startsWith("!LDRAW_ORG Unofficial_"))
27 { 28 {
39 .newElement = Comment{.text = tokens.join(" ")} 40 .newElement = Comment{.text = tokens.join(" ")}
40 }); 41 });
41 } 42 }
42 } 43 }
43 } 44 }
45 #endif
44 return actions; 46 return actions;
45 } 47 }
46
47 ModelElement inverted(const ModelElement& element)
48 {
49 return std::visit(overloaded{
50 [](Colored<SubfileReference> ref) -> ModelElement {
51 ref.inverted = not ref.inverted;
52 return ref;
53 },
54 [](Colored<CircularPrimitive> circ) -> ModelElement {
55 circ.inverted = not circ.inverted;
56 return circ;
57 },
58 [](Colored<Triangle> triangle) -> ModelElement {
59 std::swap(triangle.p1, triangle.p2);
60 return triangle;
61 },
62 [](Colored<Quadrilateral> quad) -> ModelElement {
63 std::swap(quad.p2, quad.p4);
64 return quad;
65 },
66 [](const ModelElement& x) { return x; }
67 }, element);
68 }

mercurial