ldtypes.cpp

changeset 76
42284126072a
parent 75
e95a00e34711
child 84
c9438ea54ed9
equal deleted inserted replaced
75:e95a00e34711 76:42284126072a
274 { 274 {
275 switch (obj->getType()) { 275 switch (obj->getType()) {
276 case OBJ_Line: 276 case OBJ_Line:
277 transformSubObject<LDLine> (obj, mMatrix, vPos, dColor); 277 transformSubObject<LDLine> (obj, mMatrix, vPos, dColor);
278 break; 278 break;
279
279 case OBJ_CondLine: 280 case OBJ_CondLine:
280 transformSubObject<LDCondLine> (obj, mMatrix, vPos, dColor); 281 transformSubObject<LDCondLine> (obj, mMatrix, vPos, dColor);
281 break; 282 break;
283
282 case OBJ_Triangle: 284 case OBJ_Triangle:
283 transformSubObject<LDTriangle> (obj, mMatrix, vPos, dColor); 285 transformSubObject<LDTriangle> (obj, mMatrix, vPos, dColor);
284 break; 286 break;
287
285 case OBJ_Quad: 288 case OBJ_Quad:
286 transformSubObject<LDQuad> (obj, mMatrix, vPos, dColor); 289 transformSubObject<LDQuad> (obj, mMatrix, vPos, dColor);
287 break; 290 break;
291
288 case OBJ_Subfile: 292 case OBJ_Subfile:
289 { 293 {
290 LDSubfile* ref = static_cast<LDSubfile*> (obj); 294 LDSubfile* ref = static_cast<LDSubfile*> (obj);
291 295
292 matrix mNewMatrix = mMatrix * ref->mMatrix; 296 matrix mNewMatrix = mMatrix * ref->mMatrix;
293 ref->vPosition.transform (mMatrix, vPos); 297 ref->vPosition.transform (mMatrix, vPos);
294 ref->mMatrix = mNewMatrix; 298 ref->mMatrix = mNewMatrix;
295 } 299 }
296 300
297 break; 301 break;
302
298 default: 303 default:
299 break; 304 break;
300 } 305 }
301 } 306 }
302 307
307 vector<LDObject*> objs, cache; 312 vector<LDObject*> objs, cache;
308 313
309 // If we have this cached, just clone that 314 // If we have this cached, just clone that
310 if (bDeepInline && pFile->objCache.size ()) { 315 if (bDeepInline && pFile->objCache.size ()) {
311 for (LDObject* obj : pFile->objCache) 316 for (LDObject* obj : pFile->objCache)
312 objs.push_back (obj->makeClone ()); 317 objs.push_back (obj->clone ());
313 } else { 318 } else {
314 if (!bDeepInline) 319 if (!bDeepInline)
315 bCache = false; 320 bCache = false;
316 321
317 for (LDObject* obj : pFile->objects) { 322 for (LDObject* obj : pFile->objects) {
341 LDSubfile* ref = static_cast<LDSubfile*> (obj); 346 LDSubfile* ref = static_cast<LDSubfile*> (obj);
342 347
343 vector<LDObject*> otherobjs = ref->inlineContents (true, false); 348 vector<LDObject*> otherobjs = ref->inlineContents (true, false);
344 349
345 for (LDObject* otherobj : otherobjs) { 350 for (LDObject* otherobj : otherobjs) {
346 // Cache this object if desired 351 // Cache this object, if desired
347 if (bCache) 352 if (bCache)
348 cache.push_back (otherobj->makeClone ()); 353 cache.push_back (otherobj->clone ());
349 354
350 objs.push_back (otherobj); 355 objs.push_back (otherobj);
351 } 356 }
352 } else { 357 } else {
353 // Cache it, if desired
354 if (bCache) 358 if (bCache)
355 cache.push_back (obj->makeClone ()); 359 cache.push_back (obj->clone ());
356 360
357 objs.push_back (obj->makeClone ()); 361 objs.push_back (obj->clone ());
358 } 362 }
359 } 363 }
360 364
361 if (bCache) 365 if (bCache)
362 pFile->objCache = cache; 366 pFile->objCache = cache;

mercurial