Grainline obey center pin point on layout.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-03-13 14:33:04 +02:00
parent 1ab541236d
commit c6d19c3b9b

View File

@ -206,7 +206,32 @@ bool FindGrainlineGeometry(const VGrainlineData& geom, const VContainer *pattern
return false;
}
pos = geom.GetPos();
const quint32 centerPin = geom.CenterPin();
if (centerPin != NULL_ID)
{
try
{
const auto centerPinPoint = pattern->GeometricObject<VPointF>(centerPin);
const qreal cLength = ToPixel(length, *pattern->GetPatternUnit());
QLineF grainline(centerPinPoint->x(), centerPinPoint->y(),
centerPinPoint->x() + cLength / 2.0, centerPinPoint->y());
grainline.setAngle(rotationAngle);
grainline = QLineF(grainline.p2(), grainline.p1());
grainline.setLength(cLength);
pos = grainline.p2();
}
catch(const VExceptionBadId &)
{
pos = geom.GetPos();
}
}
else
{
pos = geom.GetPos();
}
return true;
}