225 reset(); |
225 reset(); |
226 |
226 |
227 if (CurrentDocument() == null) |
227 if (CurrentDocument() == null) |
228 return; |
228 return; |
229 |
229 |
230 for (LDObjectPtr obj : CurrentDocument()->objects()) |
230 for (LDObject* obj : CurrentDocument()->objects()) |
231 calcObject (obj); |
231 calcObject (obj); |
232 } |
232 } |
233 |
233 |
234 // ============================================================================= |
234 // ============================================================================= |
235 // |
235 // |
236 void LDBoundingBox::calcObject (LDObjectPtr obj) |
236 void LDBoundingBox::calcObject (LDObject* obj) |
237 { |
237 { |
238 switch (obj->type()) |
238 switch (obj->type()) |
239 { |
239 { |
240 case OBJ_Line: |
240 case OBJ_Line: |
241 case OBJ_Triangle: |
241 case OBJ_Triangle: |
242 case OBJ_Quad: |
242 case OBJ_Quad: |
243 case OBJ_CondLine: |
243 case OBJ_CondLine: |
244 { |
|
245 for (int i = 0; i < obj->numVertices(); ++i) |
244 for (int i = 0; i < obj->numVertices(); ++i) |
246 calcVertex (obj->vertex (i)); |
245 calcVertex (obj->vertex (i)); |
247 } break; |
246 break; |
248 |
247 |
249 case OBJ_Subfile: |
248 case OBJ_Subfile: |
250 { |
249 for (LDObject* obj : static_cast<LDSubfile*> (obj)->inlineContents (true, false)) |
251 LDSubfilePtr ref = obj.staticCast<LDSubfile>(); |
|
252 LDObjectList objs = ref->inlineContents (true, false); |
|
253 |
|
254 for (LDObjectPtr obj : objs) |
|
255 { |
250 { |
256 calcObject (obj); |
251 calcObject (obj); |
257 obj->destroy(); |
252 obj->destroy(); |
258 } |
253 } |
259 } |
254 break; |
260 break; |
|
261 |
255 |
262 default: |
256 default: |
263 break; |
257 break; |
264 } |
258 } |
265 } |
259 } |