Clang warning.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-05-08 20:28:48 +03:00
parent a05bf82c24
commit 8b0f1c0cc9

View File

@ -72,298 +72,6 @@ QVector<quint32> PieceMissingNodes(const QVector<quint32> &d1Nodes, const QVecto
return r;
}
const qreal passmarkGap = (1.5/*mm*/ / 25.4) * PrintDPI;
//---------------------------------------------------------------------------------------------------------------------
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;
{
QLineF line1 = line;
line1.setAngle(line1.angle() + 90);
line1.setLength(passmarkGap/2.);
l1p1 = line1.p2();
}
QPointF l2p1;
{
QLineF line2 = line;
line2.setAngle(line2.angle() - 90);
line2.setLength(passmarkGap/2.);
l2p1 = line2.p2();
}
QPointF l1p2;
{
QLineF line1 = QLineF(line.p2(), line.p1());
line1.setAngle(line1.angle() - 90);
line1.setLength(passmarkGap/2.);
l1p2 = line1.p2();
}
QPointF l2p2;
{
QLineF line2 = QLineF(line.p2(), line.p1());
line2.setAngle(line2.angle() + 90);
line2.setLength(passmarkGap/2.);
l2p2 = line2.p2();
}
QVector<QLineF> lines;
QLineF seg = FindIntersection(QLineF(l1p2, l1p1), seamAllowance);
lines.append(QLineF(seg.p2(), seg.p1()));
seg = FindIntersection(QLineF(l2p2, l2p1), seamAllowance);
lines.append(QLineF(seg.p2(), seg.p1()));
return lines;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QLineF> CreateThreePassmarkLines(const QLineF &line, const QVector<QPointF> &seamAllowance)
{
QPointF l1p1;
{
QLineF line1 = line;
line1.setAngle(line1.angle() + 90);
line1.setLength(passmarkGap);
l1p1 = line1.p2();
}
QPointF l2p1;
{
QLineF line2 = line;
line2.setAngle(line2.angle() - 90);
line2.setLength(passmarkGap);
l2p1 = line2.p2();
}
QPointF l1p2;
{
QLineF line1 = QLineF(line.p2(), line.p1());
line1.setAngle(line1.angle() - 90);
line1.setLength(passmarkGap);
l1p2 = line1.p2();
}
QPointF l2p2;
{
QLineF line2 = QLineF(line.p2(), line.p1());
line2.setAngle(line2.angle() + 90);
line2.setLength(passmarkGap);
l2p2 = line2.p2();
}
QVector<QLineF> lines;
QLineF seg = FindIntersection(QLineF(l1p2, l1p1), seamAllowance);
lines.append(QLineF(seg.p2(), seg.p1()));
lines.append(line);
seg = FindIntersection(QLineF(l2p2, l2p1), seamAllowance);
lines.append(QLineF(seg.p2(), seg.p1()));
return lines;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QLineF> CreateTMarkPassmark(const QLineF &line)
{
QPointF p1;
{
QLineF tmpLine = QLineF(line.p2(), line.p1());
tmpLine.setAngle(tmpLine.angle() - 90);
tmpLine.setLength(line.length() * 0.75 / 2);
p1 = tmpLine.p2();
}
QPointF p2;
{
QLineF tmpLine = QLineF(line.p2(), line.p1());
tmpLine.setAngle(tmpLine.angle() + 90);
tmpLine.setLength(line.length() * 0.75 / 2);
p2 = tmpLine.p2();
}
QVector<QLineF> lines;
lines.append(line);
lines.append(QLineF(p1, p2));
return lines;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QLineF> CreateVMarkPassmark(const QLineF &line)
{
QLineF l1 = line;
l1.setAngle(l1.angle() - 35);
QLineF l2 = line;
l2.setAngle(l2.angle() + 35);
QVector<QLineF> lines;
lines.append(l1);
lines.append(l2);
return lines;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QLineF> CreateVMark2Passmark(const QLineF &line, const QVector<QPointF> &seamAllowance)
{
QLineF l1 = QLineF(line.p2(), line.p1());
l1.setAngle(l1.angle() + 35);
QLineF l2 = QLineF(line.p2(), line.p1());
l2.setAngle(l2.angle() - 35);
QVector<QLineF> lines;
lines.append(FindIntersection(l1, seamAllowance));
lines.append(FindIntersection(l2, seamAllowance));
return lines;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QLineF> PointsToSegments(const QVector<QPointF> &points)
{
QVector<QLineF> lines;
if (points.size() >= 2)
{
for (int i=0; i < points.size()-1; ++i)
{
QLineF segment = QLineF(points.at(i), points.at(i+1));
if (segment.length() > 0)
{
lines.append(segment);
}
}
}
return lines;
}
const qreal passmarkRadiusFactor = 0.45;
//---------------------------------------------------------------------------------------------------------------------
QVector<QLineF> CreateUMarkPassmark(const QLineF &line, const QVector<QPointF> &seamAllowance)
{
const qreal radius = line.length() * passmarkRadiusFactor;
QPointF l1p1;
{
QLineF line1 = line;
line1.setAngle(line1.angle() + 90);
line1.setLength(radius);
l1p1 = line1.p2();
}
QPointF l2p1;
{
QLineF line2 = line;
line2.setAngle(line2.angle() - 90);
line2.setLength(radius);
l2p1 = line2.p2();
}
QPointF l1p2;
{
QLineF line1 = QLineF(line.p2(), line.p1());
line1.setAngle(line1.angle() - 90);
line1.setLength(radius);
l1p2 = line1.p2();
}
QPointF l2p2;
{
QLineF line2 = QLineF(line.p2(), line.p1());
line2.setAngle(line2.angle() + 90);
line2.setLength(radius);
l2p2 = line2.p2();
}
QLineF axis = QLineF(line.p2(), line.p1());
axis.setLength(radius);
QVector<QPointF> points;
QLineF seg = FindIntersection(QLineF(l2p2, l2p1), seamAllowance);
seg = QLineF(seg.p2(), seg.p1());
seg.setLength(seg.length() - radius);
points.append(seg.p1());
points.append(seg.p2());
VArc arc(VPointF(axis.p2()), radius, QLineF(l1p2, l2p2).angle(), QLineF(l1p2, l2p2).angle()+180);
arc.SetApproximationScale(10);
points += arc.GetPoints();
seg = FindIntersection(QLineF(l1p2, l1p1), seamAllowance);
seg = QLineF(seg.p2(), seg.p1());
seg.setLength(seg.length() - radius);
points.append(seg.p2());
points.append(seg.p1());
return PointsToSegments(points);
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QLineF> CreateBoxMarkPassmark(const QLineF &line, const QVector<QPointF> &seamAllowance)
{
const qreal radius = line.length() * passmarkRadiusFactor;
QPointF l1p1;
{
QLineF line1 = line;
line1.setAngle(line1.angle() + 90);
line1.setLength(radius);
l1p1 = line1.p2();
}
QPointF l2p1;
{
QLineF line2 = line;
line2.setAngle(line2.angle() - 90);
line2.setLength(radius);
l2p1 = line2.p2();
}
QPointF l1p2;
{
QLineF line1 = QLineF(line.p2(), line.p1());
line1.setAngle(line1.angle() - 90);
line1.setLength(radius);
l1p2 = line1.p2();
}
QPointF l2p2;
{
QLineF line2 = QLineF(line.p2(), line.p1());
line2.setAngle(line2.angle() + 90);
line2.setLength(radius);
l2p2 = line2.p2();
}
QVector<QPointF> points;
QLineF seg = FindIntersection(QLineF(l1p2, l1p1), seamAllowance);
points.append(seg.p2());
points.append(seg.p1());
seg = FindIntersection(QLineF(l2p2, l2p1), seamAllowance);
points.append(seg.p1());
points.append(seg.p2());
return PointsToSegments(points);
}
//---------------------------------------------------------------------------------------------------------------------
bool IsPassmarksPossible(const QVector<VPieceNode> &path)
{