Refactoring. Hide compatibility layer behind a function.

QLineF::intersects.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2020-01-16 17:34:08 +02:00
parent 84277d6f60
commit 98a88ed529
19 changed files with 125 additions and 197 deletions

View File

@ -37,6 +37,7 @@
#include "vabstractcurve_p.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/compatibility.h"
VAbstractCurve::VAbstractCurve(const GOType &type, const quint32 &idObject, const Draw &mode)
:VGObject(type, idObject, mode), d (new VAbstractCurveData())
@ -401,11 +402,7 @@ 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
auto type = Intersects(line, QLineF(points.at(i), points.at(i+1)), &crosPoint);
if (type == QLineF::BoundedIntersection)
{

View File

@ -35,6 +35,7 @@
#include "../vmisc/vmath.h"
#include "../ifc/ifcdef.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/compatibility.h"
#include "vabstractcurve.h"
#include "vellipticalarc_p.h"
#include "vspline.h"

View File

@ -38,6 +38,7 @@
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
#include "../vmisc/compatibility.h"
#include "../ifc/ifcdef.h"
#include "vgobject_p.h"
@ -352,44 +353,28 @@ 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
QLineF::IntersectType type = Intersects(line, QLineF(QPointF(x1, y1), QPointF(x1, y2)), &point);
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
type = Intersects(line, QLineF(QPointF(x1, y1), QPointF(x2, y1)), &point);
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
type = Intersects(line, QLineF(QPointF(x1, y2), QPointF(x2, y2)), &point);
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
type = Intersects(line, QLineF(QPointF(x2, y1), QPointF(x2, y2)), &point);
if ( type == QLineF::BoundedIntersection )
{
@ -502,11 +487,7 @@ 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
QLineF::IntersectType intersect = Intersects(line, lin, &p);
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{

View File

@ -34,6 +34,7 @@
#include "../ifc/exception/vexception.h"
#include "../vmisc/vmath.h"
#include "../vmisc/compatibility.h"
#include "vabstractcurve.h"
#include "vsplinepath_p.h"

View File

@ -32,6 +32,7 @@
#include "../vgeometry/vpointf.h"
#include "../ifc/exception/vexception.h"
#include "../vmisc/vmath.h"
#include "../vmisc/compatibility.h"
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
#include "../vpatterndb/vcontainer.h"
#include "../vpatterndb/calculator.h"
@ -108,11 +109,7 @@ 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
QLineF::IntersectType type = Intersects(QLineF(sp1, sp2), cutLine, &px);
if (type == QLineF::NoIntersection)
{
@ -121,11 +118,7 @@ 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
type = Intersects(QLineF(sp2, sp3), cutLine, &px);
if (type == QLineF::NoIntersection)
{
@ -236,11 +229,7 @@ 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
QLineF::IntersectType type = Intersects(edge2, bigLine1, &px);
if (type == QLineF::NoIntersection)
{
@ -275,12 +264,7 @@ 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
type = Intersects(edge1, bigLine2, &px);
if (type == QLineF::NoIntersection)
{
@ -330,11 +314,7 @@ 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
QLineF::IntersectType type = Intersects(sEdge, bigLine1, &px1);
if (type == QLineF::NoIntersection)
{
@ -342,11 +322,7 @@ QVector<VRawSAPoint> AngleByFirstSymmetry(const QVector<VRawSAPoint> &points, QP
}
QPointF px2;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = sEdge.intersects(bigLine2, &px2);
#else
type = sEdge.intersect(bigLine2, &px2);
#endif
type = Intersects(sEdge, bigLine2, &px2);
if (type == QLineF::NoIntersection)
{
@ -419,11 +395,7 @@ 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
QLineF::IntersectType type = Intersects(sEdge, bigLine1, &px1);
if (type == QLineF::NoIntersection)
{
@ -431,11 +403,7 @@ QVector<VRawSAPoint> AngleBySecondSymmetry(const QVector<VRawSAPoint> &points, Q
}
QPointF px2;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = sEdge.intersects(bigLine2, &px2);
#else
type = sEdge.intersect(bigLine2, &px2);
#endif
type = Intersects(sEdge, bigLine2, &px2);
if (type == QLineF::NoIntersection)
{
@ -505,11 +473,7 @@ 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
QLineF::IntersectType type = Intersects(edge, bigLine2, &px);
if (type == QLineF::NoIntersection)
{
@ -583,11 +547,7 @@ 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
QLineF::IntersectType type = Intersects(edge, bigLine1, &px);
if (type == QLineF::NoIntersection)
{
@ -859,11 +819,7 @@ 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
Intersects(edge, bigLine1, &px);
ekvPoints.removeLast();
@ -875,11 +831,7 @@ 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
const QLineF::IntersectType type = Intersects(edge1, edge2, &crosPoint );
if (type == QLineF::BoundedIntersection)
{
@ -1311,11 +1263,7 @@ 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
const QLineF::IntersectType intersect = Intersects(line1, line2, &crosPoint);
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.
@ -1395,11 +1343,7 @@ 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
const QLineF::IntersectType type = Intersects(bigLine1, bigLine2, &crosPoint );
switch (type)
{// There are at least three big cases
@ -1497,11 +1441,7 @@ 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
const QLineF::IntersectType type = Intersects(bigEdge, line, &px);
if (type != QLineF::BoundedIntersection && line.length() < QLineF(p2Line1, px).length())
{
points.append(crosPoint);
@ -1632,11 +1572,7 @@ 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
const auto type = Intersects(baseSegment, allowanceSegment, &crosPoint);
if (type == QLineF::BoundedIntersection
&& not VFuzzyComparePoints(baseSegment.p1(), crosPoint)
@ -1795,11 +1731,7 @@ 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
const QLineF::IntersectType type = Intersects(cuttingEdge, segment, &crosPoint);
if (type != QLineF::NoIntersection
&& VGObject::IsPointOnLineSegment(crosPoint, segment.p1(), segment.p2())
@ -1820,11 +1752,7 @@ 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
QLineF::IntersectType type = Intersects(secondLast, cuttingEdge, &crosPoint);
if (type != QLineF::NoIntersection && IsOutsidePoint(secondLast.p1(), secondLast.p2(), crosPoint))
{

View File

@ -49,6 +49,7 @@
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
#include "../vmisc/vmath.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/compatibility.h"
#include "../vpatterndb/vcontainer.h"
#include "../vpatterndb/calculator.h"
#include "../vpatterndb/vpassmark.h"

View File

@ -0,0 +1,72 @@
/************************************************************************
**
** @file compatibility.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 16 1, 2020
**
** @brief
** @copyright
** This source code is part of the Valentina project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2020 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef COMPATIBILITY_H
#define COMPATIBILITY_H
#include <QtGlobal>
#include <QStringList>
#include <QSet>
class QPointF;
// Contains helpful methods to hide version dependent code. It can be deprecation of method or change in API
//---------------------------------------------------------------------------------------------------------------------
template <typename T, template <typename> class Cont>
inline const T& ConstFirst (const Cont<T> &container)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return container.constFirst();
#else
return container.first(); // clazy:exclude=detaching-temporary
#endif
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T, typename C>
inline const T& ConstFirst (const C &container)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return container.constFirst();
#else
return container.first(); // clazy:exclude=detaching-temporary
#endif
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
inline typename T::IntersectType Intersects(const T &l1, const T &l2, QPointF *intersectionPoint)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
return l1.intersects(l2, intersectionPoint);
#else
return l1.intersect(l2, intersectionPoint);
#endif
}
#endif // COMPATIBILITY_H

View File

@ -360,26 +360,6 @@ enum class GSizes : quint8 { ALL,
#endif // defined(__cplusplus)
#endif // QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
template <typename T, template <typename> class Cont>
inline const T& ConstFirst (const Cont<T> &container)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return container.constFirst();
#else
return container.first(); // clazy:exclude=detaching-temporary
#endif
}
template <typename T, typename C>
inline const T& ConstFirst (const C &container)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return container.constFirst();
#else
return container.first(); // clazy:exclude=detaching-temporary
#endif
}
bool IsOptionSet(int argc, char *argv[], const char *option);
void InitHighDpiScaling(int argc, char *argv[]);

View File

@ -44,6 +44,7 @@
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
#include "../vmisc/compatibility.h"
#include "../vpatterndb/pmsystems.h"
namespace

View File

@ -24,6 +24,7 @@ contains(DEFINES, APPIMAGE) {
}
HEADERS += \
$$PWD/compatibility.h \
$$PWD/stable.h \
$$PWD/def.h \
$$PWD/vmath.h \

View File

@ -46,6 +46,7 @@
#include "../ifc/xml/vabstractpattern.h"
#include "../vgeometry/vpointf.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/compatibility.h"
#include "../vpatterndb/vcontainer.h"
#include "dialogtool.h"
#include "ui_dialoglineintersect.h"
@ -239,11 +240,7 @@ 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
QLineF::IntersectType intersect = Intersects(line1, line2, &fPoint);
flagError = not (set.size() < 3 || intersect == QLineF::NoIntersection);
@ -285,11 +282,7 @@ 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
QLineF::IntersectType intersect = Intersects(line1, line2, &fPoint);
return intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection;
}
catch (const VExceptionBadId &)

View File

@ -49,6 +49,7 @@
#include "../../../vabstracttool.h"
#include "../../vdrawtool.h"
#include "vtooldoublepoint.h"
#include "../vmisc/compatibility.h"
template <class T> class QSharedPointer;
@ -78,11 +79,7 @@ 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
if (Intersects(QLineF(baseLineP1, d2blP2.p2()), d2d1, &p1) == QLineF::NoIntersection)
{
p1 = QPointF(0, 0);
p2 = QPointF(0, 0);

View File

@ -51,6 +51,7 @@
#include "../../../../vabstracttool.h"
#include "../../../vdrawtool.h"
#include "vtoollinepoint.h"
#include "../vmisc/compatibility.h"
template <class T> class QSharedPointer;
@ -180,11 +181,7 @@ 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
QLineF::IntersectType intersect = Intersects(axis, line, &fPoint);
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{

View File

@ -51,6 +51,7 @@
#include "../../../vabstracttool.h"
#include "../../vdrawtool.h"
#include "vtoolsinglepoint.h"
#include "../vmisc/compatibility.h"
template <class T> class QSharedPointer;
@ -141,11 +142,7 @@ 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
const QLineF::IntersectType intersect = Intersects(line1, line2, &fPoint);
if (intersect == QLineF::NoIntersection)
{

View File

@ -51,6 +51,7 @@
#include "../../vdrawtool.h"
#include "vtoolsinglepoint.h"
#include "../vmisc/vmath.h"
#include "../vmisc/compatibility.h"
template <class T> class QSharedPointer;
@ -201,11 +202,7 @@ 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
QLineF::IntersectType intersect = Intersects(axis, hypotenuse, &startPoint);
if (intersect != QLineF::UnboundedIntersection && intersect != QLineF::BoundedIntersection)
{

View File

@ -41,6 +41,7 @@
#include "../vpatterndb/vcontainer.h"
#include "../visualization.h"
#include "visline.h"
#include "../vmisc/compatibility.h"
//---------------------------------------------------------------------------------------------------------------------
VisToolHeight::VisToolHeight(const VContainer *data, QGraphicsItem *parent)
@ -116,11 +117,7 @@ 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
QLineF::IntersectType intersect = Intersects(height_line, base_line, &p);
if (intersect == QLineF::UnboundedIntersection)
{

View File

@ -40,6 +40,7 @@
#include "../vpatterndb/vcontainer.h"
#include "../visualization.h"
#include "visline.h"
#include "../vmisc/compatibility.h"
//---------------------------------------------------------------------------------------------------------------------
VisToolLineIntersect::VisToolLineIntersect(const VContainer *data, QGraphicsItem *parent)
@ -87,11 +88,7 @@ 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
QLineF::IntersectType intersect = Intersects(l1, l2, &fPoint);
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{
@ -108,11 +105,7 @@ 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
QLineF::IntersectType intersect = Intersects(l1, l2, &fPoint);
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{

View File

@ -43,6 +43,7 @@
#include "../visualization.h"
#include "visline.h"
#include "../vmisc/vmodifierkey.h"
#include "../vmisc/compatibility.h"
//---------------------------------------------------------------------------------------------------------------------
VisToolLineIntersectAxis::VisToolLineIntersectAxis(const VContainer *data, QGraphicsItem *parent)
@ -140,11 +141,7 @@ 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
QLineF::IntersectType intersect = Intersects(axis_line, base_line, &p);
if (intersect == QLineF::UnboundedIntersection)
{

View File

@ -41,6 +41,7 @@
#include "../vpatterndb/vcontainer.h"
#include "../visualization.h"
#include "visline.h"
#include "../vmisc/compatibility.h"
//---------------------------------------------------------------------------------------------------------------------
VisToolPointOfIntersection::VisToolPointOfIntersection(const VContainer *data, QGraphicsItem *parent)
@ -97,11 +98,7 @@ 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
QLineF::IntersectType intersect = Intersects(axis1, axis2, &p);
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{