104 else if (text == QStringLiteral("BFC NOCERTIFY")) { |
104 else if (text == QStringLiteral("BFC NOCERTIFY")) { |
105 winding = NoWinding; |
105 winding = NoWinding; |
106 } |
106 } |
107 }, |
107 }, |
108 [&](const LineType2& line2) { |
108 [&](const LineType2& line2) { |
109 add({line2.value, line2.value.color}); |
109 add(2, {line2.value, line2.value.color}); |
110 }, |
110 }, |
111 [&](const LineType3& line3) { |
111 [&](const LineType3& line3) { |
112 add({line3.value, line3.value.color}); |
112 add(3, {line3.value, line3.value.color}); |
113 }, |
113 }, |
114 [&](const LineType4& line4) { |
114 [&](const LineType4& line4) { |
115 add({line4.value, line4.value.color}); |
115 add(4, {line4.value, line4.value.color}); |
116 }, |
116 }, |
117 [&](const LineType5& line5) { |
117 [&](const LineType5& line5) { |
118 add({line5.value, line5.value.color}); |
118 add(5, {line5.value, line5.value.color}); |
119 }, |
119 }, |
120 [&add, context, &reserve](const LineType1& line1) { |
120 [&add, context, &reserve](const LineType1& line1) { |
121 QTextDocument* const dependency = findDependency(line1.value, context); |
121 QTextDocument* const dependency = findDependency(line1.value, context); |
122 if (PolygonCache* cache = (dependency != nullptr) |
122 if (PolygonCache* cache = (dependency != nullptr) |
123 ? findPolygonCacheForModel(dependency, context->documents) |
123 ? findPolygonCacheForModel(dependency, context->documents) |
148 GetPolygonsContext* context) |
148 GetPolygonsContext* context) |
149 { |
149 { |
150 Winding winding = NoWinding; |
150 Winding winding = NoWinding; |
151 std::vector<WithId<PolygonElement>> result; |
151 std::vector<WithId<PolygonElement>> result; |
152 int i = 0; |
152 int i = 0; |
153 const auto add = [&result, winding, i](const PolygonElement& poly){ |
153 const auto add = [&result, &winding, &i](int lineno, const PolygonElement& poly){ |
154 result.push_back({poly, i}); |
154 result.push_back({poly, i}); |
155 if (winding == Winding::Clockwise) { |
155 if (lineno != 1 and winding == Winding::Clockwise) { |
156 gl::invert(result.back()); |
156 gl::invert(result.back()); |
157 } |
157 } |
158 }; |
158 }; |
159 const auto reserve = [&result](std::size_t incomingsize){ |
159 const auto reserve = [&result](std::size_t incomingsize){ |
160 reserveMore(result, incomingsize); |
160 reserveMore(result, incomingsize); |