Include external V notch as part of a cut boundary.

This commit is contained in:
Roman Telezhynskyi 2023-11-30 11:51:14 +02:00
parent d4f14ab1d5
commit 670f08eb9b
3 changed files with 51 additions and 14 deletions

View File

@ -87,7 +87,6 @@ auto PrepareSequenceItem(const QVector<VLayoutPoint> &path, bool drawMode, VBoun
//---------------------------------------------------------------------------------------------------------------------
auto PrepareTPassmarkShape(const VLayoutPassmark &passmark, bool drawMode) -> QVector<QVector<VLayoutPoint>>
{
QVector<VLayoutPoint> shape1;
if (passmark.lines.isEmpty())
{
return {};
@ -101,6 +100,7 @@ auto PrepareTPassmarkShape(const VLayoutPassmark &passmark, bool drawMode) -> QV
};
QLineF line1 = passmark.lines.constFirst();
QVector<VLayoutPoint> shape1;
shape1.append(TurnPoint(line1.p1()));
shape1.append(TurnPoint(line1.p2()));
@ -126,6 +126,50 @@ auto PrepareTPassmarkShape(const VLayoutPassmark &passmark, bool drawMode) -> QV
return {shape1, shape2};
}
//---------------------------------------------------------------------------------------------------------------------
auto PrepareExternalVPassmarkShape(const VLayoutPassmark &passmark, bool drawMode) -> QVector<QVector<VLayoutPoint>>
{
if (passmark.lines.isEmpty())
{
return {};
}
auto TurnPoint = [](QPointF point)
{
VLayoutPoint p(point);
p.SetTurnPoint(true);
return p;
};
QLineF line1 = passmark.lines.constFirst();
QVector<VLayoutPoint> shape;
if (!drawMode)
{
shape.append(TurnPoint(line1.p2()));
}
shape.append(TurnPoint(line1.p1()));
shape.append(TurnPoint(line1.p2()));
if (passmark.lines.size() <= 1)
{
return {shape};
}
const QLineF &line2 = passmark.lines.constLast();
shape.append(TurnPoint(line2.p1()));
shape.append(TurnPoint(line2.p2()));
if (!drawMode)
{
shape.append(TurnPoint(line2.p1()));
}
return {shape};
}
//---------------------------------------------------------------------------------------------------------------------
auto PrepareNoneBreakingPassmarkShape(const VLayoutPassmark &passmark) -> QVector<QVector<VLayoutPoint>>
{
@ -229,17 +273,15 @@ auto PreparePassmarkShape(const VLayoutPassmark &passmark, bool drawMode) -> QVe
{
case PassmarkLineType::OneLine:
case PassmarkLineType::InternalVMark:
case PassmarkLineType::ExternalVMark:
case PassmarkLineType::BoxMark:
case PassmarkLineType::CheckMark:
return PrepareNoneBreakingPassmarkShape(passmark);
break;
case PassmarkLineType::ExternalVMark:
return PrepareExternalVPassmarkShape(passmark, drawMode);
case PassmarkLineType::TMark:
return PrepareTPassmarkShape(passmark, drawMode);
break;
case PassmarkLineType::UMark:
return PrepareUPassmarkShape(passmark);
break;
default:
break;
}
@ -511,7 +553,7 @@ auto VBoundary::Combine(const QVector<VLayoutPassmark> &passmarks, bool drawMode
for (const auto &passmark : passmarks)
{
if (SkipPassmark(passmark, drawMode, layoutAllowance))
if (SkipPassmark(passmark, layoutAllowance))
{
continue;
}
@ -550,7 +592,7 @@ auto VBoundary::Combine(const QVector<VLayoutPassmark> &passmarks, bool drawMode
}
//---------------------------------------------------------------------------------------------------------------------
auto VBoundary::SkipPassmark(const VLayoutPassmark &passmark, bool drawMode, bool layoutAllowance) const -> bool
auto VBoundary::SkipPassmark(const VLayoutPassmark &passmark, bool layoutAllowance) const -> bool
{
if (m_seamAllowance)
{
@ -574,11 +616,6 @@ auto VBoundary::SkipPassmark(const VLayoutPassmark &passmark, bool drawMode, boo
return true;
}
if (!drawMode && passmark.type == PassmarkLineType::ExternalVMark)
{
return true;
}
return false;
}

View File

@ -70,7 +70,7 @@ private:
bool m_builtInSeamAllowance;
QString m_pieceName{};
auto SkipPassmark(const VLayoutPassmark &passmark, bool drawMode, bool layoutAllowance) const -> bool;
auto SkipPassmark(const VLayoutPassmark &passmark, bool layoutAllowance) const -> bool;
void InsertPassmark(const VBoundarySequenceItemData &item, QList<VBoundarySequenceItemData> &sequence,
bool drawMode) const;

View File

@ -384,7 +384,7 @@ auto CreateExternalVMarkPassmark(const VPiecePassmarkData &passmarkData, const Q
QLineF l2 = line;
l2.setAngle(l2.angle() + angle);
return {l1, {l2.p2(), l2.p1()}};
return {{l1.p2(), l1.p1()}, l2};
}
//---------------------------------------------------------------------------------------------------------------------