322 return new LDEdgeLine {}; |
315 return new LDEdgeLine {}; |
323 |
316 |
324 case LDObjectType::ConditionalEdge: |
317 case LDObjectType::ConditionalEdge: |
325 return new LDConditionalEdge {}; |
318 return new LDConditionalEdge {}; |
326 |
319 |
327 case LDObjectType::Bfc: |
|
328 return new LDBfc {}; |
|
329 |
|
330 case LDObjectType::Comment: |
320 case LDObjectType::Comment: |
331 return new LDComment {}; |
321 return new LDComment {}; |
332 |
322 |
333 case LDObjectType::Error: |
323 case LDObjectType::Error: |
334 return new LDError {}; |
324 return new LDError {}; |
426 } |
416 } |
427 |
417 |
428 QString LDError::contents() const |
418 QString LDError::contents() const |
429 { |
419 { |
430 return m_contents; |
420 return m_contents; |
431 } |
|
432 |
|
433 LDBfc::LDBfc (const BfcStatement type) : |
|
434 m_statement {type} {} |
|
435 |
|
436 BfcStatement LDBfc::statement() const |
|
437 { |
|
438 return m_statement; |
|
439 } |
|
440 |
|
441 void LDBfc::setStatement (BfcStatement value) |
|
442 { |
|
443 m_statement = value; |
|
444 } |
|
445 |
|
446 QString LDBfc::statementToString() const |
|
447 { |
|
448 return LDBfc::statementToString (statement()); |
|
449 } |
|
450 |
|
451 QString LDBfc::statementToString (BfcStatement statement) |
|
452 { |
|
453 static const char* statementStrings[] = |
|
454 { |
|
455 "CERTIFY CCW", |
|
456 "CCW", |
|
457 "CERTIFY CW", |
|
458 "CW", |
|
459 "NOCERTIFY", |
|
460 "INVERTNEXT", |
|
461 "CLIP", |
|
462 "CLIP CCW", |
|
463 "CLIP CW", |
|
464 "NOCLIP", |
|
465 }; |
|
466 |
|
467 if ((int) statement >= 0 and (int) statement < countof (statementStrings)) |
|
468 return QString::fromLatin1 (statementStrings[(int) statement]); |
|
469 else |
|
470 return ""; |
|
471 } |
421 } |
472 |
422 |
473 Vertex LDBezierCurve::pointAt (qreal t) const |
423 Vertex LDBezierCurve::pointAt (qreal t) const |
474 { |
424 { |
475 if (t >= 0.0 and t <= 1.0) |
425 if (t >= 0.0 and t <= 1.0) |
585 for (int i = 0; i < 9; ++i) |
535 for (int i = 0; i < 9; ++i) |
586 result += format("%1%2", transformationMatrix().value(i), (i != 8) ? " " : ""); |
536 result += format("%1%2", transformationMatrix().value(i), (i != 8) ? " " : ""); |
587 |
537 |
588 result += ')'; |
538 result += ')'; |
589 return result; |
539 return result; |
590 } |
|
591 |
|
592 QString LDBfc::objectListText() const |
|
593 { |
|
594 return statementToString(); |
|
595 } |
540 } |
596 |
541 |
597 bool LDObject::isInverted() const |
542 bool LDObject::isInverted() const |
598 { |
543 { |
599 return m_hasInvertNext; |
544 return m_hasInvertNext; |
621 LDObject::serialize(serializer); |
566 LDObject::serialize(serializer); |
622 serializer << m_position; |
567 serializer << m_position; |
623 serializer << m_transformationMatrix; |
568 serializer << m_transformationMatrix; |
624 } |
569 } |
625 |
570 |
626 void LDBfc::serialize(Serializer& serializer) |
|
627 { |
|
628 LDObject::serialize(serializer); |
|
629 serializer << m_statement; |
|
630 } |
|
631 |
|
632 void LDError::serialize(Serializer& serializer) |
571 void LDError::serialize(Serializer& serializer) |
633 { |
572 { |
634 LDObject::serialize(serializer); |
573 LDObject::serialize(serializer); |
635 serializer << m_contents; |
574 serializer << m_contents; |
636 serializer << m_reason; |
575 serializer << m_reason; |