222 } |
222 } |
223 |
223 |
224 template<typename Fn> |
224 template<typename Fn> |
225 void iterateModelPolygons(Model* model, DocumentManager* context, Fn&& fn) |
225 void iterateModelPolygons(Model* model, DocumentManager* context, Fn&& fn) |
226 { |
226 { |
227 PolygonCache* cache = findPolygonCacheForModel(model, context); |
227 PolygonCache* const cache = findPolygonCacheForModel(model, context); |
228 if (cache != nullptr) { |
228 if (cache != nullptr) { |
229 const PolygonCache::vector_type* polygons = getCachedPolygons(cache, model, context); |
229 recacheIfNeeded(cache, model, context); |
230 for (const WithId<PolygonElement>& polygon : *polygons) { |
230 for (const WithId<PolygonElement>& polygon : cache->polygons) { |
231 fn(polygon); |
231 fn(polygon); |
232 } |
232 } |
233 } |
233 } |
234 } |
234 } |
235 |
235 |