Correct passmark shape. It shouldn't go beyond a piece path.
--HG-- branch : develop
This commit is contained in:
parent
2c58263df1
commit
851ed6590c
|
@ -74,7 +74,21 @@ QVector<quint32> PieceMissingNodes(const QVector<quint32> &d1Nodes, const QVecto
|
||||||
const qreal passmarkGap = (1.5/*mm*/ / 25.4) * PrintDPI;
|
const qreal passmarkGap = (1.5/*mm*/ / 25.4) * PrintDPI;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QLineF> CreateTwoPassmarkLines(const QLineF &line)
|
QLineF FindIntersection(const QLineF &line, const QVector<QPointF> &seamAllowance)
|
||||||
|
{
|
||||||
|
QLineF testLine = line;
|
||||||
|
testLine.setLength(testLine.length()*10);
|
||||||
|
QVector<QPointF> intersections = VAbstractCurve::CurveIntersectLine(seamAllowance, testLine);
|
||||||
|
if (not intersections.isEmpty())
|
||||||
|
{
|
||||||
|
return QLineF(line.p1(), intersections.last());
|
||||||
|
}
|
||||||
|
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<QLineF> CreateTwoPassmarkLines(const QLineF &line, const QVector<QPointF> &seamAllowance)
|
||||||
{
|
{
|
||||||
QPointF l1p1;
|
QPointF l1p1;
|
||||||
{
|
{
|
||||||
|
@ -109,13 +123,16 @@ QVector<QLineF> CreateTwoPassmarkLines(const QLineF &line)
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QLineF> lines;
|
QVector<QLineF> lines;
|
||||||
lines.append(QLineF(l1p1, l1p2));
|
QLineF seg = FindIntersection(QLineF(l1p2, l1p1), seamAllowance);
|
||||||
lines.append(QLineF(l2p1, l2p2));
|
lines.append(QLineF(seg.p2(), seg.p1()));
|
||||||
|
|
||||||
|
seg = FindIntersection(QLineF(l2p2, l2p1), seamAllowance);
|
||||||
|
lines.append(QLineF(seg.p2(), seg.p1()));
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QLineF> CreateThreePassmarkLines(const QLineF &line)
|
QVector<QLineF> CreateThreePassmarkLines(const QLineF &line, const QVector<QPointF> &seamAllowance)
|
||||||
{
|
{
|
||||||
QPointF l1p1;
|
QPointF l1p1;
|
||||||
{
|
{
|
||||||
|
@ -150,9 +167,13 @@ QVector<QLineF> CreateThreePassmarkLines(const QLineF &line)
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QLineF> lines;
|
QVector<QLineF> lines;
|
||||||
lines.append(QLineF(l1p1, l1p2));
|
QLineF seg = FindIntersection(QLineF(l1p2, l1p1), seamAllowance);
|
||||||
|
lines.append(QLineF(seg.p2(), seg.p1()));
|
||||||
|
|
||||||
lines.append(line);
|
lines.append(line);
|
||||||
lines.append(QLineF(l2p1, l2p2));
|
|
||||||
|
seg = FindIntersection(QLineF(l2p2, l2p1), seamAllowance);
|
||||||
|
lines.append(QLineF(seg.p2(), seg.p1()));
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,20 +217,6 @@ QVector<QLineF> CreateVMarkPassmark(const QLineF &line)
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QLineF FindIntersection(const QLineF &line, const QVector<QPointF> &seamAllowance)
|
|
||||||
{
|
|
||||||
QLineF testLine = line;
|
|
||||||
testLine.setLength(testLine.length()*10);
|
|
||||||
QVector<QPointF> intersections = VAbstractCurve::CurveIntersectLine(seamAllowance, testLine);
|
|
||||||
if (not intersections.isEmpty())
|
|
||||||
{
|
|
||||||
return QLineF(line.p1(), intersections.last());
|
|
||||||
}
|
|
||||||
|
|
||||||
return line;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QLineF> CreateVMark2Passmark(const QLineF &line, const QVector<QPointF> &seamAllowance)
|
QVector<QLineF> CreateVMark2Passmark(const QLineF &line, const QVector<QPointF> &seamAllowance)
|
||||||
{
|
{
|
||||||
|
@ -373,10 +380,10 @@ QVector<QLineF> CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType
|
||||||
switch (lineType)
|
switch (lineType)
|
||||||
{
|
{
|
||||||
case PassmarkLineType::TwoLines:
|
case PassmarkLineType::TwoLines:
|
||||||
passmarksLines += CreateTwoPassmarkLines(line);
|
passmarksLines += CreateTwoPassmarkLines(line, seamAllowance);
|
||||||
break;
|
break;
|
||||||
case PassmarkLineType::ThreeLines:
|
case PassmarkLineType::ThreeLines:
|
||||||
passmarksLines += CreateThreePassmarkLines(line);
|
passmarksLines += CreateThreePassmarkLines(line, seamAllowance);
|
||||||
break;
|
break;
|
||||||
case PassmarkLineType::TMark:
|
case PassmarkLineType::TMark:
|
||||||
passmarksLines += CreateTMarkPassmark(line);
|
passmarksLines += CreateTMarkPassmark(line);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user