src/ldObject.cpp

changeset 1045
f726f8f49c7e
parent 1031
55c0d3beea0d
child 1062
4119185b56ca
equal deleted inserted replaced
1044:b5106ca8705e 1045:f726f8f49c7e
97 // ============================================================================= 97 // =============================================================================
98 // 98 //
99 QString LDSubfileReference::asText() const 99 QString LDSubfileReference::asText() const
100 { 100 {
101 QString val = format ("1 %1 %2 ", color(), position()); 101 QString val = format ("1 %1 %2 ", color(), position());
102 val += transform().toString(); 102 val += transformationMatrix().toString();
103 val += ' '; 103 val += ' ';
104 val += fileInfo()->name(); 104 val += fileInfo()->name();
105 return val; 105 return val;
106 } 106 }
107 107
372 break; 372 break;
373 373
374 case OBJ_SubfileReference: 374 case OBJ_SubfileReference:
375 { 375 {
376 LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj); 376 LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj);
377 Matrix newMatrix = transform * ref->transform(); 377 Matrix newMatrix = transform * ref->transformationMatrix();
378 Vertex newpos = ref->position(); 378 Vertex newpos = ref->position();
379 newpos.transform (transform, pos); 379 newpos.transform (transform, pos);
380 ref->setPosition (newpos); 380 ref->setPosition (newpos);
381 ref->setTransform (newMatrix); 381 ref->setTransformationMatrix (newMatrix);
382 } 382 }
383 break; 383 break;
384 384
385 default: 385 default:
386 break; 386 break;
396 { 396 {
397 LDObjectList objs = fileInfo()->inlineContents (deep, render); 397 LDObjectList objs = fileInfo()->inlineContents (deep, render);
398 398
399 // Transform the objects 399 // Transform the objects
400 for (LDObject* obj : objs) 400 for (LDObject* obj : objs)
401 TransformObject (obj, transform(), position(), color()); 401 TransformObject (obj, transformationMatrix(), position(), color());
402 402
403 return objs; 403 return objs;
404 } 404 }
405 405
406 // ============================================================================= 406 // =============================================================================
435 QList<LDPolygon> data = fileInfo()->inlinePolygons(); 435 QList<LDPolygon> data = fileInfo()->inlinePolygons();
436 436
437 for (LDPolygon& entry : data) 437 for (LDPolygon& entry : data)
438 { 438 {
439 for (int i = 0; i < entry.numVertices(); ++i) 439 for (int i = 0; i < entry.numVertices(); ++i)
440 entry.vertices[i].transform (transform(), position()); 440 entry.vertices[i].transform (transformationMatrix(), position());
441 } 441 }
442 442
443 return data; 443 return data;
444 } 444 }
445 445
708 matrixModifier[4] = -1; 708 matrixModifier[4] = -1;
709 709
710 if (axisSet & (1 << Z)) 710 if (axisSet & (1 << Z))
711 matrixModifier[8] = -1; 711 matrixModifier[8] = -1;
712 712
713 setTransform (transform() * matrixModifier); 713 setTransformationMatrix (transformationMatrix() * matrixModifier);
714 return; 714 return;
715 } 715 }
716 716
717 // Subfile is not flat. Resort to invertnext. 717 // Subfile is not flat. Resort to invertnext.
718 int idx = lineNumber(); 718 int idx = lineNumber();
865 m_position (Origin) {} 865 m_position (Origin) {}
866 866
867 LDMatrixObject::LDMatrixObject (const Matrix& transform, const Vertex& pos, LDDocument* document) : 867 LDMatrixObject::LDMatrixObject (const Matrix& transform, const Vertex& pos, LDDocument* document) :
868 LDObject (document), 868 LDObject (document),
869 m_position (pos), 869 m_position (pos),
870 m_transform (transform) {} 870 m_transformationMatrix (transform) {}
871 871
872 void LDMatrixObject::setCoordinate (const Axis ax, double value) 872 void LDMatrixObject::setCoordinate (const Axis ax, double value)
873 { 873 {
874 Vertex v = position(); 874 Vertex v = position();
875 875
895 changeProperty (this, &m_position, a); 895 changeProperty (this, &m_position, a);
896 } 896 }
897 897
898 // ============================================================================= 898 // =============================================================================
899 // 899 //
900 const Matrix& LDMatrixObject::transform() const 900 const Matrix& LDMatrixObject::transformationMatrix() const
901 { 901 {
902 return m_transform; 902 return m_transformationMatrix;
903 } 903 }
904 904
905 void LDMatrixObject::setTransform (const Matrix& val) 905 void LDMatrixObject::setTransformationMatrix (const Matrix& val)
906 { 906 {
907 changeProperty (this, &m_transform, val); 907 changeProperty (this, &m_transformationMatrix, val);
908 } 908 }
909 909
910 LDError::LDError (QString contents, QString reason, LDDocument* document) : 910 LDError::LDError (QString contents, QString reason, LDDocument* document) :
911 LDObject (document), 911 LDObject (document),
912 m_contents (contents), 912 m_contents (contents),

mercurial