From d1e28f4d46a6fdf8215255cac86909f5db33aca7 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 30 Mar 2017 11:07:42 +0300 Subject: [PATCH] Refactoring. Replace PassmarkLength by VAbstractPiece::MaxLocalSA. --HG-- branch : feature --- src/libs/vlayout/vabstractpiece.h | 2 +- src/libs/vpatterndb/vpiece.cpp | 20 +------------------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/libs/vlayout/vabstractpiece.h b/src/libs/vlayout/vabstractpiece.h index b51974b35..acd030497 100644 --- a/src/libs/vlayout/vabstractpiece.h +++ b/src/libs/vlayout/vabstractpiece.h @@ -168,6 +168,7 @@ public: protected: template static QVector RemoveDublicates(const QVector &points, bool removeFirstAndLast = true); + static qreal MaxLocalSA(const VSAPoint &p, qreal width); private: QSharedDataPointer d; @@ -178,7 +179,6 @@ private: static bool Crossing(const QVector &sub1, const QVector &sub2); static QVector SubPath(const QVector &path, int startIndex, int endIndex); static Q_DECL_CONSTEXPR qreal PointPosition(const QPointF &p, const QLineF &line); - static qreal MaxLocalSA(const VSAPoint &p, qreal width); static QVector AngleByLength(const QPointF &p2, const QPointF &sp1, const QPointF &sp2, const QPointF &sp3, qreal width); static QVector AngleByIntersection(const QPointF &p1, const QPointF &p2, const QPointF &p3, diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index 0a04cf466..d6a875471 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -67,24 +67,6 @@ QVector PieceMissingNodes(const QVector &d1Nodes, const QVecto return r; } -//--------------------------------------------------------------------------------------------------------------------- -qreal PassmarkLength(const VSAPoint &passmarkSAPoint, qreal width) -{ - qreal w1 = passmarkSAPoint.GetSAAfter(); - if (w1 < 0) - { - w1 = width; - } - - qreal w2 = passmarkSAPoint.GetSABefore(); - if (w2 < 0) - { - w2 = width; - } - - return qMax(w1, w2); -} - const qreal passmarkGap = (1.5/*mm*/ / 25.4) * PrintDPI; //--------------------------------------------------------------------------------------------------------------------- @@ -965,7 +947,7 @@ QVector VPiece::CreatePassmark(int previousIndex, int passmarkIndex, int QVector passmarksLines; - const qreal passmarkLength = PassmarkLength(passmarkSAPoint, width) * 0.25; + const qreal passmarkLength = VAbstractPiece::MaxLocalSA(passmarkSAPoint, width) * 0.25; const VPieceNode &node = d->m_path.at(passmarkIndex); if (node.GetPassmarkAngleType() == PassmarkAngleType::Straightforward) {