Methods to get a passmark base lines.
--HG-- branch : develop
This commit is contained in:
parent
a87f821327
commit
d58b3f523d
|
@ -249,7 +249,7 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
if (nodeIndex != -1)
|
if (nodeIndex != -1)
|
||||||
{
|
{
|
||||||
layoutPassmark.lines = passmark.BuiltInSAPassmark(piece, pattern);
|
layoutPassmark.lines = passmark.BuiltInSAPassmark(piece, pattern);
|
||||||
layoutPassmark.baseLine = passmark.BuiltInSAPassmarkBaseLine(piece);
|
layoutPassmark.baseLine = passmark.BuiltInSAPassmarkBaseLine(piece).constFirst();
|
||||||
layoutPassmark.type = pData.passmarkLineType;
|
layoutPassmark.type = pData.passmarkLineType;
|
||||||
layoutPassmark.isBuiltIn = true;
|
layoutPassmark.isBuiltIn = true;
|
||||||
|
|
||||||
|
@ -265,9 +265,18 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
const int nodeIndex = path.indexOfNode(pData.id);
|
const int nodeIndex = path.indexOfNode(pData.id);
|
||||||
if (nodeIndex != -1)
|
if (nodeIndex != -1)
|
||||||
{
|
{
|
||||||
layoutPassmark.lines = passmark.SAPassmark(piece, pattern, static_cast<PassmarkSide>(side));
|
QVector<QLineF> lines =
|
||||||
layoutPassmark.baseLine =
|
|
||||||
passmark.SAPassmarkBaseLine(piece, pattern, static_cast<PassmarkSide>(side));
|
passmark.SAPassmarkBaseLine(piece, pattern, static_cast<PassmarkSide>(side));
|
||||||
|
|
||||||
|
if (side == PassmarkSide::All || side == PassmarkSide::Right)
|
||||||
|
{
|
||||||
|
layoutPassmark.baseLine = lines.first();
|
||||||
|
}
|
||||||
|
else if (side == PassmarkSide::Right)
|
||||||
|
{
|
||||||
|
layoutPassmark.baseLine = lines.last();
|
||||||
|
}
|
||||||
|
layoutPassmark.lines = passmark.SAPassmark(piece, pattern, side);
|
||||||
layoutPassmark.type = pData.passmarkLineType;
|
layoutPassmark.type = pData.passmarkLineType;
|
||||||
layoutPassmark.isBuiltIn = false;
|
layoutPassmark.isBuiltIn = false;
|
||||||
|
|
||||||
|
|
|
@ -139,6 +139,12 @@ bool FixNotchPoint(const QVector<QPointF> &seamAllowance, const QPointF ¬chBa
|
||||||
}
|
}
|
||||||
const qreal passmarkGap = (1.5/*mm*/ / 25.4) * PrintDPI;
|
const qreal passmarkGap = (1.5/*mm*/ / 25.4) * PrintDPI;
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<QLineF> CreateOnePassmarkLines(const QLineF &line)
|
||||||
|
{
|
||||||
|
return QVector<QLineF>({line});
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QLineF> CreateTwoPassmarkLines(const QLineF &line, const QVector<QPointF> &seamAllowance)
|
QVector<QLineF> CreateTwoPassmarkLines(const QLineF &line, const QVector<QPointF> &seamAllowance)
|
||||||
{
|
{
|
||||||
|
@ -307,9 +313,12 @@ QVector<QLineF> CreateUMarkPassmark(const QLineF &line, const QVector<QPointF> &
|
||||||
{
|
{
|
||||||
const qreal radius = line.length() * VPassmark::passmarkRadiusFactor;
|
const qreal radius = line.length() * VPassmark::passmarkRadiusFactor;
|
||||||
|
|
||||||
|
QLineF baseLine = line;
|
||||||
|
baseLine.setLength(baseLine.length() - radius); // keep defined depth
|
||||||
|
|
||||||
QPointF l1p1;
|
QPointF l1p1;
|
||||||
{
|
{
|
||||||
QLineF line1 = line;
|
QLineF line1 = baseLine;
|
||||||
line1.setAngle(line1.angle() + 90);
|
line1.setAngle(line1.angle() + 90);
|
||||||
line1.setLength(radius);
|
line1.setLength(radius);
|
||||||
l1p1 = line1.p2();
|
l1p1 = line1.p2();
|
||||||
|
@ -317,7 +326,7 @@ QVector<QLineF> CreateUMarkPassmark(const QLineF &line, const QVector<QPointF> &
|
||||||
|
|
||||||
QPointF l2p1;
|
QPointF l2p1;
|
||||||
{
|
{
|
||||||
QLineF line2 = line;
|
QLineF line2 = baseLine;
|
||||||
line2.setAngle(line2.angle() - 90);
|
line2.setAngle(line2.angle() - 90);
|
||||||
line2.setLength(radius);
|
line2.setLength(radius);
|
||||||
l2p1 = line2.p2();
|
l2p1 = line2.p2();
|
||||||
|
@ -325,7 +334,7 @@ QVector<QLineF> CreateUMarkPassmark(const QLineF &line, const QVector<QPointF> &
|
||||||
|
|
||||||
QPointF l1p2;
|
QPointF l1p2;
|
||||||
{
|
{
|
||||||
QLineF line1 = QLineF(line.p2(), line.p1());
|
QLineF line1 = QLineF(baseLine.p2(), baseLine.p1());
|
||||||
line1.setAngle(line1.angle() - 90);
|
line1.setAngle(line1.angle() - 90);
|
||||||
line1.setLength(radius);
|
line1.setLength(radius);
|
||||||
l1p2 = line1.p2();
|
l1p2 = line1.p2();
|
||||||
|
@ -333,30 +342,28 @@ QVector<QLineF> CreateUMarkPassmark(const QLineF &line, const QVector<QPointF> &
|
||||||
|
|
||||||
QPointF l2p2;
|
QPointF l2p2;
|
||||||
{
|
{
|
||||||
QLineF line2 = QLineF(line.p2(), line.p1());
|
QLineF line2 = QLineF(baseLine.p2(), baseLine.p1());
|
||||||
line2.setAngle(line2.angle() + 90);
|
line2.setAngle(line2.angle() + 90);
|
||||||
line2.setLength(radius);
|
line2.setLength(radius);
|
||||||
l2p2 = line2.p2();
|
l2p2 = line2.p2();
|
||||||
}
|
}
|
||||||
|
|
||||||
QLineF axis = QLineF(line.p2(), line.p1());
|
QLineF axis = QLineF(baseLine.p2(), baseLine.p1());
|
||||||
axis.setLength(radius);
|
axis.setLength(radius);
|
||||||
|
|
||||||
QVector<QPointF> points;
|
QVector<QPointF> points;
|
||||||
|
|
||||||
QLineF seg = VPassmark::FindIntersection(QLineF(l2p2, l2p1), seamAllowance);
|
QLineF seg = VPassmark::FindIntersection(QLineF(l2p2, l2p1), seamAllowance);
|
||||||
seg = QLineF(seg.p2(), seg.p1());
|
seg = QLineF(seg.p2(), seg.p1());
|
||||||
seg.setLength(seg.length() - radius);
|
|
||||||
points.append(seg.p1());
|
points.append(seg.p1());
|
||||||
points.append(seg.p2());
|
points.append(seg.p2());
|
||||||
|
|
||||||
VArc arc(VPointF(axis.p2()), radius, QLineF(l1p2, l2p2).angle(), QLineF(l1p2, l2p2).angle()+180);
|
VArc arc(VPointF(baseLine.p2()), radius, QLineF(baseLine.p2(), l2p2).angle(), QLineF(baseLine.p2(), l1p2).angle());
|
||||||
arc.SetApproximationScale(10);
|
arc.SetApproximationScale(10);
|
||||||
points += arc.GetPoints();
|
points += arc.GetPoints();
|
||||||
|
|
||||||
seg = VPassmark::FindIntersection(QLineF(l1p2, l1p1), seamAllowance);
|
seg = VPassmark::FindIntersection(QLineF(l1p2, l1p1), seamAllowance);
|
||||||
seg = QLineF(seg.p2(), seg.p1());
|
seg = QLineF(seg.p2(), seg.p1());
|
||||||
seg.setLength(seg.length() - radius);
|
|
||||||
points.append(seg.p2());
|
points.append(seg.p2());
|
||||||
points.append(seg.p1());
|
points.append(seg.p1());
|
||||||
|
|
||||||
|
@ -414,16 +421,58 @@ QVector<QLineF> CreateBoxMarkPassmark(const QLineF &line, const QVector<QPointF>
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QLineF> CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType angleType, const QLineF &line,
|
QVector<QLineF> CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType angleType,
|
||||||
const QVector<QPointF> &seamAllowance)
|
const QVector<QLineF> &lines, const QVector<QPointF> &seamAllowance,
|
||||||
|
PassmarkSide side)
|
||||||
{
|
{
|
||||||
if (line.isNull())
|
if (lines.isEmpty())
|
||||||
{
|
{
|
||||||
return QVector<QLineF>();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QLineF> passmarksLines;
|
QVector<QLineF> passmarksLines;
|
||||||
|
|
||||||
|
auto CreateLinesWithCorrection = [&passmarksLines, side, angleType, lines, seamAllowance]
|
||||||
|
(QVector<QLineF> (*create)(const QLineF &, const QVector<QPointF> &))
|
||||||
|
{
|
||||||
|
if (angleType == PassmarkAngleType::Straightforward)
|
||||||
|
{
|
||||||
|
passmarksLines += (*create)(lines.first(), seamAllowance);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (side == PassmarkSide::All || side == PassmarkSide::Left)
|
||||||
|
{
|
||||||
|
passmarksLines += (*create)(lines.first(), seamAllowance);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (side == PassmarkSide::All || side == PassmarkSide::Right)
|
||||||
|
{
|
||||||
|
passmarksLines += (*create)(lines.last(), seamAllowance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
auto CreateLines = [&passmarksLines, side, angleType, lines](QVector<QLineF> (*create)(const QLineF &))
|
||||||
|
{
|
||||||
|
if (angleType == PassmarkAngleType::Straightforward)
|
||||||
|
{
|
||||||
|
passmarksLines += (*create)(lines.first());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (side == PassmarkSide::All || side == PassmarkSide::Left)
|
||||||
|
{
|
||||||
|
passmarksLines += (*create)(lines.first());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (side == PassmarkSide::All || side == PassmarkSide::Right)
|
||||||
|
{
|
||||||
|
passmarksLines += (*create)(lines.last());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (angleType == PassmarkAngleType::Straightforward
|
if (angleType == PassmarkAngleType::Straightforward
|
||||||
|| angleType == PassmarkAngleType::Intersection
|
|| angleType == PassmarkAngleType::Intersection
|
||||||
|| angleType == PassmarkAngleType::IntersectionOnlyLeft
|
|| angleType == PassmarkAngleType::IntersectionOnlyLeft
|
||||||
|
@ -435,29 +484,29 @@ QVector<QLineF> CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType
|
||||||
switch (lineType)
|
switch (lineType)
|
||||||
{
|
{
|
||||||
case PassmarkLineType::TwoLines:
|
case PassmarkLineType::TwoLines:
|
||||||
passmarksLines += CreateTwoPassmarkLines(line, seamAllowance);
|
CreateLinesWithCorrection(CreateTwoPassmarkLines);
|
||||||
break;
|
break;
|
||||||
case PassmarkLineType::ThreeLines:
|
case PassmarkLineType::ThreeLines:
|
||||||
passmarksLines += CreateThreePassmarkLines(line, seamAllowance);
|
CreateLinesWithCorrection(CreateThreePassmarkLines);
|
||||||
break;
|
break;
|
||||||
case PassmarkLineType::TMark:
|
case PassmarkLineType::TMark:
|
||||||
passmarksLines += CreateTMarkPassmark(line);
|
CreateLines(CreateTMarkPassmark);
|
||||||
break;
|
break;
|
||||||
case PassmarkLineType::VMark:
|
case PassmarkLineType::VMark:
|
||||||
passmarksLines += CreateVMarkPassmark(line);
|
CreateLines(CreateVMarkPassmark);
|
||||||
break;
|
break;
|
||||||
case PassmarkLineType::VMark2:
|
case PassmarkLineType::VMark2:
|
||||||
passmarksLines += CreateVMark2Passmark(line, seamAllowance);
|
CreateLinesWithCorrection(CreateVMark2Passmark);
|
||||||
break;
|
break;
|
||||||
case PassmarkLineType::UMark:
|
case PassmarkLineType::UMark:
|
||||||
passmarksLines += CreateUMarkPassmark(line, seamAllowance);
|
CreateLinesWithCorrection(CreateUMarkPassmark);
|
||||||
break;
|
break;
|
||||||
case PassmarkLineType::BoxMark:
|
case PassmarkLineType::BoxMark:
|
||||||
passmarksLines += CreateBoxMarkPassmark(line, seamAllowance);
|
CreateLinesWithCorrection(CreateBoxMarkPassmark);
|
||||||
break;
|
break;
|
||||||
case PassmarkLineType::OneLine:
|
case PassmarkLineType::OneLine:
|
||||||
default:
|
default:
|
||||||
passmarksLines.append(line);
|
CreateLines(CreateOnePassmarkLines);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -466,7 +515,7 @@ QVector<QLineF> CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType
|
||||||
switch (lineType)
|
switch (lineType)
|
||||||
{
|
{
|
||||||
case PassmarkLineType::TMark:
|
case PassmarkLineType::TMark:
|
||||||
passmarksLines += CreateTMarkPassmark(line);
|
passmarksLines += CreateTMarkPassmark(lines.first());
|
||||||
break;
|
break;
|
||||||
case PassmarkLineType::OneLine:
|
case PassmarkLineType::OneLine:
|
||||||
case PassmarkLineType::TwoLines:
|
case PassmarkLineType::TwoLines:
|
||||||
|
@ -476,7 +525,7 @@ QVector<QLineF> CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType
|
||||||
case PassmarkLineType::UMark:
|
case PassmarkLineType::UMark:
|
||||||
case PassmarkLineType::BoxMark:
|
case PassmarkLineType::BoxMark:
|
||||||
default:
|
default:
|
||||||
passmarksLines.append(line);
|
passmarksLines.append(lines.first());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -485,8 +534,8 @@ QVector<QLineF> CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QLineF PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const VPiecePassmarkData &passmarkData,
|
QVector<QLineF> PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const VPiecePassmarkData &passmarkData,
|
||||||
const QPointF &seamPassmarkSAPoint, const QVector<QPointF> &seamAllowance)
|
const QPointF &seamPassmarkSAPoint, const QVector<QPointF> &seamAllowance)
|
||||||
{
|
{
|
||||||
QLineF edge1;
|
QLineF edge1;
|
||||||
QLineF edge2;
|
QLineF edge2;
|
||||||
|
@ -516,7 +565,7 @@ QLineF PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const VPiecePas
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Should never happen
|
{ // Should never happen
|
||||||
return QLineF();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
const qreal length = passmarkData.passmarkSAPoint.PassmarkLength(passmarkData.saWidth);
|
const qreal length = passmarkData.passmarkSAPoint.PassmarkLength(passmarkData.saWidth);
|
||||||
|
@ -526,13 +575,13 @@ QLineF PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const VPiecePas
|
||||||
"than minimal allowed.")
|
"than minimal allowed.")
|
||||||
.arg(passmarkData.nodeName, passmarkData.pieceName);
|
.arg(passmarkData.nodeName, passmarkData.pieceName);
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
||||||
return QLineF();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
edge1.setAngle(edge1.angle() + edge1.angleTo(edge2)/2.);
|
edge1.setAngle(edge1.angle() + edge1.angleTo(edge2)/2.);
|
||||||
edge1.setLength(length);
|
edge1.setLength(length);
|
||||||
|
|
||||||
return edge1;
|
return QVector<QLineF>({edge1});
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -662,13 +711,13 @@ QLineF VPassmark::FindIntersection(const QLineF &line, const QVector<QPointF> &s
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QLineF> VPassmark::MakeSAPassmark(const QVector<QPointF> &seamAllowance, PassmarkSide side) const
|
QVector<QLineF> VPassmark::MakeSAPassmark(const QVector<QPointF> &seamAllowance, PassmarkSide side) const
|
||||||
{
|
{
|
||||||
const QLineF line = SAPassmarkBaseLine(seamAllowance, side);
|
const QVector<QLineF> lines = SAPassmarkBaseLine(seamAllowance, side);
|
||||||
if (line.isNull())
|
if (lines.isEmpty())
|
||||||
{
|
{
|
||||||
return QVector<QLineF>();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return CreatePassmarkLines(m_data.passmarkLineType, m_data.passmarkAngleType, line, seamAllowance);
|
return CreatePassmarkLines(m_data.passmarkLineType, m_data.passmarkAngleType, lines, seamAllowance, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -679,21 +728,22 @@ QVector<QLineF> VPassmark::BuiltInSAPassmark(const VPiece &piece, const VContain
|
||||||
return QVector<QLineF>();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QLineF line = BuiltInSAPassmarkBaseLine(piece);
|
const QVector<QLineF> lines = BuiltInSAPassmarkBaseLine(piece);
|
||||||
if (line.isNull())
|
if (lines.isEmpty())
|
||||||
{
|
{
|
||||||
return QVector<QLineF>();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return CreatePassmarkLines(m_data.passmarkLineType, m_data.passmarkAngleType, line, piece.MainPathPoints(data));
|
return CreatePassmarkLines(m_data.passmarkLineType, m_data.passmarkAngleType, lines, piece.MainPathPoints(data),
|
||||||
|
PassmarkSide::All);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QLineF VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const
|
QVector<QLineF> VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const
|
||||||
{
|
{
|
||||||
if (m_null)
|
if (m_null)
|
||||||
{
|
{
|
||||||
return QLineF();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal length = 0;
|
qreal length = 0;
|
||||||
|
@ -706,7 +756,7 @@ QLineF VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const
|
||||||
"than minimal allowed.")
|
"than minimal allowed.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
||||||
return QLineF();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -721,7 +771,7 @@ QLineF VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const
|
||||||
"seam allowance. User must manually provide length.")
|
"seam allowance. User must manually provide length.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
||||||
return QLineF();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,15 +781,15 @@ QLineF VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const
|
||||||
edge1.setAngle(edge1.angle() + edge1.angleTo(edge2)/2.);
|
edge1.setAngle(edge1.angle() + edge1.angleTo(edge2)/2.);
|
||||||
edge1.setLength(length);
|
edge1.setLength(length);
|
||||||
|
|
||||||
return edge1;
|
return QVector<QLineF>({edge1});
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QLineF VPassmark::SAPassmarkBaseLine(const VPiece &piece, const VContainer *data, PassmarkSide side) const
|
QVector<QLineF> VPassmark::SAPassmarkBaseLine(const VPiece &piece, const VContainer *data, PassmarkSide side) const
|
||||||
{
|
{
|
||||||
if (m_null)
|
if (m_null)
|
||||||
{
|
{
|
||||||
return QLineF();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not piece.IsSeamAllowanceBuiltIn())
|
if (not piece.IsSeamAllowanceBuiltIn())
|
||||||
|
@ -748,15 +798,15 @@ QLineF VPassmark::SAPassmarkBaseLine(const VPiece &piece, const VContainer *data
|
||||||
return SAPassmarkBaseLine(piece.SeamAllowancePointsWithRotation(data, m_data.passmarkIndex), side);
|
return SAPassmarkBaseLine(piece.SeamAllowancePointsWithRotation(data, m_data.passmarkIndex), side);
|
||||||
}
|
}
|
||||||
|
|
||||||
return QLineF();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QLineF VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowance, PassmarkSide side) const
|
QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowance, PassmarkSide side) const
|
||||||
{
|
{
|
||||||
if (m_null)
|
if (m_null)
|
||||||
{
|
{
|
||||||
return QLineF();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seamAllowance.size() < 2)
|
if (seamAllowance.size() < 2)
|
||||||
|
@ -764,7 +814,7 @@ QLineF VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowance, Pass
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Seam allowance is "
|
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Seam allowance is "
|
||||||
"empty.").arg(m_data.nodeName, m_data.pieceName);
|
"empty.").arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
||||||
return QLineF(); // Something wrong
|
return QVector<QLineF>(); // Something wrong
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointF seamPassmarkSAPoint;
|
QPointF seamPassmarkSAPoint;
|
||||||
|
@ -775,7 +825,7 @@ QLineF VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowance, Pass
|
||||||
"position for a notch.")
|
"position for a notch.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
||||||
return QLineF(); // Something wrong
|
return QVector<QLineF>(); // Something wrong
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not FixNotchPoint(seamAllowance, m_data.passmarkSAPoint, &seamPassmarkSAPoint))
|
if (not FixNotchPoint(seamAllowance, m_data.passmarkSAPoint, &seamPassmarkSAPoint))
|
||||||
|
@ -848,7 +898,7 @@ QLineF VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowance, Pass
|
||||||
{
|
{
|
||||||
QLineF line = QLineF(seamPassmarkSAPoint, m_data.passmarkSAPoint);
|
QLineF line = QLineF(seamPassmarkSAPoint, m_data.passmarkSAPoint);
|
||||||
line.setLength(length);
|
line.setLength(length);
|
||||||
return line;
|
return QVector<QLineF>({line});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_data.passmarkAngleType == PassmarkAngleType::Bisector)
|
else if (m_data.passmarkAngleType == PassmarkAngleType::Bisector)
|
||||||
|
@ -859,50 +909,56 @@ QLineF VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowance, Pass
|
||||||
|| m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyLeft
|
|| m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyLeft
|
||||||
|| m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyRight)
|
|| m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyRight)
|
||||||
{
|
{
|
||||||
if ((m_data.passmarkAngleType == PassmarkAngleType::Intersection
|
QVector<QLineF> lines;
|
||||||
|| m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyRight)
|
|
||||||
&& (side == PassmarkSide::All || side == PassmarkSide::Right))
|
|
||||||
{
|
|
||||||
// first passmark
|
|
||||||
return PassmarkIntersection(QLineF(m_data.previousSAPoint, m_data.passmarkSAPoint),
|
|
||||||
m_data.passmarkSAPoint.GetSAAfter(m_data.saWidth));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((m_data.passmarkAngleType == PassmarkAngleType::Intersection
|
if ((m_data.passmarkAngleType == PassmarkAngleType::Intersection
|
||||||
|| m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyLeft)
|
|| m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyLeft)
|
||||||
&& (side == PassmarkSide::All || side == PassmarkSide::Left))
|
&& (side == PassmarkSide::All || side == PassmarkSide::Left))
|
||||||
{
|
{
|
||||||
// second passmark
|
// first passmark
|
||||||
return PassmarkIntersection(QLineF(m_data.nextSAPoint, m_data.passmarkSAPoint),
|
lines += PassmarkIntersection(QLineF(m_data.nextSAPoint, m_data.passmarkSAPoint),
|
||||||
m_data.passmarkSAPoint.GetSABefore(m_data.saWidth));
|
m_data.passmarkSAPoint.GetSABefore(m_data.saWidth));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((m_data.passmarkAngleType == PassmarkAngleType::Intersection
|
||||||
|
|| m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyRight)
|
||||||
|
&& (side == PassmarkSide::All || side == PassmarkSide::Right))
|
||||||
|
{
|
||||||
|
// second passmark
|
||||||
|
lines += PassmarkIntersection(QLineF(m_data.previousSAPoint, m_data.passmarkSAPoint),
|
||||||
|
m_data.passmarkSAPoint.GetSAAfter(m_data.saWidth));
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines;
|
||||||
}
|
}
|
||||||
else if (m_data.passmarkAngleType == PassmarkAngleType::Intersection2
|
else if (m_data.passmarkAngleType == PassmarkAngleType::Intersection2
|
||||||
|| m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyLeft
|
|| m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyLeft
|
||||||
|| m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyRight)
|
|| m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyRight)
|
||||||
{
|
{
|
||||||
if ((m_data.passmarkAngleType == PassmarkAngleType::Intersection2
|
QVector<QLineF> lines;
|
||||||
|| m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyRight)
|
|
||||||
&& (side == PassmarkSide::All || side == PassmarkSide::Right))
|
|
||||||
{
|
|
||||||
// first passmark
|
|
||||||
QLineF line(m_data.passmarkSAPoint, m_data.nextSAPoint);
|
|
||||||
line.setAngle(line.angle()+90);
|
|
||||||
return PassmarkIntersection(line, m_data.passmarkSAPoint.GetSAAfter(m_data.saWidth));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((m_data.passmarkAngleType == PassmarkAngleType::Intersection2
|
if ((m_data.passmarkAngleType == PassmarkAngleType::Intersection2
|
||||||
|| m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyLeft)
|
|| m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyLeft)
|
||||||
&& (side == PassmarkSide::All || side == PassmarkSide::Left))
|
&& (side == PassmarkSide::All || side == PassmarkSide::Left))
|
||||||
{
|
{
|
||||||
// second passmark
|
// first passmark
|
||||||
QLineF line(m_data.passmarkSAPoint, m_data.previousSAPoint);
|
QLineF line(m_data.passmarkSAPoint, m_data.previousSAPoint);
|
||||||
line.setAngle(line.angle()-90);
|
line.setAngle(line.angle()-90);
|
||||||
return PassmarkIntersection(line, m_data.passmarkSAPoint.GetSABefore(m_data.saWidth));
|
lines += PassmarkIntersection(line, m_data.passmarkSAPoint.GetSABefore(m_data.saWidth));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((m_data.passmarkAngleType == PassmarkAngleType::Intersection2
|
||||||
|
|| m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyRight)
|
||||||
|
&& (side == PassmarkSide::All || side == PassmarkSide::Right))
|
||||||
|
{
|
||||||
|
// second passmark
|
||||||
|
QLineF line(m_data.passmarkSAPoint, m_data.nextSAPoint);
|
||||||
|
line.setAngle(line.angle()+90);
|
||||||
|
lines += PassmarkIntersection(line, m_data.passmarkSAPoint.GetSAAfter(m_data.saWidth));
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QLineF();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -79,9 +79,9 @@ public:
|
||||||
QVector<QLineF> SAPassmark(const QVector<QPointF> &seamAllowance, PassmarkSide side) const;
|
QVector<QLineF> SAPassmark(const QVector<QPointF> &seamAllowance, PassmarkSide side) const;
|
||||||
QVector<QLineF> BuiltInSAPassmark(const VPiece &piece, const VContainer *data) const;
|
QVector<QLineF> BuiltInSAPassmark(const VPiece &piece, const VContainer *data) const;
|
||||||
|
|
||||||
QLineF BuiltInSAPassmarkBaseLine(const VPiece &piece) const;
|
QVector<QLineF> BuiltInSAPassmarkBaseLine(const VPiece &piece) const;
|
||||||
QLineF SAPassmarkBaseLine(const VPiece &piece, const VContainer *data, PassmarkSide side) const;
|
QVector<QLineF> SAPassmarkBaseLine(const VPiece &piece, const VContainer *data, PassmarkSide side) const;
|
||||||
QLineF SAPassmarkBaseLine(const QVector<QPointF> &seamAllowance, PassmarkSide side) const;
|
QVector<QLineF> SAPassmarkBaseLine(const QVector<QPointF> &seamAllowance, PassmarkSide side) const;
|
||||||
|
|
||||||
QPainterPath SAPassmarkPath(const VPiece& piece, const VContainer *data, PassmarkSide side) const;
|
QPainterPath SAPassmarkPath(const VPiece& piece, const VContainer *data, PassmarkSide side) const;
|
||||||
QPainterPath BuiltInSAPassmarkPath(const VPiece &piece, const VContainer *data) const;
|
QPainterPath BuiltInSAPassmarkPath(const VPiece &piece, const VContainer *data) const;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user