216 void iterateModelPolygons(Model* model, DocumentManager* context, Fn&& fn) |
216 void iterateModelPolygons(Model* model, DocumentManager* context, Fn&& fn) |
217 { |
217 { |
218 std::optional<ModelId> modelId = context->findIdForModel(model); |
218 std::optional<ModelId> modelId = context->findIdForModel(model); |
219 if (modelId.has_value()) |
219 if (modelId.has_value()) |
220 { |
220 { |
221 PolygonCache* polygonCache= context->getPolygonCacheForModel(modelId.value()); |
221 PolygonCache* cache = context->getPolygonCacheForModel(modelId.value()); |
222 if (polygonCache != nullptr) |
222 if (cache != nullptr) |
223 { |
223 { |
224 for (const gl::Polygon& polygon : polygonCache->getPolygons(context)) |
224 for (const gl::Polygon& polygon : getCachedPolygons(cache, model, context)) |
225 { |
225 { |
226 fn(polygon); |
226 fn(polygon); |
227 } |
227 } |
228 } |
228 } |
229 } |
229 } |