src/ldObject.cpp

changeset 1100
9b2797729c82
parent 1090
ed73c4f48ca4
child 1103
ac7db4c076c3
equal deleted inserted replaced
1099:14276e435640 1100:9b2797729c82
71 LDOBJ_DEFAULT_CTOR (LDError, LDObject) 71 LDOBJ_DEFAULT_CTOR (LDError, LDObject)
72 LDOBJ_DEFAULT_CTOR (LDLine, LDObject) 72 LDOBJ_DEFAULT_CTOR (LDLine, LDObject)
73 LDOBJ_DEFAULT_CTOR (LDTriangle, LDObject) 73 LDOBJ_DEFAULT_CTOR (LDTriangle, LDObject)
74 LDOBJ_DEFAULT_CTOR (LDCondLine, LDLine) 74 LDOBJ_DEFAULT_CTOR (LDCondLine, LDLine)
75 LDOBJ_DEFAULT_CTOR (LDQuad, LDObject) 75 LDOBJ_DEFAULT_CTOR (LDQuad, LDObject)
76 LDOBJ_DEFAULT_CTOR (LDOverlay, LDObject)
77 LDOBJ_DEFAULT_CTOR (LDBfc, LDObject) 76 LDOBJ_DEFAULT_CTOR (LDBfc, LDObject)
78 LDOBJ_DEFAULT_CTOR (LDComment, LDObject) 77 LDOBJ_DEFAULT_CTOR (LDComment, LDObject)
79 LDOBJ_DEFAULT_CTOR (LDBezierCurve, LDObject) 78 LDOBJ_DEFAULT_CTOR (LDBezierCurve, LDObject)
80 79
81 LDObject::~LDObject() 80 LDObject::~LDObject()
629 return g_allObjects.value(id); 628 return g_allObjects.value(id);
630 } 629 }
631 630
632 // ============================================================================= 631 // =============================================================================
633 // 632 //
634 QString LDOverlay::asText() const
635 {
636 return format ("0 !LDFORGE OVERLAY %1 %2 %3 %4 %5 %6",
637 fileName(), camera(), x(), y(), width(), height());
638 }
639
640 void LDOverlay::invert() {}
641
642 // =============================================================================
643 //
644 // Hook the set accessors of certain properties to this changeProperty function. 633 // Hook the set accessors of certain properties to this changeProperty function.
645 // It takes care of history management so we can capture low-level changes, this 634 // It takes care of history management so we can capture low-level changes, this
646 // makes history stuff work out of the box. 635 // makes history stuff work out of the box.
647 // 636 //
648 template<typename T> 637 template<typename T>
815 return QString::fromLatin1 (statementStrings[(int) statement]); 804 return QString::fromLatin1 (statementStrings[(int) statement]);
816 else 805 else
817 return ""; 806 return "";
818 } 807 }
819 808
820 int LDOverlay::camera() const
821 {
822 return m_camera;
823 }
824
825 void LDOverlay::setCamera (int value)
826 {
827 m_camera = value;
828 }
829
830 int LDOverlay::x() const
831 {
832 return m_x;
833 }
834
835 void LDOverlay::setX (int value)
836 {
837 m_x = value;
838 }
839
840 int LDOverlay::y() const
841 {
842 return m_y;
843 }
844
845 void LDOverlay::setY (int value)
846 {
847 m_y = value;
848 }
849
850 int LDOverlay::width() const
851 {
852 return m_width;
853 }
854
855 void LDOverlay::setWidth (int value)
856 {
857 m_width = value;
858 }
859
860 int LDOverlay::height() const
861 {
862 return m_height;
863 }
864
865 void LDOverlay::setHeight (int value)
866 {
867 m_height = value;
868 }
869
870 QString LDOverlay::fileName() const
871 {
872 return m_fileName;
873 }
874
875 void LDOverlay::setFileName (QString value)
876 {
877 m_fileName = value;
878 }
879
880 Vertex LDBezierCurve::pointAt (qreal t) const 809 Vertex LDBezierCurve::pointAt (qreal t) const
881 { 810 {
882 if (t >= 0.0 and t <= 1.0) 811 if (t >= 0.0 and t <= 1.0)
883 { 812 {
884 Vertex result; 813 Vertex result;
1009 938
1010 result += ')'; 939 result += ')';
1011 return result; 940 return result;
1012 } 941 }
1013 942
1014 QString LDOverlay::objectListText() const
1015 {
1016 return format("[%1] %2 (%3, %4), %5 x %6", static_cast<int>(camera()), Basename(fileName()), x(), y(), width(), height());
1017 }
1018
1019 QString LDComment::objectListText() const 943 QString LDComment::objectListText() const
1020 { 944 {
1021 return text().simplified(); 945 return text().simplified();
1022 } 946 }
1023 947

mercurial