Fix build with GCC 4.9.

This commit is contained in:
Roman Telezhynskyi 2023-07-15 10:58:28 +03:00
parent 7275ad5a7f
commit 41464eece0
63 changed files with 1304 additions and 1404 deletions

View File

@ -72,7 +72,7 @@ VAbstractArc::VAbstractArc(const GOType &type, const VPointF &center, qreal f1,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractArc::VAbstractArc(const VAbstractArc &arc) = default; COPY_CONSTRUCTOR_IMPL_2(VAbstractArc, VAbstractCurve)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractArc::operator=(const VAbstractArc &arc) -> VAbstractArc & auto VAbstractArc::operator=(const VAbstractArc &arc) -> VAbstractArc &

View File

@ -35,10 +35,10 @@
#include <QPoint> #include <QPoint>
#include <QtDebug> #include <QtDebug>
#include "vabstractcurve_p.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/compatibility.h"
#include "../ifc/exception/vexceptionobjecterror.h" #include "../ifc/exception/vexceptionobjecterror.h"
#include "../vmisc/compatibility.h"
#include "../vmisc/vabstractvalapplication.h"
#include "vabstractcurve_p.h"
// See https://stackoverflow.com/a/46719572/3045403 // See https://stackoverflow.com/a/46719572/3045403
#if __cplusplus < 201703L #if __cplusplus < 201703L
@ -47,13 +47,13 @@ constexpr qreal VAbstractCurve::minLength; // NOLINT(readability-redundant-decla
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractCurve::VAbstractCurve(const GOType &type, const quint32 &idObject, const Draw &mode) VAbstractCurve::VAbstractCurve(const GOType &type, const quint32 &idObject, const Draw &mode)
:VGObject(type, idObject, mode), d (new VAbstractCurveData()) : VGObject(type, idObject, mode),
{} d(new VAbstractCurveData())
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractCurve::VAbstractCurve(const VAbstractCurve &curve) // NOLINT(modernize-use-equals-default) COPY_CONSTRUCTOR_IMPL_2(VAbstractCurve, VGObject)
:VGObject(curve), d (curve.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractCurve::operator=(const VAbstractCurve &curve) -> VAbstractCurve & auto VAbstractCurve::operator=(const VAbstractCurve &curve) -> VAbstractCurve &
@ -70,8 +70,10 @@ auto VAbstractCurve::operator=(const VAbstractCurve &curve) -> VAbstractCurve &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractCurve::VAbstractCurve(VAbstractCurve &&curve) noexcept VAbstractCurve::VAbstractCurve(VAbstractCurve &&curve) noexcept
:VGObject(std::move(curve)), d (std::move(curve.d)) : VGObject(std::move(curve)),
{} d(std::move(curve.d))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractCurve::operator=(VAbstractCurve &&curve) noexcept -> VAbstractCurve & auto VAbstractCurve::operator=(VAbstractCurve &&curve) noexcept -> VAbstractCurve &
@ -83,8 +85,7 @@ auto VAbstractCurve::operator=(VAbstractCurve &&curve) noexcept -> VAbstractCurv
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractCurve::~VAbstractCurve() // NOLINT(modernize-use-equals-default) VAbstractCurve::~VAbstractCurve() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractCurve::GetSegmentPoints(const QVector<QPointF> &points, const QPointF &begin, const QPointF &end, auto VAbstractCurve::GetSegmentPoints(const QVector<QPointF> &points, const QPointF &begin, const QPointF &end,
@ -143,16 +144,16 @@ auto VAbstractCurve::GetSegmentPoints(const QPointF &begin, const QPointF &end,
QString errorMsg; QString errorMsg;
if (piece.isEmpty()) if (piece.isEmpty())
{ {
errorMsg = QObject::tr("Error calculating segment for curve '%1'. %2") errorMsg = QObject::tr("Error calculating segment for curve '%1'. %2").arg(name(), error);
.arg(name(), error);
} }
else else
{ {
errorMsg = QObject::tr("Error in path '%1'. Calculating segment for curve '%2' has failed. %3") errorMsg = QObject::tr("Error in path '%1'. Calculating segment for curve '%2' has failed. %3")
.arg(piece, name(), error); .arg(piece, name(), error);
} }
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; ? throw VExceptionObjectError(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
} }
return segment; return segment;
@ -161,14 +162,23 @@ auto VAbstractCurve::GetSegmentPoints(const QPointF &begin, const QPointF &end,
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractCurve::FromBegin(const QVector<QPointF> &points, const QPointF &begin, bool *ok) -> QVector<QPointF> auto VAbstractCurve::FromBegin(const QVector<QPointF> &points, const QPointF &begin, bool *ok) -> QVector<QPointF>
{ {
if (points.count() >= 2) auto SetResult = [&ok](bool res)
{
if (ConstFirst(points).toPoint() == begin.toPoint())
{ {
if (ok != nullptr) if (ok != nullptr)
{ {
*ok = true; *ok = res;
} }
};
if (points.count() < 2)
{
SetResult(false);
return points;
}
if (ConstFirst(points).toPoint() == begin.toPoint())
{
SetResult(true);
return points; return points;
} }
@ -205,27 +215,14 @@ auto VAbstractCurve::FromBegin(const QVector<QPointF> &points, const QPointF &be
if (segment.isEmpty()) if (segment.isEmpty())
{ {
if (ok != nullptr) SetResult(false);
{
*ok = false;
}
return points; return points;
} }
if (ok != nullptr) SetResult(true);
{
*ok = true;
}
return segment; return segment;
} }
if (ok != nullptr)
{
*ok = false;
}
return points;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractCurve::ToEnd(const QVector<QPointF> &points, const QPointF &end, bool *ok) -> QVector<QPointF> auto VAbstractCurve::ToEnd(const QVector<QPointF> &points, const QPointF &end, bool *ok) -> QVector<QPointF>
{ {

View File

@ -32,15 +32,15 @@
#include <QPointF> #include <QPointF>
#include <QtDebug> #include <QtDebug>
#include "../vmisc/def.h" #include "../ifc/exception/vexception.h"
#include "../vmisc/vmath.h"
#include "../vmisc/compatibility.h"
#include "../vmisc/vabstractapplication.h"
#include "../ifc/ifcdef.h" #include "../ifc/ifcdef.h"
#include "../vmisc/compatibility.h"
#include "../vmisc/def.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vmath.h"
#include "vabstractcurve.h" #include "vabstractcurve.h"
#include "varc_p.h" #include "varc_p.h"
#include "vspline.h" #include "vspline.h"
#include "../ifc/exception/vexception.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -49,7 +49,8 @@
VArc::VArc() VArc::VArc()
: VAbstractArc(GOType::Arc), : VAbstractArc(GOType::Arc),
d(new VArcData) d(new VArcData)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -95,13 +96,7 @@ VArc::VArc(qreal length, const VPointF &center, qreal radius, qreal f1)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** COPY_CONSTRUCTOR_IMPL_2(VArc, VAbstractArc)
* @brief VArc copy constructor
* @param arc arc
*/
VArc::VArc(const VArc &arc)
: VAbstractArc(arc), d (arc.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -123,8 +118,10 @@ auto VArc::operator =(const VArc &arc) -> VArc &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VArc::VArc(VArc &&arc) noexcept VArc::VArc(VArc &&arc) noexcept
: VAbstractArc(std::move(arc)), d (std::move(arc.d)) : VAbstractArc(std::move(arc)),
{} d(std::move(arc.d))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VArc::operator=(VArc &&arc) noexcept -> VArc & auto VArc::operator=(VArc &&arc) noexcept -> VArc &
@ -214,8 +211,7 @@ auto VArc::Move(qreal length, qreal angle, const QString &prefix) const -> VArc
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VArc::~VArc() // NOLINT(hicpp-use-equals-default, modernize-use-equals-default) VArc::~VArc() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -358,14 +354,15 @@ auto VArc::CutArc(qreal length, VArc &arc1, VArc &arc2, const QString &pointName
arc2 = VArc(); arc2 = VArc();
const QString errorMsg = tr("Unable to cut curve '%1'. The curve is too short.").arg(name()); const QString errorMsg = tr("Unable to cut curve '%1'. The curve is too short.").arg(name());
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractApplication::warningMessageSignature + errorMsg; ? throw VException(errorMsg)
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
return {}; return {};
} }
QLineF line = not IsFlipped() ? CutPoint(length, fullLength, pointName) QLineF line =
: CutPointFlipped(length, fullLength, pointName); not IsFlipped() ? CutPoint(length, fullLength, pointName) : CutPointFlipped(length, fullLength, pointName);
arc1 = VArc(GetCenter(), d->radius, d->formulaRadius, GetStartAngle(), GetFormulaF1(), line.angle(), arc1 = VArc(GetCenter(), d->radius, d->formulaRadius, GetStartAngle(), GetFormulaF1(), line.angle(),
QString().setNum(line.angle()), getIdObject(), getMode()); QString().setNum(line.angle()), getIdObject(), getMode());
@ -379,7 +376,6 @@ auto VArc::CutArc(qreal length, VArc &arc1, VArc &arc2, const QString &pointName
return line.p2(); return line.p2();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VArc::CutArc(qreal length, const QString &pointName) const -> QPointF auto VArc::CutArc(qreal length, const QString &pointName) const -> QPointF
{ {
@ -473,11 +469,12 @@ auto VArc::CutPoint(qreal length, qreal fullLength, const QString &pointName) co
} }
else else
{ {
errorMsg = tr("Curve '%1'. Length of a cut segment is too small. Optimize it to minimal value.") errorMsg =
.arg(name()); tr("Curve '%1'. Length of a cut segment is too small. Optimize it to minimal value.").arg(name());
} }
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractApplication::warningMessageSignature + errorMsg; ? throw VException(errorMsg)
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
} }
else if (length > maxLength) else if (length > maxLength)
{ {
@ -490,11 +487,11 @@ auto VArc::CutPoint(qreal length, qreal fullLength, const QString &pointName) co
else else
{ {
errorMsg = tr("Curve '%1'. Length of a cut segment is too big. Optimize it to maximal value.") errorMsg = tr("Curve '%1'. Length of a cut segment is too big. Optimize it to maximal value.").arg(name());
.arg(name());
} }
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractApplication::warningMessageSignature + errorMsg; ? throw VException(errorMsg)
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
} }
length = qBound(minLength, length, maxLength); length = qBound(minLength, length, maxLength);
@ -525,11 +522,12 @@ auto VArc::CutPointFlipped(qreal length, qreal fullLength, const QString &pointN
} }
else else
{ {
errorMsg = tr("Curve '%1'. Length of a cut segment is too small. Optimize it to minimal value.") errorMsg =
.arg(name()); tr("Curve '%1'. Length of a cut segment is too small. Optimize it to minimal value.").arg(name());
} }
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractApplication::warningMessageSignature + errorMsg; ? throw VException(errorMsg)
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
} }
else if (length > maxLengthFlipped) else if (length > maxLengthFlipped)
{ {
@ -541,11 +539,11 @@ auto VArc::CutPointFlipped(qreal length, qreal fullLength, const QString &pointN
} }
else else
{ {
errorMsg = tr("Curve '%1'. Length of a cut segment is too big. Optimize it to maximal value.") errorMsg = tr("Curve '%1'. Length of a cut segment is too big. Optimize it to maximal value.").arg(name());
.arg(name());
} }
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractApplication::warningMessageSignature + errorMsg; ? throw VException(errorMsg)
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
} }
length = qBound(minLengthFlipped, length, maxLengthFlipped); length = qBound(minLengthFlipped, length, maxLengthFlipped);

View File

@ -34,20 +34,19 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VCubicBezier::VCubicBezier() VCubicBezier::VCubicBezier()
: VAbstractCubicBezier(GOType::CubicBezier), d(new VCubicBezierData) : VAbstractCubicBezier(GOType::CubicBezier),
d(new VCubicBezierData)
{ {
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VCubicBezier::VCubicBezier(const VCubicBezier &curve) COPY_CONSTRUCTOR_IMPL_2(VCubicBezier, VAbstractCubicBezier)
: VAbstractCubicBezier(curve), d(curve.d)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VCubicBezier::VCubicBezier(const VPointF &p1, const VPointF &p2, const VPointF &p3, const VPointF &p4, quint32 idObject, VCubicBezier::VCubicBezier(const VPointF &p1, const VPointF &p2, const VPointF &p3, const VPointF &p4, quint32 idObject,
Draw mode) Draw mode)
: VAbstractCubicBezier(GOType::CubicBezier, idObject, mode), d(new VCubicBezierData(p1, p2, p3, p4)) : VAbstractCubicBezier(GOType::CubicBezier, idObject, mode),
d(new VCubicBezierData(p1, p2, p3, p4))
{ {
CreateName(); CreateName();
} }
@ -67,8 +66,10 @@ auto VCubicBezier::operator=(const VCubicBezier &curve) -> VCubicBezier &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VCubicBezier::VCubicBezier(VCubicBezier &&curve) noexcept VCubicBezier::VCubicBezier(VCubicBezier &&curve) noexcept
: VAbstractCubicBezier(std::move(curve)), d(std::move(curve.d)) : VAbstractCubicBezier(std::move(curve)),
{} d(std::move(curve.d))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VCubicBezier::operator=(VCubicBezier &&curve) noexcept -> VCubicBezier & auto VCubicBezier::operator=(VCubicBezier &&curve) noexcept -> VCubicBezier &
@ -143,9 +144,7 @@ auto VCubicBezier::Move(qreal length, qreal angle, const QString &prefix) const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VCubicBezier::~VCubicBezier() VCubicBezier::~VCubicBezier() = default;
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VCubicBezier::GetP1() const -> VPointF auto VCubicBezier::GetP1() const -> VPointF
@ -214,8 +213,8 @@ auto VCubicBezier::GetEndAngle() const -> qreal
*/ */
auto VCubicBezier::GetLength() const -> qreal auto VCubicBezier::GetLength() const -> qreal
{ {
return LengthBezier (static_cast<QPointF>(GetP1()), static_cast<QPointF>(GetP2()), return LengthBezier(static_cast<QPointF>(GetP1()), static_cast<QPointF>(GetP2()), static_cast<QPointF>(GetP3()),
static_cast<QPointF>(GetP3()), static_cast<QPointF>(GetP4()), GetApproximationScale()); static_cast<QPointF>(GetP4()), GetApproximationScale());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -256,6 +255,6 @@ auto VCubicBezier::GetControlPoint2() const -> QPointF
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VCubicBezier::GetRealLength() const -> qreal auto VCubicBezier::GetRealLength() const -> qreal
{ {
return LengthBezier (static_cast<QPointF>(GetP1()), static_cast<QPointF>(GetP2()), return LengthBezier(static_cast<QPointF>(GetP1()), static_cast<QPointF>(GetP2()), static_cast<QPointF>(GetP3()),
static_cast<QPointF>(GetP3()), static_cast<QPointF>(GetP4()), maxCurveApproximationScale); static_cast<QPointF>(GetP4()), maxCurveApproximationScale);
} }

View File

@ -51,7 +51,7 @@ public:
auto Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix = QString()) const -> VCubicBezier; auto Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix = QString()) const -> VCubicBezier;
auto Flip(const QLineF &axis, const QString &prefix = QString()) const -> VCubicBezier; auto Flip(const QLineF &axis, const QString &prefix = QString()) const -> VCubicBezier;
auto Move(qreal length, qreal angle, const QString &prefix = QString()) const -> VCubicBezier; auto Move(qreal length, qreal angle, const QString &prefix = QString()) const -> VCubicBezier;
virtual ~VCubicBezier(); ~VCubicBezier() override;
auto operator=(const VCubicBezier &curve) -> VCubicBezier &; auto operator=(const VCubicBezier &curve) -> VCubicBezier &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
@ -59,29 +59,29 @@ public:
auto operator=(VCubicBezier &&curve) noexcept -> VCubicBezier &; auto operator=(VCubicBezier &&curve) noexcept -> VCubicBezier &;
#endif #endif
virtual auto GetP1() const -> VPointF override; auto GetP1() const -> VPointF override;
void SetP1(const VPointF &p); void SetP1(const VPointF &p);
virtual auto GetP2() const -> VPointF override; auto GetP2() const -> VPointF override;
void SetP2(const VPointF &p); void SetP2(const VPointF &p);
virtual auto GetP3() const -> VPointF override; auto GetP3() const -> VPointF override;
void SetP3(const VPointF &p); void SetP3(const VPointF &p);
virtual auto GetP4() const -> VPointF override; auto GetP4() const -> VPointF override;
void SetP4(const VPointF &p); void SetP4(const VPointF &p);
virtual auto GetStartAngle() const -> qreal override; auto GetStartAngle() const -> qreal override;
virtual auto GetEndAngle() const -> qreal override; auto GetEndAngle() const -> qreal override;
virtual auto GetLength() const -> qreal override; auto GetLength() const -> qreal override;
virtual auto GetPoints() const -> QVector<QPointF> override; auto GetPoints() const -> QVector<QPointF> override;
virtual auto GetC1Length() const -> qreal override; auto GetC1Length() const -> qreal override;
virtual auto GetC2Length() const -> qreal override; auto GetC2Length() const -> qreal override;
protected: protected:
virtual auto GetControlPoint1() const -> QPointF override; auto GetControlPoint1() const -> QPointF override;
virtual auto GetControlPoint2() const -> QPointF override; auto GetControlPoint2() const -> QPointF override;
auto GetRealLength() const -> qreal override; auto GetRealLength() const -> qreal override;
private: private:

View File

@ -47,7 +47,7 @@ VCubicBezierPath::VCubicBezierPath(quint32 idObject, Draw mode)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VCubicBezierPath::VCubicBezierPath(const VCubicBezierPath &curve) = default; COPY_CONSTRUCTOR_IMPL_2(VCubicBezierPath, VAbstractCubicBezierPath)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VCubicBezierPath::VCubicBezierPath(const QVector<VPointF> &points, quint32 idObject, Draw mode) VCubicBezierPath::VCubicBezierPath(const QVector<VPointF> &points, quint32 idObject, Draw mode)

View File

@ -49,11 +49,11 @@ class VCubicBezierPath final : public VAbstractCubicBezierPath
public: public:
explicit VCubicBezierPath(quint32 idObject = 0, Draw mode = Draw::Calculation); explicit VCubicBezierPath(quint32 idObject = 0, Draw mode = Draw::Calculation);
VCubicBezierPath(const VCubicBezierPath &curve); VCubicBezierPath(const VCubicBezierPath &curve);
VCubicBezierPath(const QVector<VPointF> &points, quint32 idObject = 0, Draw mode = Draw::Calculation); explicit VCubicBezierPath(const QVector<VPointF> &points, quint32 idObject = 0, Draw mode = Draw::Calculation);
auto Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix = QString()) const -> VCubicBezierPath; auto Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix = QString()) const -> VCubicBezierPath;
auto Flip(const QLineF &axis, const QString &prefix = QString()) const -> VCubicBezierPath; auto Flip(const QLineF &axis, const QString &prefix = QString()) const -> VCubicBezierPath;
auto Move(qreal length, qreal angle, const QString &prefix = QString()) const -> VCubicBezierPath; auto Move(qreal length, qreal angle, const QString &prefix = QString()) const -> VCubicBezierPath;
virtual ~VCubicBezierPath(); ~VCubicBezierPath() override;
auto operator=(const VCubicBezierPath &curve) -> VCubicBezierPath &; auto operator=(const VCubicBezierPath &curve) -> VCubicBezierPath &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
@ -67,17 +67,17 @@ public:
void append(const VPointF &point); void append(const VPointF &point);
virtual auto CountSubSpl() const -> vsizetype override; auto CountSubSpl() const -> vsizetype override;
virtual auto CountPoints() const -> vsizetype override; auto CountPoints() const -> vsizetype override;
virtual void Clear() override; void Clear() override;
virtual auto GetSpline(vsizetype index) const -> VSpline override; auto GetSpline(vsizetype index) const -> VSpline override;
virtual auto GetStartAngle() const -> qreal override; auto GetStartAngle() const -> qreal override;
virtual auto GetEndAngle() const -> qreal override; auto GetEndAngle() const -> qreal override;
virtual auto GetC1Length() const -> qreal override; auto GetC1Length() const -> qreal override;
virtual auto GetC2Length() const -> qreal override; auto GetC2Length() const -> qreal override;
virtual auto GetSplinePath() const -> QVector<VSplinePoint> override; auto GetSplinePath() const -> QVector<VSplinePoint> override;
auto GetCubicPath() const -> QVector<VPointF>; auto GetCubicPath() const -> QVector<VPointF>;
static auto CountSubSpl(vsizetype size) -> vsizetype; static auto CountSubSpl(vsizetype size) -> vsizetype;
@ -85,8 +85,8 @@ public:
static auto SubSplPointsCount(vsizetype countSubSpl) -> vsizetype; static auto SubSplPointsCount(vsizetype countSubSpl) -> vsizetype;
protected: protected:
virtual auto FirstPoint() const -> VPointF override; auto FirstPoint() const -> VPointF override;
virtual auto LastPoint() const -> VPointF override; auto LastPoint() const -> VPointF override;
private: private:
QSharedDataPointer<VCubicBezierPathData> d; QSharedDataPointer<VCubicBezierPathData> d;

View File

@ -29,20 +29,20 @@
#include "vellipticalarc.h" #include "vellipticalarc.h"
#include <QLineF> #include <QLineF>
#include <QPoint>
#include <QPainterPath> #include <QPainterPath>
#include <QPoint>
#include <QtDebug> #include <QtDebug>
#include "../vmisc/def.h"
#include "../ifc/ifcdef.h"
#include "../ifc/exception/vexception.h" #include "../ifc/exception/vexception.h"
#include "../vmisc/vabstractapplication.h" #include "../ifc/ifcdef.h"
#include "../vmisc/compatibility.h"
#include "../vmisc/def.h"
#include "../vmisc/fpm/fixed.hpp" #include "../vmisc/fpm/fixed.hpp"
#include "../vmisc/fpm/math.hpp" #include "../vmisc/fpm/math.hpp"
#include "../vmisc/compatibility.h" #include "../vmisc/vabstractapplication.h"
#include "../vmisc/vmath.h"
#include "vabstractcurve.h" #include "vabstractcurve.h"
#include "vellipticalarc_p.h" #include "vellipticalarc_p.h"
#include "../vmisc/vmath.h"
namespace namespace
{ {
@ -122,8 +122,8 @@ auto InitialValue(fpm::fixed_16_16 u0, fpm::fixed_16_16 v0, uint k) -> fpm::fixe
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto EllipseCore(fpm::fixed_16_16 xC, fpm::fixed_16_16 yC, fpm::fixed_16_16 xP, fpm::fixed_16_16 yP, auto EllipseCore(fpm::fixed_16_16 xC, fpm::fixed_16_16 yC, fpm::fixed_16_16 xP, fpm::fixed_16_16 yP,
fpm::fixed_16_16 xQ, fpm::fixed_16_16 yQ, fpm::fixed_16_16 sweep, fpm::fixed_16_16 xQ, fpm::fixed_16_16 yQ, fpm::fixed_16_16 sweep, fpm::fixed_16_16 flatness)
fpm::fixed_16_16 flatness) -> QVector<QPointF> -> QVector<QPointF>
{ {
uint k = qMin(static_cast<uint>(AngularInc(xP, yP, xQ, yQ, flatness)), 16U); uint k = qMin(static_cast<uint>(AngularInc(xP, yP, xQ, yQ, flatness)), 16U);
const uint count = static_cast<std::uint32_t>(sweep.raw_value()) >> (16 - k); const uint count = static_cast<std::uint32_t>(sweep.raw_value()) >> (16 - k);
@ -148,8 +148,8 @@ auto EllipseCore(fpm::fixed_16_16 xC, fpm::fixed_16_16 yC, fpm::fixed_16_16 xP,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto EllipticArcPoints(QPointF c, qreal radius1, qreal radius2, qreal astart, qreal asweep, auto EllipticArcPoints(QPointF c, qreal radius1, qreal radius2, qreal astart, qreal asweep, qreal approximationScale)
qreal approximationScale) -> QVector<QPointF> -> QVector<QPointF>
{ {
fpm::fixed_16_16 xC{c.x()}; fpm::fixed_16_16 xC{c.x()};
fpm::fixed_16_16 yC{c.y()}; fpm::fixed_16_16 yC{c.y()};
@ -233,8 +233,10 @@ auto JoinVectors(const QVector<QPointF> &v1, const QVector<QPointF> &v2) -> QVec
* @brief VEllipticalArc default constructor. * @brief VEllipticalArc default constructor.
*/ */
VEllipticalArc::VEllipticalArc() VEllipticalArc::VEllipticalArc()
: VAbstractArc(GOType::EllipticalArc), d (new VEllipticalArcData) : VAbstractArc(GOType::EllipticalArc),
{} d(new VEllipticalArcData)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -288,13 +290,7 @@ VEllipticalArc::VEllipticalArc(qreal length, const VPointF &center, qreal radius
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** COPY_CONSTRUCTOR_IMPL_2(VEllipticalArc, VAbstractArc)
* @brief VEllipticalArc copy constructor
* @param arc arc
*/
VEllipticalArc::VEllipticalArc(const VEllipticalArc &arc)
: VAbstractArc(arc), d (arc.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -318,7 +314,8 @@ auto VEllipticalArc::operator =(const VEllipticalArc &arc) -> VEllipticalArc &
VEllipticalArc::VEllipticalArc(VEllipticalArc &&arc) noexcept VEllipticalArc::VEllipticalArc(VEllipticalArc &&arc) noexcept
: VAbstractArc(std::move(arc)), : VAbstractArc(std::move(arc)),
d(std::move(arc.d)) d(std::move(arc.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VEllipticalArc::operator=(VEllipticalArc &&arc) noexcept -> VEllipticalArc & auto VEllipticalArc::operator=(VEllipticalArc &&arc) noexcept -> VEllipticalArc &
@ -382,8 +379,8 @@ auto VEllipticalArc::Move(qreal length, qreal angle, const QString &prefix) cons
const VPointF oldCenter = VAbstractArc::GetCenter(); const VPointF oldCenter = VAbstractArc::GetCenter();
const VPointF center = oldCenter.Move(length, angle); const VPointF center = oldCenter.Move(length, angle);
const QPointF position = d->m_transform.inverted().map(center.toQPointF()) - const QPointF position =
d->m_transform.inverted().map(oldCenter.toQPointF()); d->m_transform.inverted().map(center.toQPointF()) - d->m_transform.inverted().map(oldCenter.toQPointF());
QTransform t = d->m_transform; QTransform t = d->m_transform;
t.translate(position.x(), position.y()); t.translate(position.x(), position.y());
@ -406,8 +403,7 @@ auto VEllipticalArc::Move(qreal length, qreal angle, const QString &prefix) cons
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VEllipticalArc::~VEllipticalArc() // NOLINT(hicpp-use-equals-default, modernize-use-equals-default) VEllipticalArc::~VEllipticalArc() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -544,8 +540,9 @@ auto VEllipticalArc::CutArc(const qreal &length, VEllipticalArc &arc1, VElliptic
arc2 = VEllipticalArc(); arc2 = VEllipticalArc();
const QString errorMsg = QObject::tr("Unable to cut curve '%1'. The curve is too short.").arg(name()); const QString errorMsg = QObject::tr("Unable to cut curve '%1'. The curve is too short.").arg(name());
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractApplication::warningMessageSignature + errorMsg; ? throw VException(errorMsg)
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
return {}; return {};
} }
@ -560,15 +557,17 @@ auto VEllipticalArc::CutArc(const qreal &length, VEllipticalArc &arc1, VElliptic
if (not pointName.isEmpty()) if (not pointName.isEmpty())
{ {
errorMsg = QObject::tr("Curve '%1'. Length of a cut segment (%2) is too small. Optimize it to minimal " errorMsg = QObject::tr("Curve '%1'. Length of a cut segment (%2) is too small. Optimize it to minimal "
"value.").arg(name(), pointName); "value.")
.arg(name(), pointName);
} }
else else
{ {
errorMsg = QObject::tr("Curve '%1'. Length of a cut segment is too small. Optimize it to minimal value.") errorMsg = QObject::tr("Curve '%1'. Length of a cut segment is too small. Optimize it to minimal value.")
.arg(name()); .arg(name());
} }
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractApplication::warningMessageSignature + errorMsg; ? throw VException(errorMsg)
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
} }
else if (length > maxLength) else if (length > maxLength)
{ {
@ -585,8 +584,9 @@ auto VEllipticalArc::CutArc(const qreal &length, VEllipticalArc &arc1, VElliptic
errorMsg = QObject::tr("Curve '%1'. Length of a cut segment is too big. Optimize it to maximal value.") errorMsg = QObject::tr("Curve '%1'. Length of a cut segment is too big. Optimize it to maximal value.")
.arg(name()); .arg(name());
} }
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractApplication::warningMessageSignature + errorMsg; ? throw VException(errorMsg)
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
} }
else else
{ {
@ -594,18 +594,17 @@ auto VEllipticalArc::CutArc(const qreal &length, VEllipticalArc &arc1, VElliptic
} }
// the first arc has given length and startAngle just like in the origin arc // the first arc has given length and startAngle just like in the origin arc
arc1 = VEllipticalArc (len, QString().setNum(length), GetCenter(), d->radius1, d->radius2, arc1 = VEllipticalArc(len, QString().setNum(length), GetCenter(), d->radius1, d->radius2, d->formulaRadius1,
d->formulaRadius1, d->formulaRadius2, GetStartAngle(), GetFormulaF1(), d->rotationAngle, d->formulaRadius2, GetStartAngle(), GetFormulaF1(), d->rotationAngle,
GetFormulaRotationAngle(), getIdObject(), getMode()); GetFormulaRotationAngle(), getIdObject(), getMode());
// the second arc has startAngle just like endAngle of the first arc // the second arc has startAngle just like endAngle of the first arc
// and it has endAngle just like endAngle of the origin arc // and it has endAngle just like endAngle of the origin arc
arc2 = VEllipticalArc (GetCenter(), d->radius1, d->radius2, d->formulaRadius1, d->formulaRadius2, arc2 = VEllipticalArc(GetCenter(), d->radius1, d->radius2, d->formulaRadius1, d->formulaRadius2, arc1.GetEndAngle(),
arc1.GetEndAngle(), arc1.GetFormulaF2(), GetEndAngle(), GetFormulaF2(), d->rotationAngle, arc1.GetFormulaF2(), GetEndAngle(), GetFormulaF2(), d->rotationAngle,
GetFormulaRotationAngle(), getIdObject(), getMode()); GetFormulaRotationAngle(), getIdObject(), getMode());
return arc1.GetP1(); return arc1.GetP1();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VEllipticalArc::CutArc(const qreal &length, const QString &pointName) const -> QPointF auto VEllipticalArc::CutArc(const qreal &length, const QString &pointName) const -> QPointF
{ {
@ -755,8 +754,8 @@ auto VEllipticalArc::ArcPoints(QVector<QPointF> points) const -> QVector<QPointF
QLineF end(center.x(), center.y(), center.x() + radius, center.y()); QLineF end(center.x(), center.y(), center.x() + radius, center.y());
end.setAngle(VAbstractArc::GetEndAngle()); end.setAngle(VAbstractArc::GetEndAngle());
auto IsBoundedIntersection = [](QLineF::IntersectType type, QPointF p, const QLineF &segment1, auto IsBoundedIntersection =
const QLineF &segment2) [](QLineF::IntersectType type, QPointF p, const QLineF &segment1, const QLineF &segment2)
{ {
return type == QLineF::BoundedIntersection || return type == QLineF::BoundedIntersection ||
(type == QLineF::UnboundedIntersection && (type == QLineF::UnboundedIntersection &&

View File

@ -107,14 +107,7 @@ VGObject::VGObject(const GOType &type, const quint32 &idObject, const Draw &mode
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** COPY_CONSTRUCTOR_IMPL(VGObject)
* @brief VGObject copy constructor.
* @param obj object.
*/
VGObject::VGObject(const VGObject &obj) // NOLINT(modernize-use-equals-default)
: d(obj.d)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -148,9 +141,7 @@ auto VGObject::operator=(VGObject &&obj) noexcept -> VGObject &
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VGObject::~VGObject() // NOLINT(modernize-use-equals-default) VGObject::~VGObject() = default;
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**

View File

@ -26,30 +26,27 @@
** **
*************************************************************************/ *************************************************************************/
#include "vplacelabelitem.h" #include "vplacelabelitem.h"
#include "vplacelabelitem_p.h"
#include "../vpatterndb/vcontainer.h" #include "../vpatterndb/vcontainer.h"
#include "vplacelabelitem_p.h"
#include <qnumeric.h> #include <QPainterPath>
#include <QPolygonF> #include <QPolygonF>
#include <QTransform> #include <QTransform>
#include <QPainterPath> #include <qnumeric.h>
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPlaceLabelItem::VPlaceLabelItem() VPlaceLabelItem::VPlaceLabelItem()
: VPointF(), d(new VPlaceLabelItemData) : d(new VPlaceLabelItemData)
{ {
setType(GOType::PlaceLabel); setType(GOType::PlaceLabel);
setMode(Draw::Modeling); setMode(Draw::Modeling);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPlaceLabelItem::VPlaceLabelItem(const VPlaceLabelItem &item) COPY_CONSTRUCTOR_IMPL_2(VPlaceLabelItem, VPointF)
: VPointF(item), d(item.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPlaceLabelItem::~VPlaceLabelItem() VPlaceLabelItem::~VPlaceLabelItem() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPlaceLabelItem::GetWidthFormula() const -> QString auto VPlaceLabelItem::GetWidthFormula() const -> QString
@ -228,8 +225,10 @@ auto VPlaceLabelItem::operator=(const VPlaceLabelItem &item) -> VPlaceLabelItem
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPlaceLabelItem::VPlaceLabelItem(VPlaceLabelItem &&item) noexcept VPlaceLabelItem::VPlaceLabelItem(VPlaceLabelItem &&item) noexcept
: VPointF(std::move(item)), d(std::move(item.d)) : VPointF(std::move(item)),
{} d(std::move(item.d))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPlaceLabelItem::operator=(VPlaceLabelItem &&item) noexcept -> VPlaceLabelItem & auto VPlaceLabelItem::operator=(VPlaceLabelItem &&item) noexcept -> VPlaceLabelItem &

View File

@ -28,10 +28,10 @@
#ifndef VPLACELABELITEM_H #ifndef VPLACELABELITEM_H
#define VPLACELABELITEM_H #define VPLACELABELITEM_H
#include <QMetaType>
#include <QSharedDataPointer> #include <QSharedDataPointer>
#include <QTypeInfo> #include <QTypeInfo>
#include <QtGlobal> #include <QtGlobal>
#include <QMetaType>
#include "vpointf.h" #include "vpointf.h"
@ -44,7 +44,7 @@ class VPlaceLabelItem : public VPointF
public: public:
VPlaceLabelItem(); VPlaceLabelItem();
VPlaceLabelItem(const VPlaceLabelItem &item); VPlaceLabelItem(const VPlaceLabelItem &item);
virtual ~VPlaceLabelItem() override; ~VPlaceLabelItem() override;
auto operator=(const VPlaceLabelItem &item) -> VPlaceLabelItem &; auto operator=(const VPlaceLabelItem &item) -> VPlaceLabelItem &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
@ -88,7 +88,7 @@ private:
QSharedDataPointer<VPlaceLabelItemData> d; QSharedDataPointer<VPlaceLabelItemData> d;
}; };
Q_DECLARE_METATYPE(VPlaceLabelItem) Q_DECLARE_METATYPE(VPlaceLabelItem) // NOLINT
Q_DECLARE_TYPEINFO(VPlaceLabelItem, Q_MOVABLE_TYPE); // NOLINT Q_DECLARE_TYPEINFO(VPlaceLabelItem, Q_MOVABLE_TYPE); // NOLINT
#endif // VPLACELABELITEM_H #endif // VPLACELABELITEM_H

View File

@ -39,18 +39,20 @@
* @brief VPointF creat empty point * @brief VPointF creat empty point
*/ */
VPointF::VPointF() VPointF::VPointF()
:VGObject(GOType::Point, 0, Draw::Calculation), d(new VPointFData) : VGObject(GOType::Point, 0, Draw::Calculation),
{} d(new VPointFData)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPointF::VPointF(const VPointF &point) COPY_CONSTRUCTOR_IMPL_2(VPointF, VGObject)
:VGObject(point), d(point.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPointF::VPointF(const QPointF &point) VPointF::VPointF(const QPointF &point)
:VGObject(VPointF()), d(new VPointFData(point)) : VGObject(VPointF()),
{} d(new VPointFData(point))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -62,7 +64,8 @@ VPointF::VPointF(const QPointF &point)
* @param my offset name respect to y * @param my offset name respect to y
*/ */
VPointF::VPointF(qreal x, qreal y, const QString &name, qreal mx, qreal my, quint32 idObject, const Draw &mode) VPointF::VPointF(qreal x, qreal y, const QString &name, qreal mx, qreal my, quint32 idObject, const Draw &mode)
:VGObject(GOType::Point, idObject, mode), d(new VPointFData(x, y, mx, my)) : VGObject(GOType::Point, idObject, mode),
d(new VPointFData(x, y, mx, my))
{ {
setName(name); setName(name);
} }
@ -76,14 +79,14 @@ VPointF::VPointF(qreal x, qreal y, const QString &name, qreal mx, qreal my, quin
* @param my offset name respect to y * @param my offset name respect to y
*/ */
VPointF::VPointF(const QPointF &point, const QString &name, qreal mx, qreal my, quint32 idObject, const Draw &mode) VPointF::VPointF(const QPointF &point, const QString &name, qreal mx, qreal my, quint32 idObject, const Draw &mode)
:VGObject(GOType::Point, idObject, mode), d(new VPointFData(point, mx, my)) : VGObject(GOType::Point, idObject, mode),
d(new VPointFData(point, mx, my))
{ {
setName(name); setName(name);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPointF::~VPointF() VPointF::~VPointF() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -105,8 +108,10 @@ auto VPointF::operator=(const VPointF &point) -> VPointF &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPointF::VPointF(VPointF &&point) noexcept VPointF::VPointF(VPointF &&point) noexcept
:VGObject(std::move(point)), d(std::move(point.d)) : VGObject(std::move(point)),
{} d(std::move(point.d))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPointF::operator=(VPointF &&point) noexcept -> VPointF & auto VPointF::operator=(VPointF &&point) noexcept -> VPointF &

View File

@ -29,7 +29,6 @@
#ifndef VPOINTF_H #ifndef VPOINTF_H
#define VPOINTF_H #define VPOINTF_H
#include <QMetaType> #include <QMetaType>
#include <QSharedDataPointer> #include <QSharedDataPointer>
#include <QString> #include <QString>
@ -39,7 +38,6 @@
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h" #include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "vgeometrydef.h"
#include "vgobject.h" #include "vgobject.h"
class VPointFData; class VPointFData;
@ -61,7 +59,7 @@ public:
const Draw &mode = Draw::Calculation); const Draw &mode = Draw::Calculation);
VPointF(const QPointF &point, const QString &name, qreal mx, qreal my, quint32 idObject = 0, VPointF(const QPointF &point, const QString &name, qreal mx, qreal my, quint32 idObject = 0,
const Draw &mode = Draw::Calculation); const Draw &mode = Draw::Calculation);
virtual ~VPointF() override; ~VPointF() override;
auto operator=(const VPointF &point) -> VPointF &; auto operator=(const VPointF &point) -> VPointF &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
@ -86,10 +84,10 @@ public:
auto IsShowLabel() const -> bool; auto IsShowLabel() const -> bool;
void SetShowLabel(bool hide); void SetShowLabel(bool hide);
virtual auto ToJson() const -> QJsonObject override; auto ToJson() const -> QJsonObject override;
virtual void SetAlias(const QString &alias) override; void SetAlias(const QString &alias) override;
virtual void SetAliasSuffix(const QString &aliasSuffix) override; void SetAliasSuffix(const QString &aliasSuffix) override;
static auto RotatePF(const QPointF &originPoint, const QPointF &point, qreal degrees) -> QPointF; static auto RotatePF(const QPointF &originPoint, const QPointF &point, qreal degrees) -> QPointF;
static auto FlipPF(const QLineF &axis, const QPointF &point) -> QPointF; static auto FlipPF(const QLineF &axis, const QPointF &point) -> QPointF;
@ -99,7 +97,7 @@ private:
QSharedDataPointer<VPointFData> d; QSharedDataPointer<VPointFData> d;
}; };
Q_DECLARE_METATYPE(VPointF) Q_DECLARE_METATYPE(VPointF) // NOLINT
Q_DECLARE_TYPEINFO(VPointF, Q_MOVABLE_TYPE); // NOLINT Q_DECLARE_TYPEINFO(VPointF, Q_MOVABLE_TYPE); // NOLINT
QT_WARNING_POP QT_WARNING_POP

View File

@ -31,9 +31,9 @@
#include <QJsonObject> #include <QJsonObject>
#include <QLineF> #include <QLineF>
#include "../vmisc/vmath.h"
#include "vabstractcurve.h" #include "vabstractcurve.h"
#include "vspline_p.h" #include "vspline_p.h"
#include "../vmisc/vmath.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -42,17 +42,11 @@
VSpline::VSpline() VSpline::VSpline()
: VAbstractCubicBezier(GOType::Spline), : VAbstractCubicBezier(GOType::Spline),
d(new VSplineData) d(new VSplineData)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** COPY_CONSTRUCTOR_IMPL_2(VSpline, VAbstractCubicBezier)
* @brief VSpline constructor.
* @param spline spline from which the copy.
*/
VSpline::VSpline(const VSpline &spline) // NOLINT(modernize-use-equals-default)
: VAbstractCubicBezier(spline),
d(spline.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -83,12 +77,12 @@ VSpline::VSpline (const VPointF &p1, const VPointF &p4, qreal angle1, qreal angl
*/ */
VSpline::VSpline(const VPointF &p1, const QPointF &p2, const QPointF &p3, const VPointF &p4, quint32 idObject, VSpline::VSpline(const VPointF &p1, const QPointF &p2, const QPointF &p3, const VPointF &p4, quint32 idObject,
Draw mode) Draw mode)
:VAbstractCubicBezier(GOType::Spline, idObject, mode), d(new VSplineData(p1, p2, p3, p4)) : VAbstractCubicBezier(GOType::Spline, idObject, mode),
d(new VSplineData(p1, p2, p3, p4))
{ {
CreateName(); CreateName();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief VSpline constructor * @brief VSpline constructor
@ -183,8 +177,7 @@ auto VSpline::Move(qreal length, qreal angle, const QString &prefix) const -> VS
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSpline::~VSpline() // NOLINT(hicpp-use-equals-default, modernize-use-equals-default) VSpline::~VSpline() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -238,8 +231,8 @@ auto VSpline::GetPoints () const -> QVector<QPointF>
* @return list with spline points. * @return list with spline points.
*/ */
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
auto VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1, auto VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2,
qreal kAsm2, qreal kCurve, qreal approximationScale) -> QVector<QPointF> qreal kCurve, qreal approximationScale) -> QVector<QPointF>
{ {
QLineF p1pX(p1.x(), p1.y(), p1.x() + 100, p1.y()); QLineF p1pX(p1.x(), p1.y(), p1.x() + 100, p1.y());
p1pX.setAngle(angle1); p1pX.setAngle(angle1);
@ -272,7 +265,8 @@ auto VSpline::operator =(const VSpline &spline) -> VSpline &
VSpline::VSpline(VSpline &&spline) noexcept VSpline::VSpline(VSpline &&spline) noexcept
: VAbstractCubicBezier(std::move(spline)), : VAbstractCubicBezier(std::move(spline)),
d(std::move(spline.d)) d(std::move(spline.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VSpline::operator=(VSpline &&spline) noexcept -> VSpline & auto VSpline::operator=(VSpline &&spline) noexcept -> VSpline &
@ -514,8 +508,8 @@ auto VSpline::Cubic(QVector<qreal> &x, qreal a, qreal b, qreal c) -> qint32
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VSpline::CalcT(qreal curveCoord1, qreal curveCoord2, qreal curveCoord3, qreal curveCoord4, auto VSpline::CalcT(qreal curveCoord1, qreal curveCoord2, qreal curveCoord3, qreal curveCoord4, qreal pointCoord)
qreal pointCoord) -> QVector<qreal> -> QVector<qreal>
{ {
const qreal a = -curveCoord1 + 3 * curveCoord2 - 3 * curveCoord3 + curveCoord4; const qreal a = -curveCoord1 + 3 * curveCoord2 - 3 * curveCoord3 + curveCoord4;
const qreal b = 3 * curveCoord1 - 6 * curveCoord2 + 3 * curveCoord3; const qreal b = 3 * curveCoord1 - 6 * curveCoord2 + 3 * curveCoord3;
@ -571,8 +565,10 @@ auto VSpline::ParamT (const QPointF &pBt) const -> qreal
const QPointF p2 = static_cast<QPointF>(GetP3()); const QPointF p2 = static_cast<QPointF>(GetP3());
const QPointF p3 = static_cast<QPointF>(GetP4()); const QPointF p3 = static_cast<QPointF>(GetP4());
// The explicit form of the Cubic Bézier curve // The explicit form of the Cubic Bézier curve
const qreal pointX = pow(1-t, 3)*p0.x() + 3*pow(1-t, 2)*t*p1.x() + 3*(1-t)*pow(t, 2)*p2.x() + pow(t, 3)*p3.x(); const qreal pointX = pow(1 - t, 3) * p0.x() + 3 * pow(1 - t, 2) * t * p1.x() +
const qreal pointY = pow(1-t, 3)*p0.y() + 3*pow(1-t, 2)*t*p1.y() + 3*(1-t)*pow(t, 2)*p2.y() + pow(t, 3)*p3.y(); 3 * (1 - t) * pow(t, 2) * p2.x() + pow(t, 3) * p3.x();
const qreal pointY = pow(1 - t, 3) * p0.y() + 3 * pow(1 - t, 2) * t * p1.y() +
3 * (1 - t) * pow(t, 2) * p2.y() + pow(t, 3) * p3.y();
const QLineF line(pBt, QPointF(pointX, pointY)); const QLineF line(pBt, QPointF(pointX, pointY));
if (line.length() <= eps) if (line.length() <= eps)

View File

@ -46,7 +46,8 @@
VSplinePath::VSplinePath(quint32 idObject, Draw mode) VSplinePath::VSplinePath(quint32 idObject, Draw mode)
: VAbstractCubicBezierPath(GOType::SplinePath, idObject, mode), : VAbstractCubicBezierPath(GOType::SplinePath, idObject, mode),
d(new VSplinePathData()) d(new VSplinePathData())
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplinePath::VSplinePath(const QVector<VFSplinePoint> &points, qreal kCurve, quint32 idObject, Draw mode) VSplinePath::VSplinePath(const QVector<VFSplinePoint> &points, qreal kCurve, quint32 idObject, Draw mode)
@ -93,14 +94,7 @@ VSplinePath::VSplinePath(const QVector<VSplinePoint> &points, quint32 idObject,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** COPY_CONSTRUCTOR_IMPL_2(VSplinePath, VAbstractCubicBezierPath)
* @brief VSplinePath copy constructor.
* @param splPath spline path.
*/
VSplinePath::VSplinePath(const VSplinePath &splPath)
: VAbstractCubicBezierPath(splPath),
d(splPath.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VSplinePath::Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix) const -> VSplinePath auto VSplinePath::Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix) const -> VSplinePath
@ -196,8 +190,7 @@ auto VSplinePath::Move(qreal length, qreal angle, const QString &prefix) const -
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplinePath::~VSplinePath() VSplinePath::~VSplinePath() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -319,7 +312,8 @@ auto VSplinePath::operator=(const VSplinePath &path) -> VSplinePath &
VSplinePath::VSplinePath(VSplinePath &&splPath) noexcept VSplinePath::VSplinePath(VSplinePath &&splPath) noexcept
: VAbstractCubicBezierPath(std::move(splPath)), : VAbstractCubicBezierPath(std::move(splPath)),
d(std::move(splPath.d)) d(std::move(splPath.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VSplinePath::operator=(VSplinePath &&path) noexcept -> VSplinePath & auto VSplinePath::operator=(VSplinePath &&path) noexcept -> VSplinePath &

View File

@ -40,7 +40,8 @@
*/ */
VFSplinePoint::VFSplinePoint() VFSplinePoint::VFSplinePoint()
: d(new VFSplinePointData) : d(new VFSplinePointData)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -53,16 +54,11 @@ VFSplinePoint::VFSplinePoint()
*/ */
VFSplinePoint::VFSplinePoint(const VPointF &pSpline, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2) VFSplinePoint::VFSplinePoint(const VPointF &pSpline, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2)
: d(new VFSplinePointData(pSpline, kAsm1, angle1, kAsm2, angle2)) : d(new VFSplinePointData(pSpline, kAsm1, angle1, kAsm2, angle2))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** COPY_CONSTRUCTOR_IMPL(VFSplinePoint)
* @brief VFSplinePoint copy constructor
* @param point point
*/
VFSplinePoint::VFSplinePoint(const VFSplinePoint &point)
:d(point.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VFSplinePoint::operator=(const VFSplinePoint &point) -> VFSplinePoint & auto VFSplinePoint::operator=(const VFSplinePoint &point) -> VFSplinePoint &
@ -79,7 +75,8 @@ auto VFSplinePoint::operator=(const VFSplinePoint &point) -> VFSplinePoint &
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VFSplinePoint::VFSplinePoint(VFSplinePoint &&point) noexcept VFSplinePoint::VFSplinePoint(VFSplinePoint &&point) noexcept
: d(std::move(point.d)) : d(std::move(point.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VFSplinePoint::operator=(VFSplinePoint &&point) noexcept -> VFSplinePoint & auto VFSplinePoint::operator=(VFSplinePoint &&point) noexcept -> VFSplinePoint &
@ -90,8 +87,7 @@ auto VFSplinePoint::operator=(VFSplinePoint &&point) noexcept->VFSplinePoint &
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VFSplinePoint::~VFSplinePoint() VFSplinePoint::~VFSplinePoint() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -218,10 +214,7 @@ VSplinePoint::VSplinePoint(const VPointF &pSpline, qreal angle1, const QString &
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplinePoint::VSplinePoint(const VSplinePoint &point) COPY_CONSTRUCTOR_IMPL(VSplinePoint)
: d(point.d)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VSplinePoint::operator=(const VSplinePoint &point) -> VSplinePoint & auto VSplinePoint::operator=(const VSplinePoint &point) -> VSplinePoint &
@ -238,7 +231,8 @@ auto VSplinePoint::operator=(const VSplinePoint &point) -> VSplinePoint &
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplinePoint::VSplinePoint(VSplinePoint &&point) noexcept VSplinePoint::VSplinePoint(VSplinePoint &&point) noexcept
: d(std::move(point.d)) : d(std::move(point.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VSplinePoint::operator=(VSplinePoint &&point) noexcept -> VSplinePoint & auto VSplinePoint::operator=(VSplinePoint &&point) noexcept -> VSplinePoint &
@ -249,9 +243,7 @@ auto VSplinePoint::operator=(VSplinePoint &&point) noexcept->VSplinePoint &
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplinePoint::~VSplinePoint() VSplinePoint::~VSplinePoint() = default;
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VSplinePoint::P() const -> VPointF auto VSplinePoint::P() const -> VPointF
@ -365,17 +357,10 @@ auto VSplinePoint::IsMovable() const -> bool
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VSplinePoint::ToJson() const -> QJsonObject auto VSplinePoint::ToJson() const -> QJsonObject
{ {
QJsonObject object QJsonObject object{
{ {"point", d->pSpline.ToJson()}, {"angle1", d->angle1}, {"angle1Formula", d->angle1F},
{"point", d->pSpline.ToJson()}, {"angle2", d->angle2}, {"angle2Formula", d->angle2F}, {"length1", d->length1},
{"angle1", d->angle1}, {"length1Formula", d->length1F}, {"length2", d->length2}, {"length2Formula", d->length2F},
{"angle1Formula", d->angle1F},
{"angle2", d->angle2},
{"angle2Formula", d->angle2F},
{"length1", d->length1},
{"length1Formula", d->length1F},
{"length2", d->length2},
{"length2Formula", d->length2F},
}; };
return object; return object;
} }

View File

@ -67,11 +67,12 @@ public:
void SetKAsm1(const qreal &value); void SetKAsm1(const qreal &value);
auto KAsm2() const -> qreal; auto KAsm2() const -> qreal;
void SetKAsm2(const qreal &value); void SetKAsm2(const qreal &value);
protected: protected:
QSharedDataPointer<VFSplinePointData> d; QSharedDataPointer<VFSplinePointData> d;
}; };
Q_DECLARE_METATYPE(VFSplinePoint) Q_DECLARE_METATYPE(VFSplinePoint) // NOLINT
Q_DECLARE_TYPEINFO(VFSplinePoint, Q_MOVABLE_TYPE); // NOLINT Q_DECLARE_TYPEINFO(VFSplinePoint, Q_MOVABLE_TYPE); // NOLINT
class VSplinePointData; class VSplinePointData;
@ -122,7 +123,7 @@ protected:
QSharedDataPointer<VSplinePointData> d; QSharedDataPointer<VSplinePointData> d;
}; };
Q_DECLARE_METATYPE(VSplinePoint) Q_DECLARE_METATYPE(VSplinePoint) // NOLINT
Q_DECLARE_TYPEINFO(VSplinePoint, Q_MOVABLE_TYPE); // NOLINT Q_DECLARE_TYPEINFO(VSplinePoint, Q_MOVABLE_TYPE); // NOLINT
#endif // VSPLINEPOINT_H #endif // VSPLINEPOINT_H

View File

@ -308,6 +308,12 @@ auto NextPattern(int patternIndex, const QVector<int> &pattern) -> int
} }
} // namespace } // namespace
//---------------------------------------------------------------------------------------------------------------------
VHPGLEngine::VHPGLEngine()
: m_penWidthPx(qCeil(ToPixel(0.025, Unit::Mm)))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VHPGLEngine::SortDetails(const QVector<VLayoutPiece> &details) -> QList<VLayoutPiece> auto VHPGLEngine::SortDetails(const QVector<VLayoutPiece> &details) -> QList<VLayoutPiece>
{ {

View File

@ -49,7 +49,7 @@ class VHPGLEngine
friend class VHPGLPaintDevice; friend class VHPGLPaintDevice;
public: public:
VHPGLEngine() = default; VHPGLEngine();
~VHPGLEngine() = default; ~VHPGLEngine() = default;
auto isActive() const -> bool; auto isActive() const -> bool;
@ -93,7 +93,7 @@ private:
QPoint m_currentPos{-1, -1}; QPoint m_currentPos{-1, -1};
bool m_singleLineFont{false}; bool m_singleLineFont{false};
bool m_singleStrokeOutlineFont{false}; bool m_singleStrokeOutlineFont{false};
int m_penWidthPx{qCeil(ToPixel(0.025, Unit::Mm))}; int m_penWidthPx;
qreal m_xscale{1}; qreal m_xscale{1};
qreal m_yscale{1}; qreal m_yscale{1};
bool m_showGrainline{true}; bool m_showGrainline{true};

View File

@ -27,29 +27,29 @@
*************************************************************************/ *************************************************************************/
#include "vabstractpiece.h" #include "vabstractpiece.h"
#include "../ifc/exception/vexception.h"
#include "../vgeometry/varc.h"
#include "../vgeometry/vlayoutplacelabel.h"
#include "../vgeometry/vpointf.h"
#include "../vmisc/compatibility.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vpatterndb/calculator.h"
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
#include "../vpatterndb/vcontainer.h"
#include "../vwidgets/vpiecegrainline.h"
#include "qline.h" #include "qline.h"
#include "qmath.h" #include "qmath.h"
#include "vabstractpiece_p.h" #include "vabstractpiece_p.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vgeometry/vpointf.h"
#include "../vgeometry/vlayoutplacelabel.h"
#include "../vgeometry/varc.h"
#include "../ifc/exception/vexception.h"
#include "../vmisc/compatibility.h"
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
#include "../vpatterndb/vcontainer.h"
#include "../vpatterndb/calculator.h"
#include "../vwidgets/vpiecegrainline.h"
#include "vrawsapoint.h" #include "vrawsapoint.h"
#include <QLineF>
#include <QSet>
#include <QVector>
#include <QPainterPath>
#include <QTemporaryFile>
#include <QJsonObject>
#include <QJsonArray> #include <QJsonArray>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject>
#include <QLineF>
#include <QPainterPath>
#include <QSet>
#include <QTemporaryFile>
#include <QVector>
#include <QtMath> #include <QtMath>
const qreal maxL = 3.5; const qreal maxL = 3.5;
@ -80,9 +80,9 @@ Q_DECL_CONSTEXPR auto PointPosition(const QPointF &p, const QLineF &line) -> qre
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto AngleByLength(QVector<VRawSAPoint> points, QPointF p1, QPointF p2, QPointF p3, auto AngleByLength(QVector<VRawSAPoint> points, QPointF p1, QPointF p2, QPointF p3, const QLineF &bigLine1, QPointF sp2,
const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2, const VSAPoint &p, const QLineF &bigLine2, const VSAPoint &p, qreal width, bool *needRollback = nullptr)
qreal width, bool *needRollback = nullptr) -> QVector<VRawSAPoint> -> QVector<VRawSAPoint>
{ {
if (needRollback != nullptr) if (needRollback != nullptr)
{ {
@ -218,9 +218,9 @@ auto AngleByLength(QVector<VRawSAPoint> points, QPointF p1, QPointF p2, QPointF
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto AngleByIntersection(const QVector<VRawSAPoint> &points, QPointF p1, QPointF p2, QPointF p3, auto AngleByIntersection(const QVector<VRawSAPoint> &points, QPointF p1, QPointF p2, QPointF p3, const QLineF &bigLine1,
const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2, QPointF sp2, const QLineF &bigLine2, const VSAPoint &p, qreal width,
const VSAPoint &p, qreal width, bool *needRollback = nullptr) -> QVector<VRawSAPoint> bool *needRollback = nullptr) -> QVector<VRawSAPoint>
{ {
{ {
QLineF edge1(p2, p1); QLineF edge1(p2, p1);
@ -306,8 +306,8 @@ auto AngleByIntersection(const QVector<VRawSAPoint> &points, QPointF p1, QPointF
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto AngleByFirstSymmetry(const QVector<VRawSAPoint> &points, QPointF p1, QPointF p2, QPointF p3, auto AngleByFirstSymmetry(const QVector<VRawSAPoint> &points, QPointF p1, QPointF p2, QPointF p3,
const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2, const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2, const VSAPoint &p, qreal width,
const VSAPoint &p, qreal width, bool *needRollback = nullptr) -> QVector<VRawSAPoint> bool *needRollback = nullptr) -> QVector<VRawSAPoint>
{ {
{ {
QLineF edge1(p2, p1); QLineF edge1(p2, p1);
@ -387,8 +387,8 @@ auto AngleByFirstSymmetry(const QVector<VRawSAPoint> &points, QPointF p1, QPoint
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto AngleBySecondSymmetry(const QVector<VRawSAPoint> &points, QPointF p1, QPointF p2, QPointF p3, auto AngleBySecondSymmetry(const QVector<VRawSAPoint> &points, QPointF p1, QPointF p2, QPointF p3,
const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2, const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2, const VSAPoint &p, qreal width,
const VSAPoint &p, qreal width, bool *needRollback = nullptr) -> QVector<VRawSAPoint> bool *needRollback = nullptr) -> QVector<VRawSAPoint>
{ {
{ {
QLineF edge1(p2, p1); QLineF edge1(p2, p1);
@ -470,8 +470,8 @@ auto AngleBySecondSymmetry(const QVector<VRawSAPoint> &points, QPointF p1, QPoin
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto AngleByFirstRightAngle(const QVector<VRawSAPoint> &points, QPointF p1, QPointF p2, QPointF p3, auto AngleByFirstRightAngle(const QVector<VRawSAPoint> &points, QPointF p1, QPointF p2, QPointF p3,
const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2, const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2, const VSAPoint &p, qreal width,
const VSAPoint &p, qreal width, bool *needRollback = nullptr) -> QVector<VRawSAPoint> bool *needRollback = nullptr) -> QVector<VRawSAPoint>
{ {
{ {
QLineF edge1(p2, p1); QLineF edge1(p2, p1);
@ -649,8 +649,7 @@ auto SingleParallelPoint(const QPointF &p1, const QPointF &p2, qreal angle, qrea
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto SimpleParallelLine(const QPointF &p1, const QPointF &p2, qreal width) -> QLineF auto SimpleParallelLine(const QPointF &p1, const QPointF &p2, qreal width) -> QLineF
{ {
const QLineF paralel = QLineF(SingleParallelPoint(p1, p2, 90, width), const QLineF paralel = QLineF(SingleParallelPoint(p1, p2, 90, width), SingleParallelPoint(p2, p1, -90, width));
SingleParallelPoint(p2, p1, -90, width));
return paralel; return paralel;
} }
@ -699,8 +698,7 @@ auto AngleBetweenBisectors(const QLineF &b1, const QLineF &b2) -> qreal
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template<class T> template <class T> auto CorrectPathDistortion(QVector<T> path) -> QVector<T>
auto CorrectPathDistortion(QVector<T> path) -> QVector<T>
{ {
if (path.size() < 3) if (path.size() < 3)
{ {
@ -911,12 +909,11 @@ auto operator>>(QDataStream &dataStream, VAbstractPiece &piece) -> QDataStream &
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractPiece::VAbstractPiece() VAbstractPiece::VAbstractPiece()
: d(new VAbstractPieceData) : d(new VAbstractPieceData)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractPiece::VAbstractPiece(const VAbstractPiece &piece) COPY_CONSTRUCTOR_IMPL(VAbstractPiece)
:d (piece.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractPiece::operator=(const VAbstractPiece &piece) -> VAbstractPiece & auto VAbstractPiece::operator=(const VAbstractPiece &piece) -> VAbstractPiece &
@ -933,7 +930,8 @@ auto VAbstractPiece::operator=(const VAbstractPiece &piece) -> VAbstractPiece &
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractPiece::VAbstractPiece(VAbstractPiece &&piece) noexcept VAbstractPiece::VAbstractPiece(VAbstractPiece &&piece) noexcept
: d(std::move(piece.d)) : d(std::move(piece.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractPiece::operator=(VAbstractPiece &&piece) noexcept -> VAbstractPiece & auto VAbstractPiece::operator=(VAbstractPiece &&piece) noexcept -> VAbstractPiece &
@ -944,8 +942,7 @@ auto VAbstractPiece::operator=(VAbstractPiece &&piece) noexcept -> VAbstractPiec
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractPiece::~VAbstractPiece() VAbstractPiece::~VAbstractPiece() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractPiece::GetName() const -> QString auto VAbstractPiece::GetName() const -> QString
@ -1074,8 +1071,9 @@ auto VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal width, const QS
const QString errorMsg = const QString errorMsg =
QCoreApplication::translate("VAbstractPiece", "Piece '%1'. Not enough points to build seam allowance.") QCoreApplication::translate("VAbstractPiece", "Piece '%1'. Not enough points to build seam allowance.")
.arg(name); .arg(name);
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; ? throw VException(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return {}; return {};
} }
@ -1200,8 +1198,8 @@ auto VAbstractPiece::SumTrapezoids(const QVector<QPointF> &points) -> qreal
* @return seam aloowance points. * @return seam aloowance points.
*/ */
auto VAbstractPiece::EkvPoint(QVector<VRawSAPoint> points, const VSAPoint &p1Line1, const VSAPoint &p2Line1, auto VAbstractPiece::EkvPoint(QVector<VRawSAPoint> points, const VSAPoint &p1Line1, const VSAPoint &p2Line1,
const VSAPoint &p1Line2, const VSAPoint &p2Line2, qreal width, const VSAPoint &p1Line2, const VSAPoint &p2Line2, qreal width, bool *needRollback)
bool *needRollback) -> QVector<VRawSAPoint> -> QVector<VRawSAPoint>
{ {
if (width < 0) if (width < 0)
{ // width can't be < 0 { // width can't be < 0
@ -1295,8 +1293,7 @@ auto VAbstractPiece::EkvPoint(QVector<VRawSAPoint> points, const VSAPoint &p1Lin
const qreal angle = AngleBetweenBisectors(b1, b2); const qreal angle = AngleBetweenBisectors(b1, b2);
// Comparison bisector angles helps to find direction // Comparison bisector angles helps to find direction
if (angle < 135 if (angle < 135 || VFuzzyComparePossibleNulls(angle, 135.0)) // Go in a same direction
|| VFuzzyComparePossibleNulls(angle, 135.0))// Go in a same direction
{ // Regular equdistant case { // Regular equdistant case
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
@ -1452,8 +1449,8 @@ auto VAbstractPiece::IsEkvPointOnLine(const QPointF &iPoint, const QPointF &prev
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractPiece::IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &prevPoint, auto VAbstractPiece::IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &prevPoint, const VSAPoint &nextPoint)
const VSAPoint &nextPoint) -> bool -> bool
{ {
// See bug #671 // See bug #671
const qreal tmpWidth = 10; const qreal tmpWidth = 10;
@ -1583,8 +1580,8 @@ auto VSAPoint::toJson() const -> QJsonObject
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// Because artificial loop can lead to wrong clipping we must rollback current seam allowance points // Because artificial loop can lead to wrong clipping we must rollback current seam allowance points
auto VAbstractPiece::RollbackSeamAllowance(QVector<VRawSAPoint> points, const QLineF &cuttingEdge, auto VAbstractPiece::RollbackSeamAllowance(QVector<VRawSAPoint> points, const QLineF &cuttingEdge, bool *success)
bool *success) -> QVector<VRawSAPoint> -> QVector<VRawSAPoint>
{ {
*success = false; *success = false;
QVector<VRawSAPoint> clipped; QVector<VRawSAPoint> clipped;
@ -1595,9 +1592,8 @@ auto VAbstractPiece::RollbackSeamAllowance(QVector<VRawSAPoint> points, const QL
QPointF crosPoint; QPointF crosPoint;
const QLineF::IntersectType type = Intersects(cuttingEdge, segment, &crosPoint); const QLineF::IntersectType type = Intersects(cuttingEdge, segment, &crosPoint);
if (type != QLineF::NoIntersection if (type != QLineF::NoIntersection && VGObject::IsPointOnLineSegment(crosPoint, segment.p1(), segment.p2()) &&
&& VGObject::IsPointOnLineSegment(crosPoint, segment.p1(), segment.p2()) IsSameDirection(cuttingEdge.p2(), cuttingEdge.p1(), crosPoint))
&& IsSameDirection(cuttingEdge.p2(), cuttingEdge.p1(), crosPoint))
{ {
clipped.append(VRawSAPoint(crosPoint, points.at(i).CurvePoint(), points.at(i).TurnPoint())); clipped.append(VRawSAPoint(crosPoint, points.at(i).CurvePoint(), points.at(i).TurnPoint()));
for (auto j = i - 1; j >= 0; --j) for (auto j = i - 1; j >= 0; --j)
@ -1750,8 +1746,8 @@ auto VAbstractPiece::FindGrainlineGeometry(const VGrainlineData& geom, const VCo
{ {
const auto centerPinPoint = pattern->GeometricObject<VPointF>(centerPin); const auto centerPinPoint = pattern->GeometricObject<VPointF>(centerPin);
QLineF grainline(centerPinPoint->x(), centerPinPoint->y(), QLineF grainline(centerPinPoint->x(), centerPinPoint->y(), centerPinPoint->x() + length / 2.0,
centerPinPoint->x() + length / 2.0, centerPinPoint->y()); centerPinPoint->y());
grainline.setAngle(qRadiansToDegrees(rotationAngle)); grainline.setAngle(qRadiansToDegrees(rotationAngle));
grainline = QLineF(grainline.p2(), grainline.p1()); grainline = QLineF(grainline.p2(), grainline.p1());
@ -1832,11 +1828,8 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
auto SegmentShape = [pos, box, LayoutPoint]() auto SegmentShape = [pos, box, LayoutPoint]()
{ {
QVector<VLayoutPoint> shape QVector<VLayoutPoint> shape{LayoutPoint(QPointF(pos.x(), pos.y() - box.height() / 2.0), true),
{ LayoutPoint(QPointF(pos.x(), pos.y() + box.height() / 2.0), true)};
LayoutPoint(QPointF(pos.x(), pos.y() - box.height()/2.0), true),
LayoutPoint(QPointF(pos.x(), pos.y() + box.height()/2.0), true)
};
return PlaceLabelImg{shape}; return PlaceLabelImg{shape};
}; };
@ -1846,31 +1839,20 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
QRectF rect(QPointF(pos.x() - box.width() / 2.0, pos.y() - box.height() / 2.0), QRectF rect(QPointF(pos.x() - box.width() / 2.0, pos.y() - box.height() / 2.0),
QPointF(pos.x() + box.width() / 2.0, pos.y() + box.height() / 2.0)); QPointF(pos.x() + box.width() / 2.0, pos.y() + box.height() / 2.0));
QVector<VLayoutPoint> shape QVector<VLayoutPoint> shape{LayoutPoint(rect.topLeft(), true), LayoutPoint(rect.topRight(), true),
{ LayoutPoint(rect.bottomRight(), true), LayoutPoint(rect.bottomLeft(), true),
LayoutPoint(rect.topLeft(), true), LayoutPoint(rect.topLeft(), true)};
LayoutPoint(rect.topRight(), true),
LayoutPoint(rect.bottomRight(), true),
LayoutPoint(rect.bottomLeft(), true),
LayoutPoint(rect.topLeft(), true)
};
return PlaceLabelImg{shape}; return PlaceLabelImg{shape};
}; };
auto CrossShape = [pos, box, LayoutPoint]() auto CrossShape = [pos, box, LayoutPoint]()
{ {
QVector<VLayoutPoint> shape1 QVector<VLayoutPoint> shape1{LayoutPoint(QPointF(pos.x(), pos.y() - box.height() / 2.0), true),
{ LayoutPoint(QPointF(pos.x(), pos.y() + box.height() / 2.0), true)};
LayoutPoint(QPointF(pos.x(), pos.y() - box.height()/2.0), true),
LayoutPoint(QPointF(pos.x(), pos.y() + box.height()/2.0), true)
};
QVector<VLayoutPoint> shape2 QVector<VLayoutPoint> shape2{LayoutPoint(QPointF(pos.x() - box.width() / 2.0, pos.y()), true),
{ LayoutPoint(QPointF(pos.x() + box.width() / 2.0, pos.y()), true)};
LayoutPoint(QPointF(pos.x() - box.width()/2.0, pos.y()), true),
LayoutPoint(QPointF(pos.x() + box.width()/2.0, pos.y()), true)
};
return PlaceLabelImg{shape1, shape2}; return PlaceLabelImg{shape1, shape2};
}; };
@ -1879,17 +1861,10 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
{ {
QPointF center2(pos.x(), pos.y() + box.height() / 2.0); QPointF center2(pos.x(), pos.y() + box.height() / 2.0);
QVector<VLayoutPoint> shape1 QVector<VLayoutPoint> shape1{LayoutPoint(QPointF(pos.x(), pos.y()), true), LayoutPoint(center2, true)};
{
LayoutPoint(QPointF(pos.x(), pos.y()), true),
LayoutPoint(center2, true)
};
QVector<VLayoutPoint> shape2 QVector<VLayoutPoint> shape2{LayoutPoint(QPointF(center2.x() - box.width() / 2.0, center2.y()), true),
{ LayoutPoint(QPointF(center2.x() + box.width() / 2.0, center2.y()), true)};
LayoutPoint(QPointF(center2.x() - box.width()/2.0, center2.y()), true),
LayoutPoint(QPointF(center2.x() + box.width()/2.0, center2.y()), true)
};
return PlaceLabelImg{shape1, shape2}; return PlaceLabelImg{shape1, shape2};
}; };
@ -1899,34 +1874,20 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
QRectF rect(QPointF(pos.x() - box.width() / 2.0, pos.y() - box.height() / 2.0), QRectF rect(QPointF(pos.x() - box.width() / 2.0, pos.y() - box.height() / 2.0),
QPointF(pos.x() + box.width() / 2.0, pos.y() + box.height() / 2.0)); QPointF(pos.x() + box.width() / 2.0, pos.y() + box.height() / 2.0));
QVector<VLayoutPoint> shape1 QVector<VLayoutPoint> shape1{LayoutPoint(rect.topLeft(), true), LayoutPoint(rect.bottomRight(), true)};
{
LayoutPoint(rect.topLeft(), true),
LayoutPoint(rect.bottomRight(), true)
};
QVector<VLayoutPoint> shape2 QVector<VLayoutPoint> shape2{LayoutPoint(rect.topRight(), true), LayoutPoint(rect.bottomLeft(), true)};
{
LayoutPoint(rect.topRight(), true),
LayoutPoint(rect.bottomLeft(), true)
};
return PlaceLabelImg{shape1, shape2}; return PlaceLabelImg{shape1, shape2};
}; };
auto CornerShape = [pos, box, LayoutPoint]() auto CornerShape = [pos, box, LayoutPoint]()
{ {
QVector<VLayoutPoint> shape1 QVector<VLayoutPoint> shape1{LayoutPoint(QPointF(pos.x(), pos.y()), true),
{ LayoutPoint(QPointF(pos.x(), pos.y() + box.height() / 2.0), true)};
LayoutPoint(QPointF(pos.x(), pos.y()), true),
LayoutPoint(QPointF(pos.x(), pos.y() + box.height()/2.0), true)
};
QVector<VLayoutPoint> shape2 QVector<VLayoutPoint> shape2{LayoutPoint(QPointF(pos.x() - box.width() / 2.0, pos.y()), true),
{ LayoutPoint(QPointF(pos.x(), pos.y()), true)};
LayoutPoint(QPointF(pos.x() - box.width()/2.0, pos.y()), true),
LayoutPoint(QPointF(pos.x(), pos.y()), true)
};
return PlaceLabelImg{shape1, shape2}; return PlaceLabelImg{shape1, shape2};
}; };
@ -1936,13 +1897,8 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
QRectF rect(QPointF(pos.x() - box.width() / 2.0, pos.y() - box.height() / 2.0), QRectF rect(QPointF(pos.x() - box.width() / 2.0, pos.y() - box.height() / 2.0),
QPointF(pos.x() + box.width() / 2.0, pos.y() + box.height() / 2.0)); QPointF(pos.x() + box.width() / 2.0, pos.y() + box.height() / 2.0));
QVector<VLayoutPoint> shape QVector<VLayoutPoint> shape{LayoutPoint(rect.topLeft(), true), LayoutPoint(rect.topRight(), true),
{ LayoutPoint(rect.bottomRight(), true), LayoutPoint(rect.topLeft(), true)};
LayoutPoint(rect.topLeft(), true),
LayoutPoint(rect.topRight(), true),
LayoutPoint(rect.bottomRight(), true),
LayoutPoint(rect.topLeft(), true)
};
return PlaceLabelImg{shape}; return PlaceLabelImg{shape};
}; };
@ -1952,23 +1908,13 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
const QPointF center1(pos.x(), pos.y() - box.height() / 2.0); const QPointF center1(pos.x(), pos.y() - box.height() / 2.0);
const QPointF center2(pos.x(), pos.y() + box.height() / 2.0); const QPointF center2(pos.x(), pos.y() + box.height() / 2.0);
QVector<VLayoutPoint> shape1 QVector<VLayoutPoint> shape1{LayoutPoint(center1, true), LayoutPoint(center2, true)};
{
LayoutPoint(center1, true),
LayoutPoint(center2, true)
};
QVector<VLayoutPoint> shape2 QVector<VLayoutPoint> shape2{LayoutPoint(QPointF(center1.x() - box.width() / 2.0, center1.y()), true),
{ LayoutPoint(QPointF(center1.x() + box.width() / 2.0, center1.y()), true)};
LayoutPoint(QPointF(center1.x() - box.width()/2.0, center1.y()), true),
LayoutPoint(QPointF(center1.x() + box.width()/2.0, center1.y()), true)
};
QVector<VLayoutPoint> shape3 QVector<VLayoutPoint> shape3{LayoutPoint(QPointF(center2.x() - box.width() / 2.0, center2.y()), true),
{ LayoutPoint(QPointF(center2.x() + box.width() / 2.0, center2.y()), true)};
LayoutPoint(QPointF(center2.x() - box.width()/2.0, center2.y()), true),
LayoutPoint(QPointF(center2.x() + box.width()/2.0, center2.y()), true)
};
return PlaceLabelImg{shape1, shape2, shape3}; return PlaceLabelImg{shape1, shape2, shape3};
}; };
@ -1976,17 +1922,11 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
auto ButtonShape = [pos, box, LayoutPoint]() auto ButtonShape = [pos, box, LayoutPoint]()
{ {
const qreal radius = qMin(box.width() / 2.0, box.height() / 2.0); const qreal radius = qMin(box.width() / 2.0, box.height() / 2.0);
QVector<VLayoutPoint> shape1 QVector<VLayoutPoint> shape1{LayoutPoint(QPointF(pos.x(), pos.y() - radius), true),
{ LayoutPoint(QPointF(pos.x(), pos.y() + radius), true)};
LayoutPoint(QPointF(pos.x(), pos.y() - radius), true),
LayoutPoint(QPointF(pos.x(), pos.y() + radius), true)
};
QVector<VLayoutPoint> shape2 QVector<VLayoutPoint> shape2{LayoutPoint(QPointF(pos.x() - radius, pos.y()), true),
{ LayoutPoint(QPointF(pos.x() + radius, pos.y()), true)};
LayoutPoint(QPointF(pos.x() - radius, pos.y()), true),
LayoutPoint(QPointF(pos.x() + radius, pos.y()), true)
};
const qreal circleSize = 0.85; const qreal circleSize = 0.85;
VArc arc(VPointF(pos), radius * circleSize, 0, 360); VArc arc(VPointF(pos), radius * circleSize, 0, 360);

View File

@ -27,8 +27,8 @@
*************************************************************************/ *************************************************************************/
#include "vbestsquare.h" #include "vbestsquare.h"
#include "vbestsquare_p.h"
#include "../vgeometry/vgeometrydef.h" #include "../vgeometry/vgeometrydef.h"
#include "vbestsquare_p.h"
namespace namespace
{ {
@ -42,21 +42,20 @@ Q_DECL_CONSTEXPR inline auto Square(QSizeF size) -> qint64
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VBestSquare::VBestSquare() VBestSquare::VBestSquare()
: d(new VBestSquareData()) : d(new VBestSquareData())
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VBestSquare::VBestSquare(QSizeF sheetSize, bool saveLength, bool isPortrait) VBestSquare::VBestSquare(QSizeF sheetSize, bool saveLength, bool isPortrait)
: d(new VBestSquareData(sheetSize, saveLength, isPortrait)) : d(new VBestSquareData(sheetSize, saveLength, isPortrait))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VBestSquare::VBestSquare(const VBestSquare &res) COPY_CONSTRUCTOR_IMPL(VBestSquare)
: d(res.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VBestSquare::~VBestSquare() VBestSquare::~VBestSquare() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VBestSquare::operator=(const VBestSquare &res) -> VBestSquare & auto VBestSquare::operator=(const VBestSquare &res) -> VBestSquare &
@ -73,7 +72,8 @@ auto VBestSquare::operator=(const VBestSquare &res) -> VBestSquare &
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VBestSquare::VBestSquare(VBestSquare &&res) noexcept VBestSquare::VBestSquare(VBestSquare &&res) noexcept
: d(std::move(res.d)) : d(std::move(res.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VBestSquare::operator=(VBestSquare &&res) noexcept -> VBestSquare & auto VBestSquare::operator=(VBestSquare &&res) noexcept -> VBestSquare &
@ -104,12 +104,9 @@ void VBestSquare::NewResult(const VBestSquareResData &data)
{ {
if (d->saveLength) if (d->saveLength)
{ {
if (VFuzzyOnAxis(data.depthPosition, d->data.depthPosition) if ((VFuzzyOnAxis(data.depthPosition, d->data.depthPosition) &&
&& IsImprovedSidePosition(data.sidePosition)) IsImprovedSidePosition(data.sidePosition)) ||
{ data.depthPosition < d->data.depthPosition)
SaveResult();
}
else if (data.depthPosition < d->data.depthPosition)
{ {
SaveResult(); SaveResult();
} }

View File

@ -29,11 +29,11 @@
#ifndef VBESTSQUARE_H #ifndef VBESTSQUARE_H
#define VBESTSQUARE_H #define VBESTSQUARE_H
#include <QSharedDataPointer>
#include <QSizeF> #include <QSizeF>
#include <QTransform> #include <QTransform>
#include <QtGlobal>
#include <QSharedDataPointer>
#include <QTypeInfo> #include <QTypeInfo>
#include <QtGlobal>
#include "vlayoutdef.h" #include "vlayoutdef.h"
@ -75,7 +75,6 @@ public:
private: private:
QSharedDataPointer<VBestSquareData> d; QSharedDataPointer<VBestSquareData> d;
}; };
Q_DECLARE_TYPEINFO(VBestSquare, Q_MOVABLE_TYPE); // NOLINT Q_DECLARE_TYPEINFO(VBestSquare, Q_MOVABLE_TYPE); // NOLINT

View File

@ -106,7 +106,7 @@ VContour::VContour(int height, int width, qreal layoutWidth)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VContour::VContour(const VContour &contour) = default; COPY_CONSTRUCTOR_IMPL(VContour)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VContour::operator=(const VContour &contour) -> VContour & auto VContour::operator=(const VContour &contour) -> VContour &

View File

@ -35,8 +35,8 @@
#include <QVector> #include <QVector>
#include <QtGlobal> #include <QtGlobal>
#include "vlayoutdef.h"
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
#include "vlayoutdef.h"
class VContourData; class VContourData;
class QPointF; class QPointF;

View File

@ -48,7 +48,6 @@
#endif #endif
#include "../ifc/exception/vexceptionterminatedposition.h" #include "../ifc/exception/vexceptionterminatedposition.h"
#include "../vmisc/compatibility.h"
#include "vbestsquare.h" #include "vbestsquare.h"
#include "vcontour.h" #include "vcontour.h"
#include "vlayoutpaper_p.h" #include "vlayoutpaper_p.h"
@ -68,10 +67,7 @@ VLayoutPaper::VLayoutPaper(int height, int width, qreal layoutWidth)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutPaper::VLayoutPaper(const VLayoutPaper &paper) COPY_CONSTRUCTOR_IMPL(VLayoutPaper)
: d(paper.d)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLayoutPaper::operator=(const VLayoutPaper &paper) -> VLayoutPaper & auto VLayoutPaper::operator=(const VLayoutPaper &paper) -> VLayoutPaper &
@ -100,9 +96,7 @@ auto VLayoutPaper::operator=(VLayoutPaper &&paper) noexcept -> VLayoutPaper &
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutPaper::~VLayoutPaper() VLayoutPaper::~VLayoutPaper() = default;
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLayoutPaper::GetHeight() const -> int auto VLayoutPaper::GetHeight() const -> int
@ -382,7 +376,7 @@ auto VLayoutPaper::GetGlobalContour() const -> QGraphicsPathItem *
const QVector<QPointF> points = d->globalContour.GetContour(); const QVector<QPointF> points = d->globalContour.GetContour();
QPainterPath path; QPainterPath path;
if (points.size() > 0) if (!points.isEmpty())
{ {
path.moveTo(points.at(0)); path.moveTo(points.at(0));
for (auto point : points) for (auto point : points)

View File

@ -29,13 +29,12 @@
#ifndef VLAYOUTPAPER_H #ifndef VLAYOUTPAPER_H
#define VLAYOUTPAPER_H #define VLAYOUTPAPER_H
#include <QGraphicsPathItem>
#include <QSharedDataPointer> #include <QSharedDataPointer>
#include <QTypeInfo> #include <QTypeInfo>
#include <QtCore/qcontainerfwd.h>
#include <QtGlobal> #include <QtGlobal>
#include <atomic> #include <atomic>
#include <QGraphicsPathItem>
#include <QtCore/qcontainerfwd.h>
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"

View File

@ -595,11 +595,7 @@ VLayoutPiece::VLayoutPiece()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutPiece::VLayoutPiece(const VLayoutPiece &detail) // NOLINT(modernize-use-equals-default) COPY_CONSTRUCTOR_IMPL_2(VLayoutPiece, VAbstractPiece)
: VAbstractPiece(detail),
d(detail.d)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLayoutPiece::operator=(const VLayoutPiece &detail) -> VLayoutPiece & auto VLayoutPiece::operator=(const VLayoutPiece &detail) -> VLayoutPiece &
@ -615,14 +611,14 @@ auto VLayoutPiece::operator=(const VLayoutPiece &detail) -> VLayoutPiece &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutPiece::VLayoutPiece(VLayoutPiece &&detail) noexcept : VAbstractPiece(std::move(detail)), VLayoutPiece::VLayoutPiece(VLayoutPiece &&detail) noexcept
: VAbstractPiece(std::move(detail)),
d(std::move(detail.d)) d(std::move(detail.d))
{ {
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLayoutPiece::operator=(VLayoutPiece &&detail) noexcept auto VLayoutPiece::operator=(VLayoutPiece &&detail) noexcept -> VLayoutPiece &
->VLayoutPiece &
{ {
VAbstractPiece::operator=(detail); VAbstractPiece::operator=(detail);
std::swap(d, detail.d); std::swap(d, detail.d);
@ -631,9 +627,7 @@ auto VLayoutPiece::operator=(VLayoutPiece &&detail) noexcept
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutPiece::~VLayoutPiece() // NOLINT(modernize-use-equals-default) VLayoutPiece::~VLayoutPiece() = default;
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContainer *pattern) -> VLayoutPiece auto VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContainer *pattern) -> VLayoutPiece

View File

@ -91,8 +91,7 @@ public:
auto operator=(const VLayoutPiece &detail) -> VLayoutPiece &; auto operator=(const VLayoutPiece &detail) -> VLayoutPiece &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VLayoutPiece(VLayoutPiece &&detail) noexcept; VLayoutPiece(VLayoutPiece &&detail) noexcept;
auto operator=(VLayoutPiece &&detail) noexcept auto operator=(VLayoutPiece &&detail) noexcept -> VLayoutPiece &;
->VLayoutPiece &;
#endif #endif
static auto Create(const VPiece &piece, vidtype id, const VContainer *pattern) -> VLayoutPiece; static auto Create(const VPiece &piece, vidtype id, const VContainer *pattern) -> VLayoutPiece;
@ -265,7 +264,7 @@ Q_DECLARE_TYPEINFO(VLayoutPiece, Q_MOVABLE_TYPE); // NOLINT
template <class T> inline auto VLayoutPiece::Map(QVector<T> points, const QTransform &matrix, bool mirror) -> QVector<T> template <class T> inline auto VLayoutPiece::Map(QVector<T> points, const QTransform &matrix, bool mirror) -> QVector<T>
{ {
std::transform(points.begin(), points.end(), points.begin(), std::transform(points.begin(), points.end(), points.begin(),
[matrix](const T &point) { return Map(point, matrix); }); [matrix](const T &point) { return VLayoutPiece::Map(point, matrix); });
if (mirror) if (mirror)
{ {
std::reverse(points.begin(), points.end()); std::reverse(points.begin(), points.end());

View File

@ -59,10 +59,7 @@ VLayoutPiecePath::VLayoutPiecePath(const QVector<VLayoutPoint> &points)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutPiecePath::VLayoutPiecePath(const VLayoutPiecePath &path) COPY_CONSTRUCTOR_IMPL(VLayoutPiecePath)
: d(path.d)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLayoutPiecePath::operator=(const VLayoutPiecePath &path) -> VLayoutPiecePath & auto VLayoutPiecePath::operator=(const VLayoutPiecePath &path) -> VLayoutPiecePath &
@ -79,7 +76,8 @@ auto VLayoutPiecePath::operator=(const VLayoutPiecePath &path) -> VLayoutPiecePa
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutPiecePath::VLayoutPiecePath(VLayoutPiecePath &&path) noexcept VLayoutPiecePath::VLayoutPiecePath(VLayoutPiecePath &&path) noexcept
: d(std::move(path.d)) : d(std::move(path.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLayoutPiecePath::operator=(VLayoutPiecePath &&path) noexcept -> VLayoutPiecePath & auto VLayoutPiecePath::operator=(VLayoutPiecePath &&path) noexcept -> VLayoutPiecePath &
@ -90,9 +88,7 @@ auto VLayoutPiecePath::operator=(VLayoutPiecePath &&path) noexcept->VLayoutPiece
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutPiecePath::~VLayoutPiecePath() VLayoutPiecePath::~VLayoutPiecePath() = default;
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLayoutPiecePath::GetPainterPath() const -> QPainterPath auto VLayoutPiecePath::GetPainterPath() const -> QPainterPath

View File

@ -68,6 +68,28 @@ template <class T> class QSharedPointer;
#endif #endif
#endif #endif
#if defined(Q_COMPILER_GCC) && defined(Q_CC_GNU) && defined(Q_CC_GNU_VERSION) && (Q_CC_GNU_VERSION <= 40900)
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define COPY_CONSTRUCTOR_IMPL(className) \
className::className(const className &item) \
: d(item.d) \
{ \
}
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define COPY_CONSTRUCTOR_IMPL_2(className, baseClassName) \
className::className(const className &item) \
: baseClassName(item), \
d(item.d) \
{ \
}
#else
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define COPY_CONSTRUCTOR_IMPL(className) className::className(const className &) = default;
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define COPY_CONSTRUCTOR_IMPL_2(className, baseClassName) className::className(const className &) = default;
#endif
class QComboBox; class QComboBox;
class QMarginsF; class QMarginsF;
class VTranslateMeasurements; class VTranslateMeasurements;
@ -501,7 +523,7 @@ template <typename T> constexpr inline auto InchToPixel(T val) noexcept -> T
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline auto ToPixel(double val, const Unit &unit) -> double Q_DECL_RELAXED_CONSTEXPR inline auto ToPixel(double val, const Unit &unit) noexcept -> double
{ {
switch (unit) switch (unit)
{ {

View File

@ -26,6 +26,7 @@
** **
*************************************************************************/ *************************************************************************/
#include "vsvgfont.h" #include "vsvgfont.h"
#include "../def.h"
#include "svgdef.h" #include "svgdef.h"
#include "vsvgfont_p.h" #include "vsvgfont_p.h"
@ -47,15 +48,10 @@ VSvgFont::VSvgFont(qreal horizAdvX)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSvgFont::VSvgFont(const VSvgFont &font) // NOLINT(modernize-use-equals-default) COPY_CONSTRUCTOR_IMPL(VSvgFont)
: d(font.d)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSvgFont::~VSvgFont() // NOLINT(modernize-use-equals-default) VSvgFont::~VSvgFont() = default;
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VSvgFont::operator=(const VSvgFont &font) -> VSvgFont & auto VSvgFont::operator=(const VSvgFont &font) -> VSvgFont &

View File

@ -53,15 +53,10 @@ VSvgFontEngine::VSvgFontEngine(const VSvgFont &font)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSvgFontEngine::VSvgFontEngine(const VSvgFontEngine &engine) // NOLINT(modernize-use-equals-default) COPY_CONSTRUCTOR_IMPL(VSvgFontEngine)
: d(engine.d)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSvgFontEngine::~VSvgFontEngine() // NOLINT(modernize-use-equals-default) VSvgFontEngine::~VSvgFontEngine() = default;
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VSvgFontEngine::operator=(const VSvgFontEngine &engine) -> VSvgFontEngine & auto VSvgFontEngine::operator=(const VSvgFontEngine &engine) -> VSvgFontEngine &

View File

@ -26,6 +26,7 @@
** **
*************************************************************************/ *************************************************************************/
#include "vsvgglyph.h" #include "vsvgglyph.h"
#include "../def.h"
#include "vsvgglyph_p.h" #include "vsvgglyph_p.h"
#include <QChar> #include <QChar>
@ -44,15 +45,10 @@ VSvgGlyph::VSvgGlyph(QChar unicode, const QPainterPath &path, qreal horizAdvX)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSvgGlyph::VSvgGlyph(const VSvgGlyph &font) // NOLINT(modernize-use-equals-default) COPY_CONSTRUCTOR_IMPL(VSvgGlyph)
: d(font.d)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSvgGlyph::~VSvgGlyph() // NOLINT(modernize-use-equals-default) VSvgGlyph::~VSvgGlyph() = default;
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VSvgGlyph::operator=(const VSvgGlyph &glyph) -> VSvgGlyph & auto VSvgGlyph::operator=(const VSvgGlyph &glyph) -> VSvgGlyph &

View File

@ -27,17 +27,17 @@
*************************************************************************/ *************************************************************************/
#include "vabstractfloatitemdata.h" #include "vabstractfloatitemdata.h"
#include "../vmisc/def.h"
#include "vabstractfloatitemdata_p.h" #include "vabstractfloatitemdata_p.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractFloatItemData::VAbstractFloatItemData() VAbstractFloatItemData::VAbstractFloatItemData()
: d(new VAbstractFloatItemDataPrivate()) : d(new VAbstractFloatItemDataPrivate())
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractFloatItemData::VAbstractFloatItemData(const VAbstractFloatItemData &data) COPY_CONSTRUCTOR_IMPL(VAbstractFloatItemData)
: d (data.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractFloatItemData::operator=(const VAbstractFloatItemData &data) -> VAbstractFloatItemData & auto VAbstractFloatItemData::operator=(const VAbstractFloatItemData &data) -> VAbstractFloatItemData &
@ -54,7 +54,8 @@ auto VAbstractFloatItemData::operator=(const VAbstractFloatItemData &data) -> VA
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractFloatItemData::VAbstractFloatItemData(VAbstractFloatItemData &&data) noexcept VAbstractFloatItemData::VAbstractFloatItemData(VAbstractFloatItemData &&data) noexcept
: d(std::move(data.d)) : d(std::move(data.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractFloatItemData::operator=(VAbstractFloatItemData &&data) noexcept -> VAbstractFloatItemData & auto VAbstractFloatItemData::operator=(VAbstractFloatItemData &&data) noexcept -> VAbstractFloatItemData &
@ -65,8 +66,7 @@ auto VAbstractFloatItemData::operator=(VAbstractFloatItemData &&data) noexcept->
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractFloatItemData::~VAbstractFloatItemData() VAbstractFloatItemData::~VAbstractFloatItemData() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractFloatItemData::GetPos() const -> QPointF auto VAbstractFloatItemData::GetPos() const -> QPointF

View File

@ -28,6 +28,7 @@
#include <QPointF> #include <QPointF>
#include "../vmisc/def.h"
#include "vgrainlinedata.h" #include "vgrainlinedata.h"
#include "vgrainlinedata_p.h" #include "vgrainlinedata_p.h"
@ -35,13 +36,11 @@
VGrainlineData::VGrainlineData() VGrainlineData::VGrainlineData()
: VAbstractFloatItemData(), : VAbstractFloatItemData(),
d(new VGrainlineDataPrivate()) d(new VGrainlineDataPrivate())
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VGrainlineData::VGrainlineData(const VGrainlineData &data) COPY_CONSTRUCTOR_IMPL_2(VGrainlineData, VAbstractFloatItemData)
: VAbstractFloatItemData(data),
d (data.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VGrainlineData::operator=(const VGrainlineData &data) -> VGrainlineData & auto VGrainlineData::operator=(const VGrainlineData &data) -> VGrainlineData &
@ -60,7 +59,8 @@ auto VGrainlineData::operator=(const VGrainlineData &data) -> VGrainlineData &
VGrainlineData::VGrainlineData(VGrainlineData &&data) noexcept VGrainlineData::VGrainlineData(VGrainlineData &&data) noexcept
: VAbstractFloatItemData(std::move(data)), : VAbstractFloatItemData(std::move(data)),
d(std::move(data.d)) d(std::move(data.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VGrainlineData::operator=(VGrainlineData &&data) noexcept -> VGrainlineData & auto VGrainlineData::operator=(VGrainlineData &&data) noexcept -> VGrainlineData &
@ -72,8 +72,7 @@ auto VGrainlineData::operator=(VGrainlineData &&data) noexcept->VGrainlineData &
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VGrainlineData::~VGrainlineData() VGrainlineData::~VGrainlineData() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VGrainlineData::GetLength() const -> QString auto VGrainlineData::GetLength() const -> QString

View File

@ -29,11 +29,11 @@
#ifndef VGRAINLINEGEOMETRY_H #ifndef VGRAINLINEGEOMETRY_H
#define VGRAINLINEGEOMETRY_H #define VGRAINLINEGEOMETRY_H
#include <QString>
#include <QPointF> #include <QPointF>
#include <QString>
#include "vabstractfloatitemdata.h"
#include "floatitemdef.h" #include "floatitemdef.h"
#include "vabstractfloatitemdata.h"
class VGrainlineDataPrivate; class VGrainlineDataPrivate;
@ -47,7 +47,7 @@ public:
VGrainlineData(); VGrainlineData();
VGrainlineData(const VGrainlineData &data); VGrainlineData(const VGrainlineData &data);
virtual ~VGrainlineData(); ~VGrainlineData() override;
auto operator=(const VGrainlineData &data) -> VGrainlineData &; auto operator=(const VGrainlineData &data) -> VGrainlineData &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
@ -79,4 +79,3 @@ private:
}; };
#endif // VGRAINLINEGEOMETRY_H #endif // VGRAINLINEGEOMETRY_H

View File

@ -27,20 +27,18 @@
*************************************************************************/ *************************************************************************/
#include "vpatternlabeldata.h" #include "vpatternlabeldata.h"
#include "../vmisc/def.h"
#include "vpatternlabeldata_p.h" #include "vpatternlabeldata_p.h"
#include "../ifc/ifcdef.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPatternLabelData::VPatternLabelData() VPatternLabelData::VPatternLabelData()
: VAbstractFloatItemData(), : VAbstractFloatItemData(),
d(new VPatternLabelDataPrivate()) d(new VPatternLabelDataPrivate())
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPatternLabelData::VPatternLabelData(const VPatternLabelData &data) COPY_CONSTRUCTOR_IMPL_2(VPatternLabelData, VAbstractFloatItemData)
: VAbstractFloatItemData(data),
d (data.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPatternLabelData::operator=(const VPatternLabelData &data) -> VPatternLabelData & auto VPatternLabelData::operator=(const VPatternLabelData &data) -> VPatternLabelData &
@ -59,7 +57,8 @@ auto VPatternLabelData::operator=(const VPatternLabelData &data) -> VPatternLabe
VPatternLabelData::VPatternLabelData(VPatternLabelData &&data) noexcept VPatternLabelData::VPatternLabelData(VPatternLabelData &&data) noexcept
: VAbstractFloatItemData(std::move(data)), : VAbstractFloatItemData(std::move(data)),
d(std::move(data.d)) d(std::move(data.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPatternLabelData::operator=(VPatternLabelData &&data) noexcept -> VPatternLabelData & auto VPatternLabelData::operator=(VPatternLabelData &&data) noexcept -> VPatternLabelData &
@ -71,8 +70,7 @@ auto VPatternLabelData::operator=(VPatternLabelData &&data) noexcept->VPatternLa
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPatternLabelData::~VPatternLabelData() VPatternLabelData::~VPatternLabelData() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPatternLabelData::GetLabelWidth() const -> QString auto VPatternLabelData::GetLabelWidth() const -> QString

View File

@ -44,7 +44,7 @@ public:
VPatternLabelData(); VPatternLabelData();
VPatternLabelData(const VPatternLabelData &data); VPatternLabelData(const VPatternLabelData &data);
virtual ~VPatternLabelData(); ~VPatternLabelData() override;
auto operator=(const VPatternLabelData &data) -> VPatternLabelData &; auto operator=(const VPatternLabelData &data) -> VPatternLabelData &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS

View File

@ -35,13 +35,11 @@
VPieceLabelData::VPieceLabelData() VPieceLabelData::VPieceLabelData()
: VPatternLabelData(), : VPatternLabelData(),
d(new VPieceLabelDataPrivate()) d(new VPieceLabelDataPrivate())
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPieceLabelData::VPieceLabelData(const VPieceLabelData &data) COPY_CONSTRUCTOR_IMPL_2(VPieceLabelData, VPatternLabelData)
: VPatternLabelData(data),
d (data.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPieceLabelData::operator=(const VPieceLabelData &data) -> VPieceLabelData & auto VPieceLabelData::operator=(const VPieceLabelData &data) -> VPieceLabelData &
@ -60,7 +58,8 @@ auto VPieceLabelData::operator=(const VPieceLabelData &data) -> VPieceLabelData
VPieceLabelData::VPieceLabelData(VPieceLabelData &&data) noexcept VPieceLabelData::VPieceLabelData(VPieceLabelData &&data) noexcept
: VPatternLabelData(std::move(data)), : VPatternLabelData(std::move(data)),
d(std::move(data.d)) d(std::move(data.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPieceLabelData::operator=(VPieceLabelData &&data) noexcept -> VPieceLabelData & auto VPieceLabelData::operator=(VPieceLabelData &&data) noexcept -> VPieceLabelData &
@ -72,8 +71,7 @@ auto VPieceLabelData::operator=(VPieceLabelData &&data) noexcept->VPieceLabelDat
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPieceLabelData::~VPieceLabelData() VPieceLabelData::~VPieceLabelData() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPieceLabelData::Clear() void VPieceLabelData::Clear()

View File

@ -47,7 +47,7 @@ VCurveVariable::VCurveVariable(const quint32 &id, const quint32 &parentId)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VCurveVariable::VCurveVariable(const VCurveVariable &var) = default; COPY_CONSTRUCTOR_IMPL(VCurveVariable)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VCurveVariable::operator=(const VCurveVariable &var) -> VCurveVariable & auto VCurveVariable::operator=(const VCurveVariable &var) -> VCurveVariable &

View File

@ -29,15 +29,16 @@
#include "vincrement.h" #include "vincrement.h"
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "vvariable.h"
#include "vincrement_p.h" #include "vincrement_p.h"
#include "vvariable.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief VIncrement create enpty increment * @brief VIncrement create enpty increment
*/ */
VIncrement::VIncrement() VIncrement::VIncrement()
:VVariable(), d(new VIncrementData) : VVariable(),
d(new VIncrementData)
{ {
SetType(VarType::Increment); SetType(VarType::Increment);
} }
@ -48,15 +49,14 @@ VIncrement::VIncrement()
* @param name increment's name * @param name increment's name
*/ */
VIncrement::VIncrement(VContainer *data, const QString &name, IncrementType incrType) VIncrement::VIncrement(VContainer *data, const QString &name, IncrementType incrType)
:VVariable(name, QString()), d(new VIncrementData(data, incrType)) : VVariable(name, QString()),
d(new VIncrementData(data, incrType))
{ {
incrType == IncrementType::Separator ? SetType(VarType::IncrementSeparator) : SetType(VarType::Increment); incrType == IncrementType::Separator ? SetType(VarType::IncrementSeparator) : SetType(VarType::Increment);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VIncrement::VIncrement(const VIncrement &incr) COPY_CONSTRUCTOR_IMPL_2(VIncrement, VVariable)
:VVariable(incr), d(incr.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VIncrement::operator=(const VIncrement &incr) -> VIncrement & auto VIncrement::operator=(const VIncrement &incr) -> VIncrement &
@ -73,8 +73,10 @@ auto VIncrement::operator=(const VIncrement &incr) -> VIncrement &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VIncrement::VIncrement(VIncrement &&incr) noexcept VIncrement::VIncrement(VIncrement &&incr) noexcept
:VVariable(std::move(incr)), d(std::move(incr.d)) : VVariable(std::move(incr)),
{} d(std::move(incr.d))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VIncrement::operator=(VIncrement &&incr) noexcept -> VIncrement & auto VIncrement::operator=(VIncrement &&incr) noexcept -> VIncrement &
@ -86,8 +88,7 @@ auto VIncrement::operator=(VIncrement &&incr) noexcept->VIncrement &
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VIncrement::~VIncrement() VIncrement::~VIncrement() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**

View File

@ -49,7 +49,7 @@ public:
VIncrement(VContainer *data, const QString &name, IncrementType incrType = IncrementType::Increment); VIncrement(VContainer *data, const QString &name, IncrementType incrType = IncrementType::Increment);
VIncrement(const VIncrement &incr); VIncrement(const VIncrement &incr);
virtual ~VIncrement() override; ~VIncrement() override;
auto operator=(const VIncrement &incr) -> VIncrement &; auto operator=(const VIncrement &incr) -> VIncrement &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS

View File

@ -36,7 +36,7 @@ VInternalVariable::VInternalVariable()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VInternalVariable::VInternalVariable(const VInternalVariable &var) = default; COPY_CONSTRUCTOR_IMPL(VInternalVariable)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VInternalVariable::operator=(const VInternalVariable &var) -> VInternalVariable & auto VInternalVariable::operator=(const VInternalVariable &var) -> VInternalVariable &

View File

@ -34,22 +34,24 @@
#include <QString> #include <QString>
#include <QtMath> #include <QtMath>
#include "../vmisc/def.h"
#include "../ifc/ifcdef.h" #include "../ifc/ifcdef.h"
#include "../vgeometry/vpointf.h" #include "../vgeometry/vpointf.h"
#include "../vmisc/def.h"
#include "vinternalvariable.h" #include "vinternalvariable.h"
#include "vlineangle_p.h" #include "vlineangle_p.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLineAngle::VLineAngle() VLineAngle::VLineAngle()
:VInternalVariable(), d(new VLineAngleData) : VInternalVariable(),
d(new VLineAngleData)
{ {
SetType(VarType::LineAngle); SetType(VarType::LineAngle);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLineAngle::VLineAngle(const VPointF *p1, const quint32 &p1Id, const VPointF *p2, const quint32 &p2Id) VLineAngle::VLineAngle(const VPointF *p1, const quint32 &p1Id, const VPointF *p2, const quint32 &p2Id)
:VInternalVariable(), d(new VLineAngleData(p1Id, p2Id)) : VInternalVariable(),
d(new VLineAngleData(p1Id, p2Id))
{ {
SetType(VarType::LineAngle); SetType(VarType::LineAngle);
@ -62,9 +64,7 @@ VLineAngle::VLineAngle(const VPointF *p1, const quint32 &p1Id, const VPointF *p2
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLineAngle::VLineAngle(const VLineAngle &var) COPY_CONSTRUCTOR_IMPL_2(VLineAngle, VInternalVariable)
:VInternalVariable(var), d(var.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLineAngle::operator=(const VLineAngle &var) -> VLineAngle & auto VLineAngle::operator=(const VLineAngle &var) -> VLineAngle &
@ -81,8 +81,10 @@ auto VLineAngle::operator=(const VLineAngle &var) -> VLineAngle &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLineAngle::VLineAngle(VLineAngle &&var) noexcept VLineAngle::VLineAngle(VLineAngle &&var) noexcept
:VInternalVariable(std::move(var)), d(std::move(var.d)) : VInternalVariable(std::move(var)),
{} d(std::move(var.d))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLineAngle::operator=(VLineAngle &&var) noexcept -> VLineAngle & auto VLineAngle::operator=(VLineAngle &&var) noexcept -> VLineAngle &
@ -94,8 +96,7 @@ auto VLineAngle::operator=(VLineAngle &&var) noexcept->VLineAngle &
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLineAngle::~VLineAngle() VLineAngle::~VLineAngle() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLineAngle::Filter(quint32 id) -> bool auto VLineAngle::Filter(quint32 id) -> bool
@ -109,8 +110,8 @@ void VLineAngle::SetValue(const VPointF *p1, const VPointF *p2)
SCASSERT(p1 != nullptr) SCASSERT(p1 != nullptr)
SCASSERT(p2 != nullptr) SCASSERT(p2 != nullptr)
// Correct angle. Try avoid results like 6,7563e-15. // Correct angle. Try avoid results like 6,7563e-15.
const qreal angle = qFloor(QLineF(static_cast<QPointF>(*p1), const qreal angle =
static_cast<QPointF>(*p2)).angle() * 100000.) / 100000.; qFloor(QLineF(static_cast<QPointF>(*p1), static_cast<QPointF>(*p2)).angle() * 100000.) / 100000.;
VInternalVariable::SetValue(angle); VInternalVariable::SetValue(angle);
} }

View File

@ -52,7 +52,7 @@ public:
auto operator=(VLineAngle &&var) noexcept -> VLineAngle &; auto operator=(VLineAngle &&var) noexcept -> VLineAngle &;
#endif #endif
virtual auto Filter(quint32 id) -> bool override; auto Filter(quint32 id) -> bool override;
void SetValue(const VPointF *p1, const VPointF *p2); void SetValue(const VPointF *p1, const VPointF *p2);

View File

@ -40,7 +40,8 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLengthLine::VLengthLine() VLengthLine::VLengthLine()
:VInternalVariable(), d(new VLengthLineData) : VInternalVariable(),
d(new VLengthLineData)
{ {
SetType(VarType::LineLength); SetType(VarType::LineLength);
} }
@ -48,7 +49,8 @@ VLengthLine::VLengthLine()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLengthLine::VLengthLine(const VPointF *p1, const quint32 &p1Id, const VPointF *p2, const quint32 &p2Id, VLengthLine::VLengthLine(const VPointF *p1, const quint32 &p1Id, const VPointF *p2, const quint32 &p2Id,
Unit patternUnit) Unit patternUnit)
:VInternalVariable(), d(new VLengthLineData(p1Id, p2Id, patternUnit)) : VInternalVariable(),
d(new VLengthLineData(p1Id, p2Id, patternUnit))
{ {
// cppcheck-suppress unknownMacro // cppcheck-suppress unknownMacro
SCASSERT(p1 != nullptr) SCASSERT(p1 != nullptr)
@ -60,9 +62,7 @@ VLengthLine::VLengthLine(const VPointF *p1, const quint32 &p1Id, const VPointF *
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLengthLine::VLengthLine(const VLengthLine &var) COPY_CONSTRUCTOR_IMPL_2(VLengthLine, VInternalVariable)
:VInternalVariable(var), d(var.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLengthLine::operator=(const VLengthLine &var) -> VLengthLine & auto VLengthLine::operator=(const VLengthLine &var) -> VLengthLine &
@ -78,8 +78,10 @@ auto VLengthLine::operator=(const VLengthLine &var) -> VLengthLine &
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLengthLine::VLengthLine(VLengthLine &&var) noexcept VLengthLine::VLengthLine(VLengthLine &&var) noexcept
:VInternalVariable(std::move(var)), d(std::move(var.d)) : VInternalVariable(std::move(var)),
{} d(std::move(var.d))
{
}
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -92,8 +94,7 @@ auto VLengthLine::operator=(VLengthLine &&var) noexcept->VLengthLine &
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLengthLine::~VLengthLine() VLengthLine::~VLengthLine() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLengthLine::Filter(quint32 id) -> bool auto VLengthLine::Filter(quint32 id) -> bool
@ -107,8 +108,8 @@ void VLengthLine::SetValue(const VPointF *p1, const VPointF *p2)
SCASSERT(p1 != nullptr) SCASSERT(p1 != nullptr)
SCASSERT(p2 != nullptr) SCASSERT(p2 != nullptr)
VInternalVariable::SetValue(FromPixel(QLineF(static_cast<QPointF>(*p1), static_cast<QPointF>(*p2)).length(), VInternalVariable::SetValue(
d->patternUnit)); FromPixel(QLineF(static_cast<QPointF>(*p1), static_cast<QPointF>(*p2)).length(), d->patternUnit));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -53,7 +53,7 @@ public:
auto operator=(VLengthLine &&var) noexcept -> VLengthLine &; auto operator=(VLengthLine &&var) noexcept -> VLengthLine &;
#endif #endif
virtual auto Filter(quint32 id) -> bool override; auto Filter(quint32 id) -> bool override;
void SetValue(const VPointF *p1, const VPointF *p2); void SetValue(const VPointF *p1, const VPointF *p2);

View File

@ -33,8 +33,8 @@
#include <QtDebug> #include <QtDebug>
#include "../ifc/ifcdef.h" #include "../ifc/ifcdef.h"
#include "vvariable.h"
#include "vmeasurement_p.h" #include "vmeasurement_p.h"
#include "vvariable.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VMeasurement::VMeasurement(quint32 index, const QString &name) VMeasurement::VMeasurement(quint32 index, const QString &name)
@ -67,16 +67,15 @@ VMeasurement::VMeasurement(quint32 index, const QString &name, qreal baseA, qrea
*/ */
VMeasurement::VMeasurement(VContainer *data, quint32 index, const QString &name, const qreal &base, VMeasurement::VMeasurement(VContainer *data, quint32 index, const QString &name, const qreal &base,
const QString &formula, bool ok) const QString &formula, bool ok)
:VVariable(name), d(new VMeasurementData(data, index, formula, ok, base)) : VVariable(name),
d(new VMeasurementData(data, index, formula, ok, base))
{ {
SetType(VarType::Measurement); SetType(VarType::Measurement);
VInternalVariable::SetValue(base); VInternalVariable::SetValue(base);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VMeasurement::VMeasurement(const VMeasurement &m) COPY_CONSTRUCTOR_IMPL_2(VMeasurement, VVariable)
:VVariable(m), d(m.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VMeasurement::operator=(const VMeasurement &m) -> VMeasurement & auto VMeasurement::operator=(const VMeasurement &m) -> VMeasurement &
@ -93,8 +92,10 @@ auto VMeasurement::operator=(const VMeasurement &m) -> VMeasurement &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VMeasurement::VMeasurement(VMeasurement &&m) noexcept VMeasurement::VMeasurement(VMeasurement &&m) noexcept
:VVariable(std::move(m)), d(std::move(m.d)) : VVariable(std::move(m)),
{} d(std::move(m.d))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VMeasurement::operator=(VMeasurement &&m) noexcept -> VMeasurement & auto VMeasurement::operator=(VMeasurement &&m) noexcept -> VMeasurement &
@ -106,8 +107,7 @@ auto VMeasurement::operator=(VMeasurement &&m) noexcept->VMeasurement &
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VMeasurement::~VMeasurement() VMeasurement::~VMeasurement() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VMeasurement::CorrectionHash(qreal baseA, qreal baseB, qreal baseC) -> QString auto VMeasurement::CorrectionHash(qreal baseA, qreal baseB, qreal baseC) -> QString

View File

@ -26,10 +26,10 @@
** **
*************************************************************************/ *************************************************************************/
#include "vpiecearea.h" #include "vpiecearea.h"
#include "vpiecearea_p.h"
#include "../vpiece.h"
#include "../vcontainer.h" #include "../vcontainer.h"
#include "../vpiece.h"
#include "vincrement.h" #include "vincrement.h"
#include "vpiecearea_p.h"
#include <QRegularExpression> #include <QRegularExpression>
@ -81,15 +81,16 @@ auto VPieceArea::operator=(const VPieceArea &var) -> VPieceArea &
return *this; return *this;
} }
//---------------------------------------------------------------------------------------------------------------------
VPieceArea::~VPieceArea() = default;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPieceArea::VPieceArea(VPieceArea &&var) noexcept VPieceArea::VPieceArea(VPieceArea &&var) noexcept
:VInternalVariable(std::move(var)), d(std::move(var.d)) : VInternalVariable(std::move(var)),
{} d(std::move(var.d))
{
//--------------------------------------------------------------------------------------------------------------------- }
VPieceArea::~VPieceArea() // NOLINT(modernize-use-equals-default)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPieceArea::operator=(VPieceArea &&var) noexcept -> VPieceArea & auto VPieceArea::operator=(VPieceArea &&var) noexcept -> VPieceArea &
@ -106,8 +107,8 @@ void VPieceArea::SetValue(quint32 pieceId, const VPiece &piece, const VContainer
// cppcheck-suppress unknownMacro // cppcheck-suppress unknownMacro
SCASSERT(data != nullptr) SCASSERT(data != nullptr)
d->m_pieceId = pieceId; d->m_pieceId = pieceId;
VInternalVariable::SetValue(FromPixel2(GetType() == VarType::PieceExternalArea ? piece.ExternalArea(data) VInternalVariable::SetValue(FromPixel2(
: piece.SeamLineArea(data), unit)); GetType() == VarType::PieceExternalArea ? piece.ExternalArea(data) : piece.SeamLineArea(data), unit));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -48,11 +48,7 @@ VVariable::VVariable(const QString &name, const QString &description)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VVariable::VVariable(const VVariable &var) // NOLINT(modernize-use-equals-default) COPY_CONSTRUCTOR_IMPL_2(VVariable, VInternalVariable)
: VInternalVariable(var),
d(var.d)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VVariable::operator=(const VVariable &var) -> VVariable & auto VVariable::operator=(const VVariable &var) -> VVariable &
@ -84,9 +80,7 @@ auto VVariable::operator=(VVariable &&var) noexcept -> VVariable &
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VVariable::~VVariable() // NOLINT(modernize-use-equals-default) VVariable::~VVariable() = default;
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VVariable::GetDescription() const -> QString auto VVariable::GetDescription() const -> QString

View File

@ -144,9 +144,7 @@ VContainer::VContainer(const VContainer &data)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VContainer::~VContainer() VContainer::~VContainer() = default;
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VContainer::UniqueNamespace() -> QString auto VContainer::UniqueNamespace() -> QString

View File

@ -67,7 +67,7 @@ auto VFormula::operator=(const VFormula &formula) -> VFormula &
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VFormula::VFormula(const VFormula &formula) = default; COPY_CONSTRUCTOR_IMPL(VFormula)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VFormula::~VFormula() = default; VFormula::~VFormula() = default;

View File

@ -30,10 +30,10 @@
#define VFORMULA_H #define VFORMULA_H
#include <QCoreApplication> #include <QCoreApplication>
#include <QSharedDataPointer>
#include <QMetaType> #include <QMetaType>
#include <QTypeInfo> #include <QSharedDataPointer>
#include <QString> #include <QString>
#include <QTypeInfo>
#include <QtGlobal> #include <QtGlobal>
enum class FormulaType : qint8 enum class FormulaType : qint8
@ -50,6 +50,7 @@ class VFormulaData;
class VFormula class VFormula
{ {
Q_DECLARE_TR_FUNCTIONS(VFormula) // NOLINT Q_DECLARE_TR_FUNCTIONS(VFormula) // NOLINT
public: public:
VFormula(); VFormula();
VFormula(const QString &formula, const VContainer *container); VFormula(const QString &formula, const VContainer *container);
@ -87,12 +88,13 @@ public:
static auto FormulaTypeId() -> int; static auto FormulaTypeId() -> int;
void Eval(); void Eval();
private: private:
QSharedDataPointer<VFormulaData> d; QSharedDataPointer<VFormulaData> d;
void ResetState(); void ResetState();
}; };
Q_DECLARE_METATYPE(VFormula) Q_DECLARE_METATYPE(VFormula) // NOLINT
Q_DECLARE_TYPEINFO(VFormula, Q_MOVABLE_TYPE); // NOLINT Q_DECLARE_TYPEINFO(VFormula, Q_MOVABLE_TYPE); // NOLINT
#endif // VFORMULA_H #endif // VFORMULA_H

View File

@ -27,11 +27,11 @@
*************************************************************************/ *************************************************************************/
#include "vnodedetail.h" #include "vnodedetail.h"
#include "../vgeometry/vpointf.h"
#include "../vpatterndb/vcontainer.h"
#include "vnodedetail_p.h" #include "vnodedetail_p.h"
#include "vpiecenode.h" #include "vpiecenode.h"
#include "vpiecepath.h" #include "vpiecepath.h"
#include "../vgeometry/vpointf.h"
#include "../vpatterndb/vcontainer.h"
#include <QLineF> #include <QLineF>
#include <QVector> #include <QVector>
@ -41,9 +41,8 @@ namespace
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto IsOX(const QLineF &line) -> bool auto IsOX(const QLineF &line) -> bool
{ {
return VFuzzyComparePossibleNulls(line.angle(), 0) return VFuzzyComparePossibleNulls(line.angle(), 0) || VFuzzyComparePossibleNulls(line.angle(), 360) ||
|| VFuzzyComparePossibleNulls(line.angle(), 360) VFuzzyComparePossibleNulls(line.angle(), 180);
|| VFuzzyComparePossibleNulls(line.angle(), 180);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -92,22 +91,22 @@ void ConvertAfter(VPieceNode &node, const QLineF &line, qreal mX, qreal mY)
node.SetFormulaSAAfter(LocalWidth(line, movedLine)); node.SetFormulaSAAfter(LocalWidth(line, movedLine));
} }
} }
}//static functions } // namespace
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VNodeDetail::VNodeDetail() VNodeDetail::VNodeDetail()
: d(new VNodeDetailData) : d(new VNodeDetailData)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VNodeDetail::VNodeDetail(quint32 id, Tool typeTool, NodeDetail typeNode, qreal mx, qreal my, bool reverse) VNodeDetail::VNodeDetail(quint32 id, Tool typeTool, NodeDetail typeNode, qreal mx, qreal my, bool reverse)
: d(new VNodeDetailData(id, typeTool, typeNode, mx, my, reverse)) : d(new VNodeDetailData(id, typeTool, typeNode, mx, my, reverse))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VNodeDetail::VNodeDetail(const VNodeDetail &node) COPY_CONSTRUCTOR_IMPL(VNodeDetail)
:d (node.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VNodeDetail::operator=(const VNodeDetail &node) -> VNodeDetail & auto VNodeDetail::operator=(const VNodeDetail &node) -> VNodeDetail &
@ -124,7 +123,8 @@ auto VNodeDetail::operator=(const VNodeDetail &node) -> VNodeDetail &
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VNodeDetail::VNodeDetail(VNodeDetail &&node) noexcept VNodeDetail::VNodeDetail(VNodeDetail &&node) noexcept
: d(std::move(node.d)) : d(std::move(node.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VNodeDetail::operator=(VNodeDetail &&node) noexcept -> VNodeDetail & auto VNodeDetail::operator=(VNodeDetail &&node) noexcept -> VNodeDetail &
@ -135,8 +135,7 @@ auto VNodeDetail::operator=(VNodeDetail &&node) noexcept->VNodeDetail &
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VNodeDetail::~VNodeDetail() VNodeDetail::~VNodeDetail() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VNodeDetail::getId() const -> quint32 auto VNodeDetail::getId() const -> quint32

View File

@ -139,7 +139,7 @@ private:
QSharedDataPointer<VNodeDetailData> d; QSharedDataPointer<VNodeDetailData> d;
}; };
Q_DECLARE_METATYPE(VNodeDetail) Q_DECLARE_METATYPE(VNodeDetail) // NOLINT
Q_DECLARE_TYPEINFO(VNodeDetail, Q_MOVABLE_TYPE); // NOLINT Q_DECLARE_TYPEINFO(VNodeDetail, Q_MOVABLE_TYPE); // NOLINT
#endif // VNODEDETAIL_H #endif // VNODEDETAIL_H

View File

@ -27,29 +27,29 @@
*************************************************************************/ *************************************************************************/
#include "vpiece.h" #include "vpiece.h"
#include "vpiece_p.h"
#include "vpassmark.h"
#include "../vgeometry/vpointf.h"
#include "../vgeometry/vabstractcurve.h"
#include "../vgeometry/vplacelabelitem.h"
#include "../vgeometry/vlayoutplacelabel.h"
#include "vcontainer.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/compatibility.h"
#include "../ifc/exception/vexceptioninvalidnotch.h" #include "../ifc/exception/vexceptioninvalidnotch.h"
#include "../ifc/exception/vexceptionobjecterror.h" #include "../ifc/exception/vexceptionobjecterror.h"
#include "../vmisc/testpath.h"
#include "../ifc/xml/vabstractpattern.h" #include "../ifc/xml/vabstractpattern.h"
#include "../vpatterndb/vpiecenode.h" #include "../vgeometry/vabstractcurve.h"
#include "../vgeometry/vlayoutplacelabel.h"
#include "../vgeometry/vplacelabelitem.h"
#include "../vgeometry/vpointf.h"
#include "../vmisc/compatibility.h"
#include "../vmisc/testpath.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vpatterndb/variables/vpiecearea.h" #include "../vpatterndb/variables/vpiecearea.h"
#include "../vpatterndb/vpiecenode.h"
#include "vcontainer.h"
#include "vpassmark.h"
#include "vpiece_p.h"
#include <QSharedPointer>
#include <QDebug> #include <QDebug>
#include <QPainterPath>
#include <QTemporaryFile>
#include <QJsonObject>
#include <QJsonDocument>
#include <QJsonArray> #include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QPainterPath>
#include <QSharedPointer>
#include <QTemporaryFile>
namespace namespace
{ {
@ -116,13 +116,13 @@ auto RotatePath(const QVector<VPieceNode> &path, vsizetype index) -> QVector<VPi
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPiece::VPiece() VPiece::VPiece()
: VAbstractPiece(), d(new VPieceData(PiecePathType::PiecePath)) : VAbstractPiece(),
{} d(new VPieceData(PiecePathType::PiecePath))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPiece::VPiece(const VPiece &piece) COPY_CONSTRUCTOR_IMPL_2(VPiece, VAbstractPiece)
: VAbstractPiece(piece), d (piece.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPiece::operator=(const VPiece &piece) -> VPiece & auto VPiece::operator=(const VPiece &piece) -> VPiece &
@ -139,8 +139,10 @@ auto VPiece::operator=(const VPiece &piece) -> VPiece &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPiece::VPiece(VPiece &&piece) noexcept VPiece::VPiece(VPiece &&piece) noexcept
: VAbstractPiece(std::move(piece)), d (std::move(piece.d)) : VAbstractPiece(std::move(piece)),
{} d(std::move(piece.d))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPiece::operator=(VPiece &&piece) noexcept -> VPiece & auto VPiece::operator=(VPiece &&piece) noexcept -> VPiece &
@ -152,8 +154,7 @@ auto VPiece::operator=(VPiece &&piece) noexcept->VPiece &
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPiece::~VPiece() VPiece::~VPiece() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPiece::GetPath() const -> VPiecePath auto VPiece::GetPath() const -> VPiecePath
@ -662,8 +663,8 @@ auto VPiece::SeamAllowancePointsWithRotation(const VContainer *data, vsizetype m
int recordIndex = -1; int recordIndex = -1;
bool insertingCSA = false; bool insertingCSA = false;
const qreal width = ToPixel(GetSAWidth(), *data->GetPatternUnit()); const qreal width = ToPixel(GetSAWidth(), *data->GetPatternUnit());
const QVector<VPieceNode> unitedPath = makeFirst > 0 ? RotatePath(GetUnitedPath(data), makeFirst) const QVector<VPieceNode> unitedPath =
: GetUnitedPath(data); makeFirst > 0 ? RotatePath(GetUnitedPath(data), makeFirst) : GetUnitedPath(data);
QVector<VSAPoint> pointsEkv; QVector<VSAPoint> pointsEkv;
for (int i = 0; i < unitedPath.size(); ++i) for (int i = 0; i < unitedPath.size(); ++i)
@ -827,13 +828,9 @@ auto VPiece::GetValidRecords() const -> QVector<CustomSARecord>
const int indexStartPoint = d->m_path.indexOfNode(record.startPoint); const int indexStartPoint = d->m_path.indexOfNode(record.startPoint);
const int indexEndPoint = d->m_path.indexOfNode(record.endPoint); const int indexEndPoint = d->m_path.indexOfNode(record.endPoint);
if (record.startPoint > NULL_ID if (record.startPoint > NULL_ID && record.path > NULL_ID && record.endPoint > NULL_ID &&
&& record.path > NULL_ID indexStartPoint != -1 && not d->m_path.at(indexStartPoint).IsExcluded() && indexEndPoint != -1 &&
&& record.endPoint > NULL_ID not d->m_path.at(indexEndPoint).IsExcluded())
&& indexStartPoint != -1
&& not d->m_path.at(indexStartPoint).IsExcluded()
&& indexEndPoint != -1
&& not d->m_path.at(indexEndPoint).IsExcluded())
{ {
records.append(record); records.append(record);
} }
@ -938,8 +935,9 @@ auto VPiece::GetPassmarkPreviousSAPoints(const QVector<VPieceNode> &path, vsizet
{ {
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.") const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName()); .arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; ? throw VExceptionInvalidNotch(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return false; // Something wrong return false; // Something wrong
} }
@ -977,8 +975,9 @@ auto VPiece::GetPassmarkNextSAPoints(const QVector<VPieceNode> &path, vsizetype
{ {
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.") const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName()); .arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; ? throw VExceptionInvalidNotch(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return false; // Something wrong return false; // Something wrong
} }
@ -1061,8 +1060,9 @@ auto VPiece::CreatePassmark(const QVector<VPieceNode> &path, vsizetype previousI
{ {
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.") const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName()); .arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; ? throw VExceptionInvalidNotch(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return {}; return {};
} }
@ -1085,8 +1085,7 @@ auto VPiece::CreatePassmark(const QVector<VPieceNode> &path, vsizetype previousI
return {}; return {};
} }
if (passmarkSAPoint.IsManualPasskmarkLength() if (passmarkSAPoint.IsManualPasskmarkLength() && passmarkSAPoint.GetPasskmarkLength() <= accuracyPointOnLine)
&& passmarkSAPoint.GetPasskmarkLength() <= accuracyPointOnLine)
{ {
const QString infoMsg = tr("Notch for point '%1' in piece '%2' will be disabled. Manual length is less than " const QString infoMsg = tr("Notch for point '%1' in piece '%2' will be disabled. Manual length is less than "
"allowed value.") "allowed value.")
@ -1243,8 +1242,7 @@ qreal VPiece::GlobalPassmarkWidth(const VContainer *data) const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPiece::MainPathToJson() const -> QJsonObject auto VPiece::MainPathToJson() const -> QJsonObject
{ {
QJsonObject pieceObject QJsonObject pieceObject{
{
{"seamAllowance", IsSeamAllowance()}, {"seamAllowance", IsSeamAllowance()},
{"saWidth", GetSAWidth()}, {"saWidth", GetSAWidth()},
}; };
@ -1252,8 +1250,7 @@ auto VPiece::MainPathToJson() const -> QJsonObject
QJsonArray nodesArray; QJsonArray nodesArray;
for (qint32 i = 0; i < d->m_path.CountNodes(); ++i) for (qint32 i = 0; i < d->m_path.CountNodes(); ++i)
{ {
QJsonObject nodeObject QJsonObject nodeObject{
{
{"id", static_cast<qint64>(d->m_path.at(i).GetId())}, {"id", static_cast<qint64>(d->m_path.at(i).GetId())},
{"type", static_cast<int>(d->m_path.at(i).GetTypeTool())}, {"type", static_cast<int>(d->m_path.at(i).GetTypeTool())},
{"reverse", d->m_path.at(i).GetReverse()}, {"reverse", d->m_path.at(i).GetReverse()},
@ -1275,10 +1272,7 @@ auto VPiece::DBToJson(const VContainer *data) const -> QJsonObject
itemsArray.append(data->GetGObject(d->m_path.at(i).GetId())->ToJson()); itemsArray.append(data->GetGObject(d->m_path.at(i).GetId())->ToJson());
} }
QJsonObject dbObject QJsonObject dbObject{{"items", itemsArray}};
{
{"items", itemsArray}
};
return dbObject; return dbObject;
} }
@ -1307,14 +1301,12 @@ void VPiece::DumpPiece(const VPiece &piece, const VContainer *data, const QStrin
temp.fileName(); // call to create a file on disk temp.fileName(); // call to create a file on disk
#endif #endif
#endif #endif
QJsonObject testCase QJsonObject testCase{
{
{"bd", piece.DBToJson(data)}, {"bd", piece.DBToJson(data)},
{"piece", piece.MainPathToJson()}, {"piece", piece.MainPathToJson()},
}; };
QJsonObject json QJsonObject json{
{
{"testCase", testCase}, {"testCase", testCase},
}; };
@ -1358,18 +1350,22 @@ void VPiece::TestInternalPathCuttingPathIntersection(const VContainer *data) con
if (internalPath.intersects(contourPath)) if (internalPath.intersects(contourPath))
{ {
const QString errorMsg = QObject::tr("Piece '%1'. Internal path '%2' intersects with cutting " const QString errorMsg = QObject::tr("Piece '%1'. Internal path '%2' intersects with cutting "
"contour.").arg(GetName(), path.GetName()); "contour.")
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) : .arg(GetName(), path.GetName());
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; VAbstractApplication::VApp()->IsPedantic()
? throw VExceptionObjectError(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
continue; continue;
} }
if (not contourPath.contains(internalPath)) if (not contourPath.contains(internalPath))
{ {
const QString errorMsg = QObject::tr("Piece '%1'. Internal path '%2' not inside of cutting " const QString errorMsg = QObject::tr("Piece '%1'. Internal path '%2' not inside of cutting "
"contour.").arg(GetName(), path.GetName()); "contour.")
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) : .arg(GetName(), path.GetName());
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; VAbstractApplication::VApp()->IsPedantic()
? throw VExceptionObjectError(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
} }
} }
} }
@ -1439,9 +1435,11 @@ void VPiece::TestInternalPathsIntersections(const VContainer *data) const
if (painterPath1.intersects(painterPath2)) if (painterPath1.intersects(painterPath2))
{ {
const QString errorMsg = QObject::tr("Piece '%1'. Internal path '%2' intersects with internal path " const QString errorMsg = QObject::tr("Piece '%1'. Internal path '%2' intersects with internal path "
"'%3'.").arg(GetName(), path1.GetName(), path2.GetName()); "'%3'.")
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) : .arg(GetName(), path1.GetName(), path2.GetName());
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; VAbstractApplication::VApp()->IsPedantic()
? throw VExceptionObjectError(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
} }
} }
} }

View File

@ -29,8 +29,8 @@
#ifndef VPIECE_H #ifndef VPIECE_H
#define VPIECE_H #define VPIECE_H
#include <QtGlobal>
#include <QSharedDataPointer> #include <QSharedDataPointer>
#include <QtGlobal>
#include "../vlayout/vabstractpiece.h" #include "../vlayout/vabstractpiece.h"
@ -48,11 +48,12 @@ class VPassmark;
class VPiece : public VAbstractPiece class VPiece : public VAbstractPiece
{ {
Q_DECLARE_TR_FUNCTIONS(VPiece) // NOLINT Q_DECLARE_TR_FUNCTIONS(VPiece) // NOLINT
public: public:
VPiece(); VPiece();
VPiece(const VPiece &piece); VPiece(const VPiece &piece);
virtual ~VPiece(); ~VPiece() override;
auto operator=(const VPiece &piece) -> VPiece &; auto operator=(const VPiece &piece) -> VPiece &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
@ -146,6 +147,7 @@ public:
static auto ShortNameRegExp() -> QString; static auto ShortNameRegExp() -> QString;
auto ExternalArea(const VContainer *data) const -> qreal; auto ExternalArea(const VContainer *data) const -> qreal;
auto SeamLineArea(const VContainer *data) const -> qreal; auto SeamLineArea(const VContainer *data) const -> qreal;
private: private:
QSharedDataPointer<VPieceData> d; QSharedDataPointer<VPieceData> d;

View File

@ -27,11 +27,11 @@
*************************************************************************/ *************************************************************************/
#include "vpiecenode.h" #include "vpiecenode.h"
#include "vpiecenode_p.h"
#include "vcontainer.h"
#include "calculator.h"
#include "vformula.h"
#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/vabstractvalapplication.h"
#include "calculator.h"
#include "vcontainer.h"
#include "vformula.h"
#include "vpiecenode_p.h"
#include <QDataStream> #include <QDataStream>
#include <QtNumeric> #include <QtNumeric>
@ -39,17 +39,17 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPieceNode::VPieceNode() VPieceNode::VPieceNode()
: d(new VPieceNodeData) : d(new VPieceNodeData)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPieceNode::VPieceNode(quint32 id, Tool typeTool, bool reverse) VPieceNode::VPieceNode(quint32 id, Tool typeTool, bool reverse)
: d(new VPieceNodeData(id, typeTool, reverse)) : d(new VPieceNodeData(id, typeTool, reverse))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPieceNode::VPieceNode(const VPieceNode &node) COPY_CONSTRUCTOR_IMPL(VPieceNode)
: d (node.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPieceNode::operator=(const VPieceNode &node) -> VPieceNode & auto VPieceNode::operator=(const VPieceNode &node) -> VPieceNode &
@ -66,7 +66,8 @@ auto VPieceNode::operator=(const VPieceNode &node) -> VPieceNode &
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPieceNode::VPieceNode(VPieceNode &&node) noexcept VPieceNode::VPieceNode(VPieceNode &&node) noexcept
: d(std::move(node.d)) : d(std::move(node.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPieceNode::operator=(VPieceNode &&node) noexcept -> VPieceNode & auto VPieceNode::operator=(VPieceNode &&node) noexcept -> VPieceNode &
@ -77,8 +78,7 @@ auto VPieceNode::operator=(VPieceNode &&node) noexcept->VPieceNode &
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPieceNode::~VPieceNode() VPieceNode::~VPieceNode() = default;
{}
// Friend functions // Friend functions
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -154,12 +154,14 @@ auto VPieceNode::GetSABefore(const VContainer *data) const -> qreal
nodeName = data->GetGObject(d->m_id)->name(); nodeName = data->GetGObject(d->m_id)->name();
} }
catch (const VExceptionBadId &) catch (const VExceptionBadId &)
{} {
}
const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.") const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.")
.arg(nodeName, formula.Reason()); .arg(nodeName, formula.Reason());
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; ? throw VException(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return -1; return -1;
} }
return formula.getDoubleValue(); return formula.getDoubleValue();
@ -185,12 +187,14 @@ auto VPieceNode::GetSABefore(const VContainer *data, Unit unit) const -> qreal
nodeName = data->GetGObject(d->m_id)->name(); nodeName = data->GetGObject(d->m_id)->name();
} }
catch (const VExceptionBadId &) catch (const VExceptionBadId &)
{} {
}
const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.") const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.")
.arg(nodeName, formula.Reason()); .arg(nodeName, formula.Reason());
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; ? throw VException(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return -1; return -1;
} }
@ -237,12 +241,14 @@ auto VPieceNode::GetSAAfter(const VContainer *data) const -> qreal
nodeName = data->GetGObject(d->m_id)->name(); nodeName = data->GetGObject(d->m_id)->name();
} }
catch (const VExceptionBadId &) catch (const VExceptionBadId &)
{} {
}
const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: %2.") const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: %2.")
.arg(nodeName, formula.Reason()); .arg(nodeName, formula.Reason());
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; ? throw VException(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return -1; return -1;
} }
@ -269,12 +275,14 @@ auto VPieceNode::GetSAAfter(const VContainer *data, Unit unit) const -> qreal
nodeName = data->GetGObject(d->m_id)->name(); nodeName = data->GetGObject(d->m_id)->name();
} }
catch (const VExceptionBadId &) catch (const VExceptionBadId &)
{} {
}
const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: %2.") const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: %2.")
.arg(nodeName, formula.Reason()); .arg(nodeName, formula.Reason());
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; ? throw VException(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return -1; return -1;
} }
@ -365,12 +373,14 @@ auto VPieceNode::GetPassmarkLength(const VContainer *data, Unit unit) const -> q
nodeName = data->GetGObject(d->m_id)->name(); nodeName = data->GetGObject(d->m_id)->name();
} }
catch (const VExceptionBadId &) catch (const VExceptionBadId &)
{} {
}
const QString errorMsg = QObject::tr("Cannot calculate passmark length for point '%1'. Reason: %2.") const QString errorMsg = QObject::tr("Cannot calculate passmark length for point '%1'. Reason: %2.")
.arg(nodeName, formula.Reason()); .arg(nodeName, formula.Reason());
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; ? throw VException(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return VSAPoint::maxPassmarkLength; return VSAPoint::maxPassmarkLength;
} }

View File

@ -29,9 +29,9 @@
#ifndef VPIECENODE_H #ifndef VPIECENODE_H
#define VPIECENODE_H #define VPIECENODE_H
#include <QtGlobal>
#include <QSharedDataPointer>
#include <QMetaType> #include <QMetaType>
#include <QSharedDataPointer>
#include <QtGlobal>
#include "../vmisc/def.h" #include "../vmisc/def.h"
@ -128,11 +128,12 @@ public:
auto IsTurnPoint() const -> bool; auto IsTurnPoint() const -> bool;
void SetTurnPoint(bool value); void SetTurnPoint(bool value);
private: private:
QSharedDataPointer<VPieceNodeData> d; QSharedDataPointer<VPieceNodeData> d;
}; };
Q_DECLARE_METATYPE(VPieceNode) Q_DECLARE_METATYPE(VPieceNode) // NOLINT
Q_DECLARE_TYPEINFO(VPieceNode, Q_MOVABLE_TYPE); // NOLINT Q_DECLARE_TYPEINFO(VPieceNode, Q_MOVABLE_TYPE); // NOLINT
#endif // VPIECENODE_H #endif // VPIECENODE_H

View File

@ -27,16 +27,16 @@
*************************************************************************/ *************************************************************************/
#include "vpiecepath.h" #include "vpiecepath.h"
#include "vpiecepath_p.h"
#include "vcontainer.h"
#include "../vgeometry/vpointf.h"
#include "calculator.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/compatibility.h"
#include "../ifc/exception/vexceptionobjecterror.h" #include "../ifc/exception/vexceptionobjecterror.h"
#include "../vgeometry/vpointf.h"
#include "../vmisc/compatibility.h"
#include "../vmisc/vabstractvalapplication.h"
#include "calculator.h"
#include "vcontainer.h"
#include "vpiecepath_p.h"
#include <qnumeric.h>
#include <QPainterPath> #include <QPainterPath>
#include <qnumeric.h>
namespace namespace
{ {
@ -238,22 +238,22 @@ void AppendCurveSegment(QVector<T> &points, QVector<QPointF> &segment, const VSA
points.append(lp); points.append(lp);
} }
} }
} } // namespace
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPiecePath::VPiecePath() VPiecePath::VPiecePath()
: d(new VPiecePathData) : d(new VPiecePathData)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPiecePath::VPiecePath(PiecePathType type) VPiecePath::VPiecePath(PiecePathType type)
: d(new VPiecePathData(type)) : d(new VPiecePathData(type))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPiecePath::VPiecePath(const VPiecePath &path) COPY_CONSTRUCTOR_IMPL(VPiecePath)
: d (path.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPiecePath::operator=(const VPiecePath &path) -> VPiecePath & auto VPiecePath::operator=(const VPiecePath &path) -> VPiecePath &
@ -270,7 +270,8 @@ auto VPiecePath::operator=(const VPiecePath &path) -> VPiecePath &
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPiecePath::VPiecePath(VPiecePath &&path) noexcept VPiecePath::VPiecePath(VPiecePath &&path) noexcept
: d(std::move(path.d)) : d(std::move(path.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPiecePath::operator=(VPiecePath &&path) noexcept -> VPiecePath & auto VPiecePath::operator=(VPiecePath &&path) noexcept -> VPiecePath &
@ -281,8 +282,7 @@ auto VPiecePath::operator=(VPiecePath &&path) noexcept->VPiecePath &
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPiecePath::~VPiecePath() VPiecePath::~VPiecePath() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPiecePath::Append(const VPieceNode &node) void VPiecePath::Append(const VPieceNode &node)
@ -432,8 +432,9 @@ auto VPiecePath::PathPoints(const VContainer *data, const QVector<QPointF> &cutt
const QString errorMsg = QObject::tr("Error in internal path '%1'. There is no intersection of first " const QString errorMsg = QObject::tr("Error in internal path '%1'. There is no intersection of first "
"point with cutting contour") "point with cutting contour")
.arg(GetName()); .arg(GetName());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; ? throw VExceptionObjectError(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
} }
} }
@ -450,8 +451,9 @@ auto VPiecePath::PathPoints(const VContainer *data, const QVector<QPointF> &cutt
const QString errorMsg = QObject::tr("Error in internal path '%1'. There is no intersection of last " const QString errorMsg = QObject::tr("Error in internal path '%1'. There is no intersection of last "
"point with cutting contour") "point with cutting contour")
.arg(GetName()); .arg(GetName());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; ? throw VExceptionObjectError(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
} }
} }
@ -891,8 +893,7 @@ auto VPiecePath::RemoveEdge(quint32 index) const -> VPiecePath
{ {
j = 0; j = 0;
} }
} } while (j != j2);
while (j != j2);
} }
} }
return path; return path;

View File

@ -29,11 +29,11 @@
#ifndef VPIECEPATH_H #ifndef VPIECEPATH_H
#define VPIECEPATH_H #define VPIECEPATH_H
#include <QtGlobal>
#include <QSharedDataPointer> #include <QSharedDataPointer>
#include <QtGlobal>
#include "../vmisc/def.h"
#include "../vgeometry/vabstractcurve.h" #include "../vgeometry/vabstractcurve.h"
#include "../vmisc/def.h"
class VPiecePathData; class VPiecePathData;
class VSAPoint; class VSAPoint;
@ -146,6 +146,6 @@ private:
}; };
Q_DECLARE_TYPEINFO(VPiecePath, Q_MOVABLE_TYPE); // NOLINT Q_DECLARE_TYPEINFO(VPiecePath, Q_MOVABLE_TYPE); // NOLINT
Q_DECLARE_METATYPE(VPiecePath) Q_DECLARE_METATYPE(VPiecePath) // NOLINT
#endif // VPIECEPATH_H #endif // VPIECEPATH_H

View File

@ -39,7 +39,7 @@ namespace
{ {
constexpr qreal arrowAngle = M_PI / 9; constexpr qreal arrowAngle = M_PI / 9;
constexpr int arrowLength = 15; constexpr int arrowLength = 15;
} } // namespace
// VPieceGrainlinePrivate // VPieceGrainlinePrivate
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -53,26 +53,26 @@ auto VPieceGrainlinePrivate::MainLine(const QPointF &p1, qreal length, qreal ang
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPieceGrainline::VPieceGrainline() VPieceGrainline::VPieceGrainline()
: d(new VPieceGrainlinePrivate) : d(new VPieceGrainlinePrivate)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPieceGrainline::~VPieceGrainline() //NOLINT(modernize-use-equals-default) VPieceGrainline::~VPieceGrainline() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPieceGrainline::VPieceGrainline(const QLineF &mainLine, GrainlineArrowDirection arrowType) VPieceGrainline::VPieceGrainline(const QLineF &mainLine, GrainlineArrowDirection arrowType)
: d(new VPieceGrainlinePrivate(mainLine, arrowType)) : d(new VPieceGrainlinePrivate(mainLine, arrowType))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPieceGrainline::VPieceGrainline(const QPointF &p1, qreal length, qreal angle, GrainlineArrowDirection arrowType) VPieceGrainline::VPieceGrainline(const QPointF &p1, qreal length, qreal angle, GrainlineArrowDirection arrowType)
: d(new VPieceGrainlinePrivate(VPieceGrainlinePrivate::MainLine(p1, length, angle), arrowType)) : d(new VPieceGrainlinePrivate(VPieceGrainlinePrivate::MainLine(p1, length, angle), arrowType))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPieceGrainline::VPieceGrainline(const VPieceGrainline &other) //NOLINT(modernize-use-equals-default) COPY_CONSTRUCTOR_IMPL(VPieceGrainline)
:d (other.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPieceGrainline::operator=(const VPieceGrainline &grainline) -> VPieceGrainline & auto VPieceGrainline::operator=(const VPieceGrainline &grainline) -> VPieceGrainline &
@ -89,7 +89,8 @@ auto VPieceGrainline::operator=(const VPieceGrainline &grainline) -> VPieceGrain
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPieceGrainline::VPieceGrainline(VPieceGrainline &&grainline) noexcept VPieceGrainline::VPieceGrainline(VPieceGrainline &&grainline) noexcept
: d(std::move(grainline.d)) : d(std::move(grainline.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPieceGrainline::operator=(VPieceGrainline &&grainline) noexcept -> VPieceGrainline & auto VPieceGrainline::operator=(VPieceGrainline &&grainline) noexcept -> VPieceGrainline &

View File

@ -28,9 +28,9 @@
#ifndef VPIECEGRAINLINE_H #ifndef VPIECEGRAINLINE_H
#define VPIECEGRAINLINE_H #define VPIECEGRAINLINE_H
#include <QSharedDataPointer>
#include <QMetaType>
#include "../vpatterndb/floatItemData/floatitemdef.h" #include "../vpatterndb/floatItemData/floatitemdef.h"
#include <QMetaType>
#include <QSharedDataPointer>
class QPointF; class QPointF;
class VPieceGrainlinePrivate; class VPieceGrainlinePrivate;
@ -88,11 +88,12 @@ public:
friend auto operator<<(QDataStream &dataStream, const VPieceGrainline &grainline) -> QDataStream &; friend auto operator<<(QDataStream &dataStream, const VPieceGrainline &grainline) -> QDataStream &;
friend auto operator>>(QDataStream &dataStream, VPieceGrainline &grainline) -> QDataStream &; friend auto operator>>(QDataStream &dataStream, VPieceGrainline &grainline) -> QDataStream &;
private: private:
QSharedDataPointer<VPieceGrainlinePrivate> d; QSharedDataPointer<VPieceGrainlinePrivate> d;
}; };
Q_DECLARE_METATYPE(VPieceGrainline) Q_DECLARE_METATYPE(VPieceGrainline) // NOLINT
Q_DECLARE_TYPEINFO(VPieceGrainline, Q_MOVABLE_TYPE); // NOLINT Q_DECLARE_TYPEINFO(VPieceGrainline, Q_MOVABLE_TYPE); // NOLINT
#endif // VPIECEGRAINLINE_H #endif // VPIECEGRAINLINE_H