300 return model()->getObject(lineNumber() - 1); |
300 return model()->getObject(lineNumber() - 1); |
301 } |
301 } |
302 |
302 |
303 // ============================================================================= |
303 // ============================================================================= |
304 // |
304 // |
305 // Is the previous object INVERTNEXT? |
|
306 // |
|
307 bool LDObject::previousIsInvertnext (LDBfc*& ptr) |
|
308 { |
|
309 LDObject* prev = previous(); |
|
310 |
|
311 if (prev and prev->type() == LDObjectType::Bfc and static_cast<LDBfc*> (prev)->statement() == BfcStatement::InvertNext) |
|
312 { |
|
313 ptr = static_cast<LDBfc*> (prev); |
|
314 return true; |
|
315 } |
|
316 |
|
317 return false; |
|
318 } |
|
319 |
|
320 // ============================================================================= |
|
321 // |
|
322 // Moves this object using the given vertex as a movement List |
305 // Moves this object using the given vertex as a movement List |
323 // |
306 // |
324 void LDObject::move (Vertex vect) |
307 void LDObject::move (Vertex vect) |
325 { |
308 { |
326 if (hasMatrix()) |
309 if (hasMatrix()) |
426 setTransformationMatrix (transformationMatrix() * matrixModifier); |
409 setTransformationMatrix (transformationMatrix() * matrixModifier); |
427 return; |
410 return; |
428 } |
411 } |
429 |
412 |
430 // Subfile is not flat. Resort to invertnext. |
413 // Subfile is not flat. Resort to invertnext. |
431 int idx = lineNumber(); |
414 setInverted(not this->isInverted()); |
432 |
|
433 if (idx > 0) |
|
434 { |
|
435 LDBfc* bfc = dynamic_cast<LDBfc*> (previous()); |
|
436 |
|
437 if (bfc and bfc->statement() == BfcStatement::InvertNext) |
|
438 { |
|
439 // This is prefixed with an invertnext, thus remove it. |
|
440 this->model()->remove(bfc); |
|
441 return; |
|
442 } |
|
443 } |
|
444 |
|
445 // Not inverted, thus prefix it with a new invertnext. |
|
446 this->model()->emplaceAt<LDBfc>(idx, BfcStatement::InvertNext); |
|
447 } |
415 } |
448 |
416 |
449 // ============================================================================= |
417 // ============================================================================= |
450 // |
418 // |
451 void LDBezierCurve::invert() |
419 void LDBezierCurve::invert() |