QLineF::IntersectType QLineF::intersect(const QLineF&, QPointF*) const' is

deprecated: Use intersects() instead.
(grafted from b8646bf40865848ad48eae89cae8419483d56f6b)

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2020-01-06 18:34:35 +02:00
parent 57b9868316
commit d74225e63e
13 changed files with 176 additions and 0 deletions

View File

@ -105,7 +105,11 @@ qreal CSR(qreal length, qreal split, qreal arcLength)
tmp.setAngle(tmp.angle()+angle*sign);
QPointF crosPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const auto type = line.intersects(tmp, &crosPoint);
#else
const auto type = line.intersect(tmp, &crosPoint);
#endif
if (type == QLineF::NoIntersection)
{
return 0;

View File

@ -401,7 +401,12 @@ QVector<QPointF> VAbstractCurve::CurveIntersectLine(const QVector<QPointF> &poin
for ( auto i = 0; i < points.count()-1; ++i )
{
QPointF crosPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const auto type = line.intersects(QLineF(points.at(i), points.at(i+1)), &crosPoint);
#else
const auto type = line.intersect(QLineF(points.at(i), points.at(i+1)), &crosPoint);
#endif
if ( type == QLineF::BoundedIntersection )
{
intersections.append(crosPoint);

View File

@ -352,22 +352,45 @@ QPointF VGObject::LineIntersectRect(const QRectF &rec, const QLineF &line)
qreal x1, y1, x2, y2;
rec.getCoords(&x1, &y1, &x2, &y2);
QPointF point;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = line.intersects(QLineF(QPointF(x1, y1), QPointF(x1, y2)), &point);
#else
QLineF::IntersectType type = line.intersect(QLineF(QPointF(x1, y1), QPointF(x1, y2)), &point);
#endif
if ( type == QLineF::BoundedIntersection )
{
return point;
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = line.intersects(QLineF(QPointF(x1, y1), QPointF(x2, y1)), &point);
#else
type = line.intersect(QLineF(QPointF(x1, y1), QPointF(x2, y1)), &point);
#endif
if ( type == QLineF::BoundedIntersection )
{
return point;
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = line.intersects(QLineF(QPointF(x1, y2), QPointF(x2, y2)), &point);
#else
type = line.intersect(QLineF(QPointF(x1, y2), QPointF(x2, y2)), &point);
#endif
if ( type == QLineF::BoundedIntersection )
{
return point;
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = line.intersects(QLineF(QPointF(x2, y1), QPointF(x2, y2)), &point);
#else
type = line.intersect(QLineF(QPointF(x2, y1), QPointF(x2, y2)), &point);
#endif
if ( type == QLineF::BoundedIntersection )
{
return point;
@ -479,7 +502,12 @@ QPointF VGObject::ClosestPoint(const QLineF &line, const QPointF &point)
qreal y = b + point.y();
QLineF lin (point, QPointF(x, y));
QPointF p;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = line.intersects(lin, &p);
#else
QLineF::IntersectType intersect = line.intersect(lin, &p);
#endif
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{
return p;

View File

@ -108,7 +108,12 @@ QVector<VRawSAPoint> AngleByLength(QVector<VRawSAPoint> points, QPointF p1, QPoi
// We do not check intersection type because intersection must alwayse exist
QPointF px;
cutLine.setAngle(cutLine.angle()+90);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = QLineF(sp1, sp2).intersects(cutLine, &px);
#else
QLineF::IntersectType type = QLineF(sp1, sp2).intersect(cutLine, &px);
#endif
if (type == QLineF::NoIntersection)
{
qDebug()<<"Couldn't find intersection with cut line.";
@ -116,7 +121,12 @@ QVector<VRawSAPoint> AngleByLength(QVector<VRawSAPoint> points, QPointF p1, QPoi
points.append(px);
cutLine.setAngle(cutLine.angle()-180);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = QLineF(sp2, sp3).intersects(cutLine, &px);
#else
type = QLineF(sp2, sp3).intersect(cutLine, &px);
#endif
if (type == QLineF::NoIntersection)
{
qDebug()<<"Couldn't find intersection with cut line.";
@ -226,7 +236,12 @@ QVector<VRawSAPoint> AngleByIntersection(const QVector<VRawSAPoint> &points, QPo
QLineF edge2(p2, p3);
QPointF px;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = edge2.intersects(bigLine1, &px);
#else
QLineF::IntersectType type = edge2.intersect(bigLine1, &px);
#endif
if (type == QLineF::NoIntersection)
{
return AngleByLength(points, p1, p2, p3, bigLine1, sp2, bigLine2, p, width, needRollback);
@ -261,7 +276,12 @@ QVector<VRawSAPoint> AngleByIntersection(const QVector<VRawSAPoint> &points, QPo
// Second point
QLineF edge1(p1, p2);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = edge1.intersects(bigLine2, &px);
#else
type = edge1.intersect(bigLine2, &px);
#endif
if (type == QLineF::NoIntersection)
{
return AngleByLength(points, p1, p2, p3, bigLine1, sp2, bigLine2, p, width, needRollback);
@ -310,14 +330,24 @@ QVector<VRawSAPoint> AngleByFirstSymmetry(const QVector<VRawSAPoint> &points, QP
QLineF sEdge(VPointF::FlipPF(axis, bigLine2.p1()), VPointF::FlipPF(axis, bigLine2.p2()));
QPointF px1;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = sEdge.intersects(bigLine1, &px1);
#else
QLineF::IntersectType type = sEdge.intersect(bigLine1, &px1);
#endif
if (type == QLineF::NoIntersection)
{
return AngleByLength(points, p1, p2, p3, bigLine1, sp2, bigLine2, p, width, needRollback);
}
QPointF px2;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = sEdge.intersects(bigLine2, &px2);
#else
type = sEdge.intersect(bigLine2, &px2);
#endif
if (type == QLineF::NoIntersection)
{
return AngleByLength(points, p1, p2, p3, bigLine1, sp2, bigLine2, p, width, needRollback);
@ -389,14 +419,24 @@ QVector<VRawSAPoint> AngleBySecondSymmetry(const QVector<VRawSAPoint> &points, Q
QLineF sEdge(VPointF::FlipPF(axis, bigLine1.p1()), VPointF::FlipPF(axis, bigLine1.p2()));
QPointF px1;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = sEdge.intersects(bigLine1, &px1);
#else
QLineF::IntersectType type = sEdge.intersect(bigLine1, &px1);
#endif
if (type == QLineF::NoIntersection)
{
return AngleByLength(points, p1, p2, p3, bigLine1, sp2, bigLine2, p, width, needRollback);
}
QPointF px2;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = sEdge.intersects(bigLine2, &px2);
#else
type = sEdge.intersect(bigLine2, &px2);
#endif
if (type == QLineF::NoIntersection)
{
return AngleByLength(points, p1, p2, p3, bigLine1, sp2, bigLine2, p, width, needRollback);
@ -465,7 +505,12 @@ QVector<VRawSAPoint> AngleByFirstRightAngle(const QVector<VRawSAPoint> &points,
QLineF edge(p1, p2);
QPointF px;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = edge.intersects(bigLine2, &px);
#else
QLineF::IntersectType type = edge.intersect(bigLine2, &px);
#endif
if (type == QLineF::NoIntersection)
{
return AngleByLength(points, p1, p2, p3, bigLine1, sp2, bigLine2, p, width, needRollback);
@ -538,7 +583,12 @@ QVector<VRawSAPoint> AngleBySecondRightAngle(QVector<VRawSAPoint> points, QPoint
QLineF edge(p2, p3);
QPointF px;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = edge.intersects(bigLine1, &px);
#else
QLineF::IntersectType type = edge.intersect(bigLine1, &px);
#endif
if (type == QLineF::NoIntersection)
{
return AngleByLength(points, p1, p2, p3, bigLine1, sp2, bigLine2, p, width, needRollback);
@ -809,7 +859,11 @@ void RollbackBySecondEdgeRightAngle(QVector<VRawSAPoint> &ekvPoints, const QVect
const QLineF bigLine1 = VAbstractPiece::ParallelLine(points.at(points.size()-2), points.at(0), width);
QPointF px;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
edge.intersects(bigLine1, &px);
#else
edge.intersect(bigLine1, &px);
#endif
ekvPoints.removeLast();
@ -821,7 +875,12 @@ void RollbackBySecondEdgeRightAngle(QVector<VRawSAPoint> &ekvPoints, const QVect
const QLineF edge2(ekvPoints.at(0), ekvPoints.at(1));
QPointF crosPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QLineF::IntersectType type = edge1.intersects(edge2, &crosPoint );
#else
const QLineF::IntersectType type = edge1.intersect(edge2, &crosPoint );
#endif
if (type == QLineF::BoundedIntersection)
{
ekvPoints.removeFirst();
@ -1252,7 +1311,11 @@ QVector<QPointF> VAbstractPiece::CheckLoops(const QVector<VRawSAPoint> &points)
if (uniqueVertices.size() == 4)
{// Lines are not neighbors
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QLineF::IntersectType intersect = line1.intersects(line2, &crosPoint);
#else
const QLineF::IntersectType intersect = line1.intersect(line2, &crosPoint);
#endif
if (intersect == QLineF::NoIntersection)
{ // According to the documentation QLineF::NoIntersection indicates that the lines do not intersect;
// i.e. they are parallel. But parallel also mean they can be on the same line.
@ -1332,7 +1395,12 @@ QVector<VRawSAPoint> VAbstractPiece::EkvPoint(QVector<VRawSAPoint> points, const
}
QPointF crosPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QLineF::IntersectType type = bigLine1.intersects( bigLine2, &crosPoint );
#else
const QLineF::IntersectType type = bigLine1.intersect( bigLine2, &crosPoint );
#endif
switch (type)
{// There are at least three big cases
case (QLineF::BoundedIntersection):
@ -1429,7 +1497,11 @@ QT_WARNING_POP
const QLineF bigEdge = ParallelLine(p1Line1, p1Line2, localWidth );
QPointF px;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QLineF::IntersectType type = bigEdge.intersects(line, &px);
#else
const QLineF::IntersectType type = bigEdge.intersect(line, &px);
#endif
if (type != QLineF::BoundedIntersection && line.length() < QLineF(p2Line1, px).length())
{
points.append(crosPoint);
@ -1560,7 +1632,12 @@ bool VAbstractPiece::IsAllowanceValid(const QVector<QPointF> &base, const QVecto
}
QPointF crosPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const auto type = baseSegment.intersects(allowanceSegment, &crosPoint);
#else
const auto type = baseSegment.intersect(allowanceSegment, &crosPoint);
#endif
if (type == QLineF::BoundedIntersection
&& not VFuzzyComparePoints(baseSegment.p1(), crosPoint)
&& not VFuzzyComparePoints(baseSegment.p2(), crosPoint)
@ -1718,7 +1795,12 @@ QVector<VRawSAPoint> VAbstractPiece::RollbackSeamAllowance(QVector<VRawSAPoint>
{
QLineF segment(points.at(i), points.at(i-1));
QPointF crosPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QLineF::IntersectType type = cuttingEdge.intersects(segment, &crosPoint);
#else
const QLineF::IntersectType type = cuttingEdge.intersect(segment, &crosPoint);
#endif
if (type != QLineF::NoIntersection
&& VGObject::IsPointOnLineSegment(crosPoint, segment.p1(), segment.p2())
&& IsSameDirection(cuttingEdge.p2(), cuttingEdge.p1(), crosPoint))
@ -1738,7 +1820,12 @@ QVector<VRawSAPoint> VAbstractPiece::RollbackSeamAllowance(QVector<VRawSAPoint>
{
QPointF crosPoint;
QLineF secondLast(points.at(points.size()-2), points.at(points.size()-1));
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = secondLast.intersects(cuttingEdge, &crosPoint);
#else
QLineF::IntersectType type = secondLast.intersect(cuttingEdge, &crosPoint);
#endif
if (type != QLineF::NoIntersection && IsOutsidePoint(secondLast.p1(), secondLast.p2(), crosPoint))
{
points.append(crosPoint);

View File

@ -239,7 +239,11 @@ void DialogLineIntersect::PointNameChanged()
QLineF line1(static_cast<QPointF>(*p1Line1), static_cast<QPointF>(*p2Line1));
QLineF line2(static_cast<QPointF>(*p1Line2), static_cast<QPointF>(*p2Line2));
QPointF fPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = line1.intersects(line2, &fPoint);
#else
QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
#endif
flagError = not (set.size() < 3 || intersect == QLineF::NoIntersection);
@ -281,7 +285,11 @@ bool DialogLineIntersect::CheckIntersecion()
QLineF line1(static_cast<QPointF>(*p1L1), static_cast<QPointF>(*p2L1));
QLineF line2(static_cast<QPointF>(*p1L2), static_cast<QPointF>(*p2L2));
QPointF fPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = line1.intersects(line2, &fPoint);
#else
QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
#endif
return intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection;
}
catch (const VExceptionBadId &)

View File

@ -78,7 +78,11 @@ void VToolTrueDarts::FindPoint(const QPointF &baseLineP1, const QPointF &baseLin
QLineF d2blP2(dartP2, baseLineP2);
d2blP2.setAngle(d2blP2.angle()+degrees);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
if (QLineF(baseLineP1, d2blP2.p2()).intersects(d2d1, &p1) == QLineF::NoIntersection)
#else
if (QLineF(baseLineP1, d2blP2.p2()).intersect(d2d1, &p1) == QLineF::NoIntersection)
#endif
{
p1 = QPointF(0, 0);
p2 = QPointF(0, 0);

View File

@ -180,7 +180,12 @@ bool VToolLineIntersectAxis::FindPoint(const QLineF &axis, const QLineF &line, Q
SCASSERT(intersectionPoint != nullptr)
QPointF fPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = axis.intersects(line, &fPoint);
#else
QLineF::IntersectType intersect = axis.intersect(line, &fPoint);
#endif
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{
if(VFuzzyComparePossibleNulls(axis.angle(), line.angle())

View File

@ -140,7 +140,12 @@ VToolLineIntersect* VToolLineIntersect::Create(VToolLineIntersectInitData initDa
QLineF line1(static_cast<QPointF>(*p1Line1), static_cast<QPointF>(*p2Line1));
QLineF line2(static_cast<QPointF>(*p1Line2), static_cast<QPointF>(*p2Line2));
QPointF fPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QLineF::IntersectType intersect = line1.intersects(line2, &fPoint);
#else
const QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
#endif
if (intersect == QLineF::NoIntersection)
{
qWarning() << tr("Error calculating point '%1'. Lines (%2;%3) and (%4;%5) have no point of intersection")

View File

@ -201,7 +201,12 @@ bool VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, cons
QLineF hypotenuse(firstPoint, secondPoint);
QPointF startPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = axis.intersects(hypotenuse, &startPoint);
#else
QLineF::IntersectType intersect = axis.intersect(hypotenuse, &startPoint);
#endif
if (intersect != QLineF::UnboundedIntersection && intersect != QLineF::BoundedIntersection)
{
return false;

View File

@ -116,7 +116,12 @@ void VisToolHeight::setLineP2Id(const quint32 &value)
void VisToolHeight::ShowIntersection(const QLineF &height_line, const QLineF &base_line)
{
QPointF p;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = height_line.intersects(base_line, &p);
#else
QLineF::IntersectType intersect = height_line.intersect(base_line, &p);
#endif
if (intersect == QLineF::UnboundedIntersection)
{
line_intersection->setVisible(true);

View File

@ -87,7 +87,12 @@ void VisToolLineIntersect::RefreshGeometry()
QLineF l1(static_cast<QPointF>(*first), static_cast<QPointF>(*second));
QLineF l2(static_cast<QPointF>(*third), Visualization::scenePos);
QPointF fPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = l1.intersects(l2, &fPoint);
#else
QLineF::IntersectType intersect = l1.intersect(l2, &fPoint);
#endif
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{
DrawPoint(point, fPoint, mainColor);
@ -103,7 +108,12 @@ void VisToolLineIntersect::RefreshGeometry()
QLineF l1(static_cast<QPointF>(*first), static_cast<QPointF>(*second));
QLineF l2(static_cast<QPointF>(*third), static_cast<QPointF>(*forth));
QPointF fPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = l1.intersects(l2, &fPoint);
#else
QLineF::IntersectType intersect = l1.intersect(l2, &fPoint);
#endif
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{
DrawPoint(point, fPoint, mainColor);

View File

@ -140,7 +140,12 @@ void VisToolLineIntersectAxis::setAxisPointId(const quint32 &value)
void VisToolLineIntersectAxis::ShowIntersection(const QLineF &axis_line, const QLineF &base_line)
{
QPointF p;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = axis_line.intersects(base_line, &p);
#else
QLineF::IntersectType intersect = axis_line.intersect(base_line, &p);
#endif
if (intersect == QLineF::UnboundedIntersection)
{
line_intersection->setVisible(true);

View File

@ -97,7 +97,12 @@ void VisToolPointOfIntersection::setPoint2Id(const quint32 &value)
void VisToolPointOfIntersection::ShowIntersection(const QLineF &axis1, const QLineF &axis2, const QColor &color)
{
QPointF p;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = axis1.intersects(axis2, &p);
#else
QLineF::IntersectType intersect = axis1.intersect(axis2, &p);
#endif
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{
point->setVisible(true);