Refactoring.

Add new constructor for class VRawSAPoint to improve readability.
This commit is contained in:
Roman Telezhynskyi 2020-07-31 16:15:00 +03:00
parent 89c6a62131
commit 49c62b072b
2 changed files with 10 additions and 8 deletions

View File

@ -146,9 +146,7 @@ QVector<VRawSAPoint> AngleByLength(QVector<VRawSAPoint> points, QPointF p1, QPoi
loop = QLineF(bigLine1.p1(), sp2); loop = QLineF(bigLine1.p1(), sp2);
loop.setLength(loop.length() + localWidth); loop.setLength(loop.length() + localWidth);
VRawSAPoint loopPoint(loop.p2()); points.append(VRawSAPoint(loop.p2(), true));
loopPoint.SetLoopPoint(true);
points.append(loopPoint);
} }
else else
{ {
@ -1460,9 +1458,7 @@ QT_WARNING_POP
loop = QLineF(crosPoint, bigLine1.p1()); loop = QLineF(crosPoint, bigLine1.p1());
loop.setLength(loop.length() + localWidth*2.); loop.setLength(loop.length() + localWidth*2.);
VRawSAPoint loopPoint(loop.p2()); points.append(VRawSAPoint(loop.p2(), true));
loopPoint.SetLoopPoint(true);
points.append(loopPoint);
} }
return points; return points;

View File

@ -44,6 +44,7 @@ public:
Q_DECL_CONSTEXPR VRawSAPoint(qreal xpos, qreal ypos); Q_DECL_CONSTEXPR VRawSAPoint(qreal xpos, qreal ypos);
// cppcheck-suppress noExplicitConstructor // cppcheck-suppress noExplicitConstructor
Q_DECL_CONSTEXPR VRawSAPoint(QPointF p); Q_DECL_CONSTEXPR VRawSAPoint(QPointF p);
Q_DECL_CONSTEXPR VRawSAPoint(QPointF p, bool loopPoint);
Q_DECL_CONSTEXPR bool LoopPoint() const; Q_DECL_CONSTEXPR bool LoopPoint() const;
Q_DECL_RELAXED_CONSTEXPR void SetLoopPoint(bool loopPoint); Q_DECL_RELAXED_CONSTEXPR void SetLoopPoint(bool loopPoint);
@ -70,9 +71,14 @@ Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(qreal xpos, qreal ypos)
// cppcheck-suppress passedByValue // cppcheck-suppress passedByValue
Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(QPointF p) Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(QPointF p)
: QPointF(p) : QPointF(p)
{ {}
} //---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress passedByValue
Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(QPointF p, bool loopPoint)
: QPointF(p),
m_loopPoint(loopPoint)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline bool VRawSAPoint::LoopPoint() const Q_DECL_CONSTEXPR inline bool VRawSAPoint::LoopPoint() const