Fix grainline position on layout.
--HG-- branch : develop
This commit is contained in:
parent
9475da34b8
commit
3b00e4ad0e
|
@ -489,7 +489,7 @@ void VLayoutPiece::SetDetail(const QString& qsName, const VPieceLabelData& data,
|
||||||
v[i] = RotatePoint(ptCenter, v.at(i), dAng);
|
v[i] = RotatePoint(ptCenter, v.at(i), dAng);
|
||||||
}
|
}
|
||||||
|
|
||||||
QScopedPointer<QGraphicsItem> item(GetMainItem());
|
QScopedPointer<QGraphicsItem> item(GetMainPathItem());
|
||||||
d->detailLabel = CorrectPosition(item->boundingRect(), RoundPoints(v));
|
d->detailLabel = CorrectPosition(item->boundingRect(), RoundPoints(v));
|
||||||
|
|
||||||
// generate text
|
// generate text
|
||||||
|
@ -529,7 +529,7 @@ void VLayoutPiece::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLa
|
||||||
{
|
{
|
||||||
v[i] = RotatePoint(ptCenter, v.at(i), dAng);
|
v[i] = RotatePoint(ptCenter, v.at(i), dAng);
|
||||||
}
|
}
|
||||||
QScopedPointer<QGraphicsItem> item(GetMainItem());
|
QScopedPointer<QGraphicsItem> item(GetMainPathItem());
|
||||||
d->patternInfo = CorrectPosition(item->boundingRect(), RoundPoints(v));
|
d->patternInfo = CorrectPosition(item->boundingRect(), RoundPoints(v));
|
||||||
|
|
||||||
// Generate text
|
// Generate text
|
||||||
|
@ -582,7 +582,7 @@ void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer* pa
|
||||||
v << pt2;
|
v << pt2;
|
||||||
}
|
}
|
||||||
|
|
||||||
QScopedPointer<QGraphicsItem> item(GetMainItem());
|
QScopedPointer<QGraphicsItem> item(GetMainPathItem());
|
||||||
d->grainlinePoints = CorrectPosition(item->boundingRect(), RoundPoints(v));
|
d->grainlinePoints = CorrectPosition(item->boundingRect(), RoundPoints(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,20 +843,7 @@ QVector<T> VLayoutPiece::Map(const QVector<T> &points) const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPainterPath VLayoutPiece::ContourPath() const
|
QPainterPath VLayoutPiece::ContourPath() const
|
||||||
{
|
{
|
||||||
QPainterPath path;
|
QPainterPath path = MainPath();
|
||||||
|
|
||||||
// contour
|
|
||||||
QVector<QPointF> points = GetContourPoints();
|
|
||||||
|
|
||||||
if (not IsHideMainPath() || not IsSeamAllowance() || IsSeamAllowanceBuiltIn())
|
|
||||||
{
|
|
||||||
path.moveTo(points.at(0));
|
|
||||||
for (qint32 i = 1; i < points.count(); ++i)
|
|
||||||
{
|
|
||||||
path.lineTo(points.at(i));
|
|
||||||
}
|
|
||||||
path.lineTo(points.at(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
// seam allowance
|
// seam allowance
|
||||||
if (IsSeamAllowance())
|
if (IsSeamAllowance())
|
||||||
|
@ -864,7 +851,7 @@ QPainterPath VLayoutPiece::ContourPath() const
|
||||||
if (not IsSeamAllowanceBuiltIn())
|
if (not IsSeamAllowanceBuiltIn())
|
||||||
{
|
{
|
||||||
// Draw seam allowance
|
// Draw seam allowance
|
||||||
points = GetSeamAllowancePoints();
|
QVector<QPointF>points = GetSeamAllowancePoints();
|
||||||
|
|
||||||
if (points.last().toPoint() != points.first().toPoint())
|
if (points.last().toPoint() != points.first().toPoint())
|
||||||
{
|
{
|
||||||
|
@ -897,6 +884,27 @@ QPainterPath VLayoutPiece::ContourPath() const
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QPainterPath VLayoutPiece::MainPath() const
|
||||||
|
{
|
||||||
|
QPainterPath path;
|
||||||
|
|
||||||
|
// contour
|
||||||
|
QVector<QPointF> points = GetContourPoints();
|
||||||
|
|
||||||
|
if (not IsHideMainPath() || not IsSeamAllowance() || IsSeamAllowanceBuiltIn())
|
||||||
|
{
|
||||||
|
path.moveTo(points.at(0));
|
||||||
|
for (qint32 i = 1; i < points.count(); ++i)
|
||||||
|
{
|
||||||
|
path.lineTo(points.at(i));
|
||||||
|
}
|
||||||
|
path.lineTo(points.at(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VLayoutPiece::CreateInternalPathItem(int i, QGraphicsItem *parent) const
|
void VLayoutPiece::CreateInternalPathItem(int i, QGraphicsItem *parent) const
|
||||||
{
|
{
|
||||||
|
@ -1081,6 +1089,14 @@ QGraphicsPathItem *VLayoutPiece::GetMainItem() const
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QGraphicsPathItem *VLayoutPiece::GetMainPathItem() const
|
||||||
|
{
|
||||||
|
QGraphicsPathItem *item = new QGraphicsPathItem();
|
||||||
|
item->setPath(MainPath());
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VLayoutPiece::IsMirror() const
|
bool VLayoutPiece::IsMirror() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -124,6 +124,7 @@ public:
|
||||||
bool isNull() const;
|
bool isNull() const;
|
||||||
qint64 Square() const;
|
qint64 Square() const;
|
||||||
QPainterPath ContourPath() const;
|
QPainterPath ContourPath() const;
|
||||||
|
QPainterPath MainPath() const;
|
||||||
|
|
||||||
QPainterPath LayoutAllowancePath() const;
|
QPainterPath LayoutAllowancePath() const;
|
||||||
Q_REQUIRED_RESULT QGraphicsItem *GetItem(bool textAsPaths) const;
|
Q_REQUIRED_RESULT QGraphicsItem *GetItem(bool textAsPaths) const;
|
||||||
|
@ -134,6 +135,7 @@ private:
|
||||||
QVector<QPointF> DetailPath() const;
|
QVector<QPointF> DetailPath() const;
|
||||||
|
|
||||||
Q_REQUIRED_RESULT QGraphicsPathItem *GetMainItem() const;
|
Q_REQUIRED_RESULT QGraphicsPathItem *GetMainItem() const;
|
||||||
|
Q_REQUIRED_RESULT QGraphicsPathItem *GetMainPathItem() const;
|
||||||
|
|
||||||
void CreateInternalPathItem(int i, QGraphicsItem *parent) const;
|
void CreateInternalPathItem(int i, QGraphicsItem *parent) const;
|
||||||
void CreateLabelStrings(QGraphicsItem *parent, const QVector<QPointF> &labelShape, const VTextManager &tm,
|
void CreateLabelStrings(QGraphicsItem *parent, const QVector<QPointF> &labelShape, const VTextManager &tm,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user