833 |
834 |
834 // ============================================================================= |
835 // ============================================================================= |
835 // |
836 // |
836 void LDObject::setVertex (int i, const Vertex& vert) |
837 void LDObject::setVertex (int i, const Vertex& vert) |
837 { |
838 { |
838 if (document() != null) |
|
839 document().toStrongRef()->vertexChanged (m_coords[i], vert); |
|
840 |
|
841 changeProperty (self(), &m_coords[i], vert); |
839 changeProperty (self(), &m_coords[i], vert); |
842 } |
840 } |
843 |
841 |
844 // ============================================================================= |
842 // ============================================================================= |
845 // |
843 // |
846 void LDMatrixObject::setPosition (const Vertex& a) |
844 void LDMatrixObject::setPosition (const Vertex& a) |
847 { |
845 { |
848 LDObjectPtr ref = linkPointer().toStrongRef(); |
846 LDObjectPtr ref = linkPointer().toStrongRef(); |
849 |
|
850 if (ref->document() != null) |
|
851 ref->document().toStrongRef()->removeKnownVerticesOf (ref); |
|
852 |
|
853 changeProperty (ref, &m_position, a); |
847 changeProperty (ref, &m_position, a); |
854 |
|
855 if (ref->document() != null) |
|
856 ref->document().toStrongRef()->addKnownVerticesOf (ref); |
|
857 } |
848 } |
858 |
849 |
859 // ============================================================================= |
850 // ============================================================================= |
860 // |
851 // |
861 void LDMatrixObject::setTransform (const Matrix& val) |
852 void LDMatrixObject::setTransform (const Matrix& val) |
862 { |
853 { |
863 LDObjectPtr ref = linkPointer().toStrongRef(); |
854 LDObjectPtr ref = linkPointer().toStrongRef(); |
864 |
|
865 if (ref->document() != null) |
|
866 ref->document().toStrongRef()->removeKnownVerticesOf (ref); |
|
867 |
|
868 changeProperty (ref, &m_transform, val); |
855 changeProperty (ref, &m_transform, val); |
869 |
|
870 if (ref->document() != null) |
|
871 ref->document().toStrongRef()->addKnownVerticesOf (ref); |
|
872 } |
856 } |
873 |
857 |
874 // ============================================================================= |
858 // ============================================================================= |
875 // |
859 // |
876 void LDObject::select() |
860 void LDObject::select() |
929 |
913 |
930 // ============================================================================= |
914 // ============================================================================= |
931 // |
915 // |
932 void LDSubfile::setFileInfo (const LDDocumentPtr& a) |
916 void LDSubfile::setFileInfo (const LDDocumentPtr& a) |
933 { |
917 { |
934 if (document() != null) |
|
935 document().toStrongRef()->removeKnownVerticesOf (self()); |
|
936 |
|
937 m_fileInfo = a; |
918 m_fileInfo = a; |
938 |
919 |
939 // If it's an immediate subfile reference (i.e. this subfile belongs in an |
920 // If it's an immediate subfile reference (i.e. this subfile belongs in an |
940 // explicit file), we need to pre-compile the GL polygons for the document |
921 // explicit file), we need to pre-compile the GL polygons for the document |
941 // if they don't exist already. |
922 // if they don't exist already. |
943 a->isImplicit() == false && |
924 a->isImplicit() == false && |
944 a->polygonData().isEmpty()) |
925 a->polygonData().isEmpty()) |
945 { |
926 { |
946 a->initializeCachedData(); |
927 a->initializeCachedData(); |
947 } |
928 } |
948 |
|
949 if (document() != null) |
|
950 document().toStrongRef()->addKnownVerticesOf (self()); |
|
951 }; |
929 }; |
|
930 |
|
931 void LDObject::getVertices (QVector<Vertex>& verts) const |
|
932 { |
|
933 for (int i = 0; i < numVertices(); ++i) |
|
934 verts << vertex (i); |
|
935 } |
|
936 |
|
937 void LDSubfile::getVertices (QVector<Vertex>& verts) const |
|
938 { |
|
939 verts << fileInfo()->inlineVertices(); |
|
940 } |
|
941 |
|
942 void LDVertex::getVertices (QVector<Vertex>& verts) const |
|
943 { |
|
944 verts.append (pos); |
|
945 } |