Generate seam allowance only one time to use it in creating notches.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2018-09-27 15:13:43 +03:00
parent cead9092e3
commit 135cea212d

View file

@ -439,6 +439,10 @@ QVector<QLineF> VPiece::PassmarksLines(const VContainer *data, const QVector<QPo
QVector<QLineF> passmarks; QVector<QLineF> passmarks;
QVector<QPointF> seamPoints;
seamAllowance.isEmpty() && not IsSeamAllowanceBuiltIn() ? seamPoints = SeamAllowancePoints(data) :
seamPoints = seamAllowance;
for (int i = 0; i< unitedPath.size(); ++i) for (int i = 0; i< unitedPath.size(); ++i)
{ {
const VPieceNode &node = unitedPath.at(i); const VPieceNode &node = unitedPath.at(i);
@ -450,7 +454,7 @@ QVector<QLineF> VPiece::PassmarksLines(const VContainer *data, const QVector<QPo
const int previousIndex = VPiecePath::FindInLoopNotExcludedUp(i, unitedPath); const int previousIndex = VPiecePath::FindInLoopNotExcludedUp(i, unitedPath);
const int nextIndex = VPiecePath::FindInLoopNotExcludedDown(i, unitedPath); const int nextIndex = VPiecePath::FindInLoopNotExcludedDown(i, unitedPath);
passmarks += CreatePassmark(unitedPath, previousIndex, i, nextIndex, data, seamAllowance); passmarks += CreatePassmark(unitedPath, previousIndex, i, nextIndex, data, seamPoints);
} }
return passmarks; return passmarks;
@ -1238,6 +1242,11 @@ QVector<QLineF> VPiece::SAPassmark(const QVector<VPieceNode> &path, VSAPoint &pr
const VSAPoint &passmarkSAPoint, VSAPoint &nextSAPoint, const VContainer *data, const VSAPoint &passmarkSAPoint, VSAPoint &nextSAPoint, const VContainer *data,
int passmarkIndex, const QVector<QPointF> &seamAllowance) const int passmarkIndex, const QVector<QPointF> &seamAllowance) const
{ {
if (seamAllowance.size() < 2)
{
return QVector<QLineF>(); // Something wrong
}
QPointF seamPassmarkSAPoint; QPointF seamPassmarkSAPoint;
if (not GetSeamPassmarkSAPoint(previousSAPoint, passmarkSAPoint, nextSAPoint, data, seamPassmarkSAPoint)) if (not GetSeamPassmarkSAPoint(previousSAPoint, passmarkSAPoint, nextSAPoint, data, seamPassmarkSAPoint))
{ {
@ -1290,14 +1299,11 @@ QVector<QLineF> VPiece::SAPassmark(const QVector<VPieceNode> &path, VSAPoint &pr
|| node.GetPassmarkAngleType() == PassmarkAngleType::IntersectionOnlyLeft || node.GetPassmarkAngleType() == PassmarkAngleType::IntersectionOnlyLeft
|| node.GetPassmarkAngleType() == PassmarkAngleType::IntersectionOnlyRight) || node.GetPassmarkAngleType() == PassmarkAngleType::IntersectionOnlyRight)
{ {
QVector<QPointF> seamPoints;
seamAllowance.isEmpty() ? seamPoints = SeamAllowancePoints(data) : seamPoints = seamAllowance;
if (node.GetPassmarkAngleType() == PassmarkAngleType::Intersection if (node.GetPassmarkAngleType() == PassmarkAngleType::Intersection
|| node.GetPassmarkAngleType() == PassmarkAngleType::IntersectionOnlyRight) || node.GetPassmarkAngleType() == PassmarkAngleType::IntersectionOnlyRight)
{ {
// first passmark // first passmark
PassmarkIntersection(QLineF(previousSAPoint, passmarkSAPoint), seamPoints, PassmarkIntersection(QLineF(previousSAPoint, passmarkSAPoint), seamAllowance,
passmarkSAPoint.GetSAAfter(width)); passmarkSAPoint.GetSAAfter(width));
} }
@ -1305,7 +1311,7 @@ QVector<QLineF> VPiece::SAPassmark(const QVector<VPieceNode> &path, VSAPoint &pr
|| node.GetPassmarkAngleType() == PassmarkAngleType::IntersectionOnlyLeft) || node.GetPassmarkAngleType() == PassmarkAngleType::IntersectionOnlyLeft)
{ {
// second passmark // second passmark
PassmarkIntersection(QLineF(nextSAPoint, passmarkSAPoint), seamPoints, PassmarkIntersection(QLineF(nextSAPoint, passmarkSAPoint), seamAllowance,
passmarkSAPoint.GetSABefore(width)); passmarkSAPoint.GetSABefore(width));
} }
} }
@ -1313,16 +1319,13 @@ QVector<QLineF> VPiece::SAPassmark(const QVector<VPieceNode> &path, VSAPoint &pr
|| node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2OnlyLeft || node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2OnlyLeft
|| node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2OnlyRight) || node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2OnlyRight)
{ {
QVector<QPointF> seamPoints;
seamAllowance.isEmpty() ? seamPoints = SeamAllowancePoints(data) : seamPoints = seamAllowance;
if (node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2 if (node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2
|| node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2OnlyRight) || node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2OnlyRight)
{ {
// first passmark // first passmark
QLineF line(passmarkSAPoint, nextSAPoint); QLineF line(passmarkSAPoint, nextSAPoint);
line.setAngle(line.angle()+90); line.setAngle(line.angle()+90);
PassmarkIntersection(line, seamPoints, passmarkSAPoint.GetSAAfter(width)); PassmarkIntersection(line, seamAllowance, passmarkSAPoint.GetSAAfter(width));
} }
if (node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2 if (node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2
@ -1331,7 +1334,7 @@ QVector<QLineF> VPiece::SAPassmark(const QVector<VPieceNode> &path, VSAPoint &pr
// second passmark // second passmark
QLineF line(passmarkSAPoint, previousSAPoint); QLineF line(passmarkSAPoint, previousSAPoint);
line.setAngle(line.angle()-90); line.setAngle(line.angle()-90);
PassmarkIntersection(line, seamPoints, passmarkSAPoint.GetSABefore(width)); PassmarkIntersection(line, seamAllowance, passmarkSAPoint.GetSABefore(width));
} }
} }