Fixed bug with a grainline.

Grainline arrows were upside down on layout.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2017-04-28 15:37:31 +03:00
parent 03a9b07eff
commit 9fd611e2d1

View File

@ -564,14 +564,14 @@ void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer* pa
} }
QPointF pt2(pt1.x() + dLen * qCos(dAng), pt1.y() - dLen * qSin(dAng)); QPointF pt2(pt1.x() + dLen * qCos(dAng), pt1.y() - dLen * qSin(dAng));
QVector<QPointF> v;
const qreal dArrowLen = ToPixel(0.5, *pattern->GetPatternUnit()); const qreal dArrowLen = ToPixel(0.5, *pattern->GetPatternUnit());
const qreal dArrowAng = M_PI/9; const qreal dArrowAng = M_PI/9;
QVector<QPointF> v;
v << pt1; v << pt1;
if (geom.GetArrowType() != ArrowType::atRear) if (geom.GetArrowType() != ArrowType::atFront)
{ {
v << QPointF(pt1.x() + dArrowLen * qCos(dAng + dArrowAng), pt1.y() - dArrowLen * qSin(dAng + dArrowAng)); v << QPointF(pt1.x() + dArrowLen * qCos(dAng + dArrowAng), pt1.y() - dArrowLen * qSin(dAng + dArrowAng));
v << QPointF(pt1.x() + dArrowLen * qCos(dAng - dArrowAng), pt1.y() - dArrowLen * qSin(dAng - dArrowAng)); v << QPointF(pt1.x() + dArrowLen * qCos(dAng - dArrowAng), pt1.y() - dArrowLen * qSin(dAng - dArrowAng));
@ -580,7 +580,7 @@ void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer* pa
v << pt2; v << pt2;
if (geom.GetArrowType() != ArrowType::atFront) if (geom.GetArrowType() != ArrowType::atRear)
{ {
dAng += M_PI; dAng += M_PI;
@ -966,6 +966,7 @@ void VLayoutPiece::CreateGrainlineItem(QGraphicsItem *parent) const
VGraphicsFillItem* item = new VGraphicsFillItem(parent); VGraphicsFillItem* item = new VGraphicsFillItem(parent);
QPainterPath path; QPainterPath path;
QVector<QPointF> gPoints = Map(d->grainlinePoints); QVector<QPointF> gPoints = Map(d->grainlinePoints);
path.moveTo(gPoints.at(0)); path.moveTo(gPoints.at(0));
for (int i = 1; i < gPoints.count(); ++i) for (int i = 1; i < gPoints.count(); ++i)