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 &

View File

@ -35,10 +35,10 @@
#include <QPoint>
#include <QtDebug>
#include "vabstractcurve_p.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/compatibility.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
#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)
:VGObject(type, idObject, mode), d (new VAbstractCurveData())
{}
: VGObject(type, idObject, mode),
d(new VAbstractCurveData())
{
}
//---------------------------------------------------------------------------------------------------------------------
VAbstractCurve::VAbstractCurve(const VAbstractCurve &curve) // NOLINT(modernize-use-equals-default)
:VGObject(curve), d (curve.d)
{}
COPY_CONSTRUCTOR_IMPL_2(VAbstractCurve, VGObject)
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractCurve::operator=(const VAbstractCurve &curve) -> VAbstractCurve &
@ -70,8 +70,10 @@ auto VAbstractCurve::operator=(const VAbstractCurve &curve) -> VAbstractCurve &
#ifdef Q_COMPILER_RVALUE_REFS
//---------------------------------------------------------------------------------------------------------------------
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 &
@ -83,8 +85,7 @@ auto VAbstractCurve::operator=(VAbstractCurve &&curve) noexcept -> VAbstractCurv
#endif
//---------------------------------------------------------------------------------------------------------------------
VAbstractCurve::~VAbstractCurve() // NOLINT(modernize-use-equals-default)
{}
VAbstractCurve::~VAbstractCurve() = default;
//---------------------------------------------------------------------------------------------------------------------
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;
if (piece.isEmpty())
{
errorMsg = QObject::tr("Error calculating segment for curve '%1'. %2")
.arg(name(), error);
errorMsg = QObject::tr("Error calculating segment for curve '%1'. %2").arg(name(), error);
}
else
{
errorMsg = QObject::tr("Error in path '%1'. Calculating segment for curve '%2' has failed. %3")
.arg(piece, name(), error);
}
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
VAbstractApplication::VApp()->IsPedantic()
? throw VExceptionObjectError(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
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>
{
if (points.count() >= 2)
{
if (ConstFirst(points).toPoint() == begin.toPoint())
auto SetResult = [&ok](bool res)
{
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;
}
@ -205,27 +215,14 @@ auto VAbstractCurve::FromBegin(const QVector<QPointF> &points, const QPointF &be
if (segment.isEmpty())
{
if (ok != nullptr)
{
*ok = false;
}
SetResult(false);
return points;
}
if (ok != nullptr)
{
*ok = true;
}
SetResult(true);
return segment;
}
if (ok != nullptr)
{
*ok = false;
}
return points;
}
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractCurve::ToEnd(const QVector<QPointF> &points, const QPointF &end, bool *ok) -> QVector<QPointF>
{

View File

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

View File

@ -34,20 +34,19 @@
//---------------------------------------------------------------------------------------------------------------------
VCubicBezier::VCubicBezier()
: VAbstractCubicBezier(GOType::CubicBezier), d(new VCubicBezierData)
: VAbstractCubicBezier(GOType::CubicBezier),
d(new VCubicBezierData)
{
}
//---------------------------------------------------------------------------------------------------------------------
VCubicBezier::VCubicBezier(const VCubicBezier &curve)
: VAbstractCubicBezier(curve), d(curve.d)
{
}
COPY_CONSTRUCTOR_IMPL_2(VCubicBezier, VAbstractCubicBezier)
//---------------------------------------------------------------------------------------------------------------------
VCubicBezier::VCubicBezier(const VPointF &p1, const VPointF &p2, const VPointF &p3, const VPointF &p4, quint32 idObject,
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();
}
@ -67,8 +66,10 @@ auto VCubicBezier::operator=(const VCubicBezier &curve) -> VCubicBezier &
#ifdef Q_COMPILER_RVALUE_REFS
//---------------------------------------------------------------------------------------------------------------------
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 &
@ -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
@ -214,8 +213,8 @@ auto VCubicBezier::GetEndAngle() const -> qreal
*/
auto VCubicBezier::GetLength() const -> qreal
{
return LengthBezier (static_cast<QPointF>(GetP1()), static_cast<QPointF>(GetP2()),
static_cast<QPointF>(GetP3()), static_cast<QPointF>(GetP4()), GetApproximationScale());
return LengthBezier(static_cast<QPointF>(GetP1()), static_cast<QPointF>(GetP2()), static_cast<QPointF>(GetP3()),
static_cast<QPointF>(GetP4()), GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------
@ -256,6 +255,6 @@ auto VCubicBezier::GetControlPoint2() const -> QPointF
//---------------------------------------------------------------------------------------------------------------------
auto VCubicBezier::GetRealLength() const -> qreal
{
return LengthBezier (static_cast<QPointF>(GetP1()), static_cast<QPointF>(GetP2()),
static_cast<QPointF>(GetP3()), static_cast<QPointF>(GetP4()), maxCurveApproximationScale);
return LengthBezier(static_cast<QPointF>(GetP1()), static_cast<QPointF>(GetP2()), static_cast<QPointF>(GetP3()),
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 Flip(const QLineF &axis, 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 &;
#ifdef Q_COMPILER_RVALUE_REFS
@ -59,29 +59,29 @@ public:
auto operator=(VCubicBezier &&curve) noexcept -> VCubicBezier &;
#endif
virtual auto GetP1() const -> VPointF override;
auto GetP1() const -> VPointF override;
void SetP1(const VPointF &p);
virtual auto GetP2() const -> VPointF override;
auto GetP2() const -> VPointF override;
void SetP2(const VPointF &p);
virtual auto GetP3() const -> VPointF override;
auto GetP3() const -> VPointF override;
void SetP3(const VPointF &p);
virtual auto GetP4() const -> VPointF override;
auto GetP4() const -> VPointF override;
void SetP4(const VPointF &p);
virtual auto GetStartAngle() const -> qreal override;
virtual auto GetEndAngle() const -> qreal override;
virtual auto GetLength() const -> qreal override;
virtual auto GetPoints() const -> QVector<QPointF> override;
auto GetStartAngle() const -> qreal override;
auto GetEndAngle() const -> qreal override;
auto GetLength() const -> qreal override;
auto GetPoints() const -> QVector<QPointF> override;
virtual auto GetC1Length() const -> qreal override;
virtual auto GetC2Length() const -> qreal override;
auto GetC1Length() const -> qreal override;
auto GetC2Length() const -> qreal override;
protected:
virtual auto GetControlPoint1() const -> QPointF override;
virtual auto GetControlPoint2() const -> QPointF override;
auto GetControlPoint1() const -> QPointF override;
auto GetControlPoint2() const -> QPointF override;
auto GetRealLength() const -> qreal override;
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)

View File

@ -49,11 +49,11 @@ class VCubicBezierPath final : public VAbstractCubicBezierPath
public:
explicit VCubicBezierPath(quint32 idObject = 0, Draw mode = Draw::Calculation);
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 Flip(const QLineF &axis, 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 &;
#ifdef Q_COMPILER_RVALUE_REFS
@ -67,17 +67,17 @@ public:
void append(const VPointF &point);
virtual auto CountSubSpl() const -> vsizetype override;
virtual auto CountPoints() const -> vsizetype override;
virtual void Clear() override;
virtual auto GetSpline(vsizetype index) const -> VSpline override;
virtual auto GetStartAngle() const -> qreal override;
virtual auto GetEndAngle() const -> qreal override;
auto CountSubSpl() const -> vsizetype override;
auto CountPoints() const -> vsizetype override;
void Clear() override;
auto GetSpline(vsizetype index) const -> VSpline override;
auto GetStartAngle() const -> qreal override;
auto GetEndAngle() const -> qreal override;
virtual auto GetC1Length() const -> qreal override;
virtual auto GetC2Length() const -> qreal override;
auto GetC1Length() 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>;
static auto CountSubSpl(vsizetype size) -> vsizetype;
@ -85,8 +85,8 @@ public:
static auto SubSplPointsCount(vsizetype countSubSpl) -> vsizetype;
protected:
virtual auto FirstPoint() const -> VPointF override;
virtual auto LastPoint() const -> VPointF override;
auto FirstPoint() const -> VPointF override;
auto LastPoint() const -> VPointF override;
private:
QSharedDataPointer<VCubicBezierPathData> d;

View File

@ -29,20 +29,20 @@
#include "vellipticalarc.h"
#include <QLineF>
#include <QPoint>
#include <QPainterPath>
#include <QPoint>
#include <QtDebug>
#include "../vmisc/def.h"
#include "../ifc/ifcdef.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/math.hpp"
#include "../vmisc/compatibility.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vmath.h"
#include "vabstractcurve.h"
#include "vellipticalarc_p.h"
#include "../vmisc/vmath.h"
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,
fpm::fixed_16_16 xQ, fpm::fixed_16_16 yQ, fpm::fixed_16_16 sweep,
fpm::fixed_16_16 flatness) -> QVector<QPointF>
fpm::fixed_16_16 xQ, fpm::fixed_16_16 yQ, fpm::fixed_16_16 sweep, fpm::fixed_16_16 flatness)
-> QVector<QPointF>
{
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);
@ -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,
qreal approximationScale) -> QVector<QPointF>
auto EllipticArcPoints(QPointF c, qreal radius1, qreal radius2, qreal astart, qreal asweep, qreal approximationScale)
-> QVector<QPointF>
{
fpm::fixed_16_16 xC{c.x()};
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.
*/
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
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VEllipticalArc copy constructor
* @param arc arc
*/
VEllipticalArc::VEllipticalArc(const VEllipticalArc &arc)
: VAbstractArc(arc), d (arc.d)
{}
COPY_CONSTRUCTOR_IMPL_2(VEllipticalArc, VAbstractArc)
//---------------------------------------------------------------------------------------------------------------------
/**
@ -318,7 +314,8 @@ auto VEllipticalArc::operator =(const VEllipticalArc &arc) -> VEllipticalArc &
VEllipticalArc::VEllipticalArc(VEllipticalArc &&arc) noexcept
: VAbstractArc(std::move(arc)),
d(std::move(arc.d))
{}
{
}
//---------------------------------------------------------------------------------------------------------------------
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 center = oldCenter.Move(length, angle);
const QPointF position = d->m_transform.inverted().map(center.toQPointF()) -
d->m_transform.inverted().map(oldCenter.toQPointF());
const QPointF position =
d->m_transform.inverted().map(center.toQPointF()) - d->m_transform.inverted().map(oldCenter.toQPointF());
QTransform t = d->m_transform;
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();
const QString errorMsg = QObject::tr("Unable to cut curve '%1'. The curve is too short.").arg(name());
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
VAbstractApplication::VApp()->IsPedantic()
? throw VException(errorMsg)
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
return {};
}
@ -560,15 +557,17 @@ auto VEllipticalArc::CutArc(const qreal &length, VEllipticalArc &arc1, VElliptic
if (not pointName.isEmpty())
{
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
{
errorMsg = QObject::tr("Curve '%1'. Length of a cut segment is too small. Optimize it to minimal value.")
.arg(name());
}
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
VAbstractApplication::VApp()->IsPedantic()
? throw VException(errorMsg)
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
}
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.")
.arg(name());
}
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
VAbstractApplication::VApp()->IsPedantic()
? throw VException(errorMsg)
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
}
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
arc1 = VEllipticalArc (len, QString().setNum(length), GetCenter(), d->radius1, d->radius2,
d->formulaRadius1, d->formulaRadius2, GetStartAngle(), GetFormulaF1(), d->rotationAngle,
arc1 = VEllipticalArc(len, QString().setNum(length), GetCenter(), d->radius1, d->radius2, d->formulaRadius1,
d->formulaRadius2, GetStartAngle(), GetFormulaF1(), d->rotationAngle,
GetFormulaRotationAngle(), getIdObject(), getMode());
// the second arc has startAngle just like endAngle of the first arc
// and it has endAngle just like endAngle of the origin arc
arc2 = VEllipticalArc (GetCenter(), d->radius1, d->radius2, d->formulaRadius1, d->formulaRadius2,
arc1.GetEndAngle(), arc1.GetFormulaF2(), GetEndAngle(), GetFormulaF2(), d->rotationAngle,
arc2 = VEllipticalArc(GetCenter(), d->radius1, d->radius2, d->formulaRadius1, d->formulaRadius2, arc1.GetEndAngle(),
arc1.GetFormulaF2(), GetEndAngle(), GetFormulaF2(), d->rotationAngle,
GetFormulaRotationAngle(), getIdObject(), getMode());
return arc1.GetP1();
}
//---------------------------------------------------------------------------------------------------------------------
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());
end.setAngle(VAbstractArc::GetEndAngle());
auto IsBoundedIntersection = [](QLineF::IntersectType type, QPointF p, const QLineF &segment1,
const QLineF &segment2)
auto IsBoundedIntersection =
[](QLineF::IntersectType type, QPointF p, const QLineF &segment1, const QLineF &segment2)
{
return type == QLineF::BoundedIntersection ||
(type == QLineF::UnboundedIntersection &&

View File

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

View File

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

View File

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

View File

@ -39,18 +39,20 @@
* @brief VPointF creat empty point
*/
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)
:VGObject(point), d(point.d)
{}
COPY_CONSTRUCTOR_IMPL_2(VPointF, VGObject)
//---------------------------------------------------------------------------------------------------------------------
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
*/
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);
}
@ -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
*/
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);
}
//---------------------------------------------------------------------------------------------------------------------
VPointF::~VPointF()
{}
VPointF::~VPointF() = default;
//---------------------------------------------------------------------------------------------------------------------
/**
@ -105,8 +108,10 @@ auto VPointF::operator=(const VPointF &point) -> VPointF &
#ifdef Q_COMPILER_RVALUE_REFS
//---------------------------------------------------------------------------------------------------------------------
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 &

View File

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

View File

@ -31,9 +31,9 @@
#include <QJsonObject>
#include <QLineF>
#include "../vmisc/vmath.h"
#include "vabstractcurve.h"
#include "vspline_p.h"
#include "../vmisc/vmath.h"
//---------------------------------------------------------------------------------------------------------------------
/**
@ -42,17 +42,11 @@
VSpline::VSpline()
: VAbstractCubicBezier(GOType::Spline),
d(new VSplineData)
{}
{
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @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)
{}
COPY_CONSTRUCTOR_IMPL_2(VSpline, VAbstractCubicBezier)
//---------------------------------------------------------------------------------------------------------------------
/**
@ -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,
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();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @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.
*/
// cppcheck-suppress unusedFunction
auto VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1,
qreal kAsm2, qreal kCurve, qreal approximationScale) -> QVector<QPointF>
auto VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2,
qreal kCurve, qreal approximationScale) -> QVector<QPointF>
{
QLineF p1pX(p1.x(), p1.y(), p1.x() + 100, p1.y());
p1pX.setAngle(angle1);
@ -272,7 +265,8 @@ auto VSpline::operator =(const VSpline &spline) -> VSpline &
VSpline::VSpline(VSpline &&spline) noexcept
: VAbstractCubicBezier(std::move(spline)),
d(std::move(spline.d))
{}
{
}
//---------------------------------------------------------------------------------------------------------------------
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,
qreal pointCoord) -> QVector<qreal>
auto VSpline::CalcT(qreal curveCoord1, qreal curveCoord2, qreal curveCoord3, qreal curveCoord4, qreal pointCoord)
-> QVector<qreal>
{
const qreal a = -curveCoord1 + 3 * curveCoord2 - 3 * curveCoord3 + curveCoord4;
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 p3 = static_cast<QPointF>(GetP4());
// 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 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 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 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));
if (line.length() <= eps)

View File

@ -46,7 +46,8 @@
VSplinePath::VSplinePath(quint32 idObject, Draw mode)
: VAbstractCubicBezierPath(GOType::SplinePath, idObject, mode),
d(new VSplinePathData())
{}
{
}
//---------------------------------------------------------------------------------------------------------------------
VSplinePath::VSplinePath(const QVector<VFSplinePoint> &points, qreal kCurve, quint32 idObject, Draw mode)
@ -93,14 +94,7 @@ VSplinePath::VSplinePath(const QVector<VSplinePoint> &points, quint32 idObject,
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VSplinePath copy constructor.
* @param splPath spline path.
*/
VSplinePath::VSplinePath(const VSplinePath &splPath)
: VAbstractCubicBezierPath(splPath),
d(splPath.d)
{}
COPY_CONSTRUCTOR_IMPL_2(VSplinePath, VAbstractCubicBezierPath)
//---------------------------------------------------------------------------------------------------------------------
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
: VAbstractCubicBezierPath(std::move(splPath)),
d(std::move(splPath.d))
{}
{
}
//---------------------------------------------------------------------------------------------------------------------
auto VSplinePath::operator=(VSplinePath &&path) noexcept -> VSplinePath &

View File

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

View File

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

View File

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

View File

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

View File

@ -27,29 +27,29 @@
*************************************************************************/
#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 "qmath.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 <QLineF>
#include <QSet>
#include <QVector>
#include <QPainterPath>
#include <QTemporaryFile>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QLineF>
#include <QPainterPath>
#include <QSet>
#include <QTemporaryFile>
#include <QVector>
#include <QtMath>
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,
const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2, const VSAPoint &p,
qreal width, bool *needRollback = nullptr) -> QVector<VRawSAPoint>
auto AngleByLength(QVector<VRawSAPoint> points, QPointF p1, QPointF p2, QPointF p3, const QLineF &bigLine1, QPointF sp2,
const QLineF &bigLine2, const VSAPoint &p, qreal width, bool *needRollback = nullptr)
-> QVector<VRawSAPoint>
{
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,
const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2,
const VSAPoint &p, qreal width, bool *needRollback = nullptr) -> QVector<VRawSAPoint>
auto AngleByIntersection(const QVector<VRawSAPoint> &points, QPointF p1, QPointF p2, QPointF p3, const QLineF &bigLine1,
QPointF sp2, const QLineF &bigLine2, const VSAPoint &p, qreal width,
bool *needRollback = nullptr) -> QVector<VRawSAPoint>
{
{
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,
const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2,
const VSAPoint &p, qreal width, bool *needRollback = nullptr) -> QVector<VRawSAPoint>
const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2, const VSAPoint &p, qreal width,
bool *needRollback = nullptr) -> QVector<VRawSAPoint>
{
{
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,
const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2,
const VSAPoint &p, qreal width, bool *needRollback = nullptr) -> QVector<VRawSAPoint>
const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2, const VSAPoint &p, qreal width,
bool *needRollback = nullptr) -> QVector<VRawSAPoint>
{
{
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,
const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2,
const VSAPoint &p, qreal width, bool *needRollback = nullptr) -> QVector<VRawSAPoint>
const QLineF &bigLine1, QPointF sp2, const QLineF &bigLine2, const VSAPoint &p, qreal width,
bool *needRollback = nullptr) -> QVector<VRawSAPoint>
{
{
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
{
const QLineF paralel = QLineF(SingleParallelPoint(p1, p2, 90, width),
SingleParallelPoint(p2, p1, -90, width));
const QLineF paralel = QLineF(SingleParallelPoint(p1, p2, 90, width), SingleParallelPoint(p2, p1, -90, width));
return paralel;
}
@ -699,8 +698,7 @@ auto AngleBetweenBisectors(const QLineF &b1, const QLineF &b2) -> qreal
}
//---------------------------------------------------------------------------------------------------------------------
template<class T>
auto CorrectPathDistortion(QVector<T> path) -> QVector<T>
template <class T> auto CorrectPathDistortion(QVector<T> path) -> QVector<T>
{
if (path.size() < 3)
{
@ -911,12 +909,11 @@ auto operator>>(QDataStream &dataStream, VAbstractPiece &piece) -> QDataStream &
//---------------------------------------------------------------------------------------------------------------------
VAbstractPiece::VAbstractPiece()
: d(new VAbstractPieceData)
{}
{
}
//---------------------------------------------------------------------------------------------------------------------
VAbstractPiece::VAbstractPiece(const VAbstractPiece &piece)
:d (piece.d)
{}
COPY_CONSTRUCTOR_IMPL(VAbstractPiece)
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractPiece::operator=(const VAbstractPiece &piece) -> VAbstractPiece &
@ -933,7 +930,8 @@ auto VAbstractPiece::operator=(const VAbstractPiece &piece) -> VAbstractPiece &
//---------------------------------------------------------------------------------------------------------------------
VAbstractPiece::VAbstractPiece(VAbstractPiece &&piece) noexcept
: d(std::move(piece.d))
{}
{
}
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractPiece::operator=(VAbstractPiece &&piece) noexcept -> VAbstractPiece &
@ -944,8 +942,7 @@ auto VAbstractPiece::operator=(VAbstractPiece &&piece) noexcept -> VAbstractPiec
#endif
//---------------------------------------------------------------------------------------------------------------------
VAbstractPiece::~VAbstractPiece()
{}
VAbstractPiece::~VAbstractPiece() = default;
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractPiece::GetName() const -> QString
@ -1074,8 +1071,9 @@ auto VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal width, const QS
const QString errorMsg =
QCoreApplication::translate("VAbstractPiece", "Piece '%1'. Not enough points to build seam allowance.")
.arg(name);
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
VAbstractApplication::VApp()->IsPedantic()
? throw VException(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return {};
}
@ -1200,8 +1198,8 @@ auto VAbstractPiece::SumTrapezoids(const QVector<QPointF> &points) -> qreal
* @return seam aloowance points.
*/
auto VAbstractPiece::EkvPoint(QVector<VRawSAPoint> points, const VSAPoint &p1Line1, const VSAPoint &p2Line1,
const VSAPoint &p1Line2, const VSAPoint &p2Line2, qreal width,
bool *needRollback) -> QVector<VRawSAPoint>
const VSAPoint &p1Line2, const VSAPoint &p2Line2, qreal width, bool *needRollback)
-> QVector<VRawSAPoint>
{
if (width < 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);
// Comparison bisector angles helps to find direction
if (angle < 135
|| VFuzzyComparePossibleNulls(angle, 135.0))// Go in a same direction
if (angle < 135 || VFuzzyComparePossibleNulls(angle, 135.0)) // Go in a same direction
{ // Regular equdistant case
QT_WARNING_PUSH
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,
const VSAPoint &nextPoint) -> bool
auto VAbstractPiece::IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &prevPoint, const VSAPoint &nextPoint)
-> bool
{
// See bug #671
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
auto VAbstractPiece::RollbackSeamAllowance(QVector<VRawSAPoint> points, const QLineF &cuttingEdge,
bool *success) -> QVector<VRawSAPoint>
auto VAbstractPiece::RollbackSeamAllowance(QVector<VRawSAPoint> points, const QLineF &cuttingEdge, bool *success)
-> QVector<VRawSAPoint>
{
*success = false;
QVector<VRawSAPoint> clipped;
@ -1595,9 +1592,8 @@ auto VAbstractPiece::RollbackSeamAllowance(QVector<VRawSAPoint> points, const QL
QPointF crosPoint;
const QLineF::IntersectType type = Intersects(cuttingEdge, segment, &crosPoint);
if (type != QLineF::NoIntersection
&& VGObject::IsPointOnLineSegment(crosPoint, segment.p1(), segment.p2())
&& IsSameDirection(cuttingEdge.p2(), cuttingEdge.p1(), crosPoint))
if (type != QLineF::NoIntersection && VGObject::IsPointOnLineSegment(crosPoint, segment.p1(), segment.p2()) &&
IsSameDirection(cuttingEdge.p2(), cuttingEdge.p1(), crosPoint))
{
clipped.append(VRawSAPoint(crosPoint, points.at(i).CurvePoint(), points.at(i).TurnPoint()));
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);
QLineF grainline(centerPinPoint->x(), centerPinPoint->y(),
centerPinPoint->x() + length / 2.0, centerPinPoint->y());
QLineF grainline(centerPinPoint->x(), centerPinPoint->y(), centerPinPoint->x() + length / 2.0,
centerPinPoint->y());
grainline.setAngle(qRadiansToDegrees(rotationAngle));
grainline = QLineF(grainline.p2(), grainline.p1());
@ -1832,11 +1828,8 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
auto SegmentShape = [pos, box, LayoutPoint]()
{
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)
};
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)};
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),
QPointF(pos.x() + box.width() / 2.0, pos.y() + box.height() / 2.0));
QVector<VLayoutPoint> shape
{
LayoutPoint(rect.topLeft(), true),
LayoutPoint(rect.topRight(), true),
LayoutPoint(rect.bottomRight(), true),
LayoutPoint(rect.bottomLeft(), true),
LayoutPoint(rect.topLeft(), true)
};
QVector<VLayoutPoint> shape{LayoutPoint(rect.topLeft(), true), LayoutPoint(rect.topRight(), true),
LayoutPoint(rect.bottomRight(), true), LayoutPoint(rect.bottomLeft(), true),
LayoutPoint(rect.topLeft(), true)};
return PlaceLabelImg{shape};
};
auto CrossShape = [pos, box, LayoutPoint]()
{
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)
};
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)};
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)
};
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)};
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);
QVector<VLayoutPoint> shape1
{
LayoutPoint(QPointF(pos.x(), pos.y()), true),
LayoutPoint(center2, true)
};
QVector<VLayoutPoint> shape1{LayoutPoint(QPointF(pos.x(), pos.y()), true), LayoutPoint(center2, true)};
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)
};
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)};
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),
QPointF(pos.x() + box.width() / 2.0, pos.y() + box.height() / 2.0));
QVector<VLayoutPoint> shape1
{
LayoutPoint(rect.topLeft(), true),
LayoutPoint(rect.bottomRight(), true)
};
QVector<VLayoutPoint> shape1{LayoutPoint(rect.topLeft(), true), LayoutPoint(rect.bottomRight(), true)};
QVector<VLayoutPoint> shape2
{
LayoutPoint(rect.topRight(), true),
LayoutPoint(rect.bottomLeft(), true)
};
QVector<VLayoutPoint> shape2{LayoutPoint(rect.topRight(), true), LayoutPoint(rect.bottomLeft(), true)};
return PlaceLabelImg{shape1, shape2};
};
auto CornerShape = [pos, box, LayoutPoint]()
{
QVector<VLayoutPoint> shape1
{
LayoutPoint(QPointF(pos.x(), pos.y()), true),
LayoutPoint(QPointF(pos.x(), pos.y() + box.height()/2.0), true)
};
QVector<VLayoutPoint> shape1{LayoutPoint(QPointF(pos.x(), pos.y()), true),
LayoutPoint(QPointF(pos.x(), pos.y() + box.height() / 2.0), true)};
QVector<VLayoutPoint> shape2
{
LayoutPoint(QPointF(pos.x() - box.width()/2.0, pos.y()), true),
LayoutPoint(QPointF(pos.x(), pos.y()), true)
};
QVector<VLayoutPoint> shape2{LayoutPoint(QPointF(pos.x() - box.width() / 2.0, pos.y()), true),
LayoutPoint(QPointF(pos.x(), pos.y()), true)};
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),
QPointF(pos.x() + box.width() / 2.0, pos.y() + box.height() / 2.0));
QVector<VLayoutPoint> shape
{
LayoutPoint(rect.topLeft(), true),
LayoutPoint(rect.topRight(), true),
LayoutPoint(rect.bottomRight(), true),
LayoutPoint(rect.topLeft(), true)
};
QVector<VLayoutPoint> shape{LayoutPoint(rect.topLeft(), true), LayoutPoint(rect.topRight(), true),
LayoutPoint(rect.bottomRight(), true), LayoutPoint(rect.topLeft(), true)};
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 center2(pos.x(), pos.y() + box.height() / 2.0);
QVector<VLayoutPoint> shape1
{
LayoutPoint(center1, true),
LayoutPoint(center2, true)
};
QVector<VLayoutPoint> shape1{LayoutPoint(center1, true), LayoutPoint(center2, true)};
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)
};
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)};
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)
};
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)};
return PlaceLabelImg{shape1, shape2, shape3};
};
@ -1976,17 +1922,11 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
auto ButtonShape = [pos, box, LayoutPoint]()
{
const qreal radius = qMin(box.width() / 2.0, box.height() / 2.0);
QVector<VLayoutPoint> shape1
{
LayoutPoint(QPointF(pos.x(), pos.y() - radius), true),
LayoutPoint(QPointF(pos.x(), pos.y() + radius), true)
};
QVector<VLayoutPoint> shape1{LayoutPoint(QPointF(pos.x(), pos.y() - radius), true),
LayoutPoint(QPointF(pos.x(), pos.y() + radius), true)};
QVector<VLayoutPoint> shape2
{
LayoutPoint(QPointF(pos.x() - radius, pos.y()), true),
LayoutPoint(QPointF(pos.x() + radius, pos.y()), true)
};
QVector<VLayoutPoint> shape2{LayoutPoint(QPointF(pos.x() - radius, pos.y()), true),
LayoutPoint(QPointF(pos.x() + radius, pos.y()), true)};
const qreal circleSize = 0.85;
VArc arc(VPointF(pos), radius * circleSize, 0, 360);

View File

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

View File

@ -29,11 +29,11 @@
#ifndef VBESTSQUARE_H
#define VBESTSQUARE_H
#include <QSharedDataPointer>
#include <QSizeF>
#include <QTransform>
#include <QtGlobal>
#include <QSharedDataPointer>
#include <QTypeInfo>
#include <QtGlobal>
#include "vlayoutdef.h"
@ -75,7 +75,6 @@ public:
private:
QSharedDataPointer<VBestSquareData> d;
};
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 &

View File

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

View File

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

View File

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

View File

@ -595,11 +595,7 @@ VLayoutPiece::VLayoutPiece()
}
//---------------------------------------------------------------------------------------------------------------------
VLayoutPiece::VLayoutPiece(const VLayoutPiece &detail) // NOLINT(modernize-use-equals-default)
: VAbstractPiece(detail),
d(detail.d)
{
}
COPY_CONSTRUCTOR_IMPL_2(VLayoutPiece, VAbstractPiece)
//---------------------------------------------------------------------------------------------------------------------
auto VLayoutPiece::operator=(const VLayoutPiece &detail) -> VLayoutPiece &
@ -615,14 +611,14 @@ auto VLayoutPiece::operator=(const VLayoutPiece &detail) -> VLayoutPiece &
#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))
{
}
//---------------------------------------------------------------------------------------------------------------------
auto VLayoutPiece::operator=(VLayoutPiece &&detail) noexcept
->VLayoutPiece &
auto VLayoutPiece::operator=(VLayoutPiece &&detail) noexcept -> VLayoutPiece &
{
VAbstractPiece::operator=(detail);
std::swap(d, detail.d);
@ -631,9 +627,7 @@ auto VLayoutPiece::operator=(VLayoutPiece &&detail) noexcept
#endif
//---------------------------------------------------------------------------------------------------------------------
VLayoutPiece::~VLayoutPiece() // NOLINT(modernize-use-equals-default)
{
}
VLayoutPiece::~VLayoutPiece() = default;
//---------------------------------------------------------------------------------------------------------------------
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 &;
#ifdef Q_COMPILER_RVALUE_REFS
VLayoutPiece(VLayoutPiece &&detail) noexcept;
auto operator=(VLayoutPiece &&detail) noexcept
->VLayoutPiece &;
auto operator=(VLayoutPiece &&detail) noexcept -> VLayoutPiece &;
#endif
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>
{
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)
{
std::reverse(points.begin(), points.end());

View File

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

View File

@ -68,6 +68,28 @@ template <class T> class QSharedPointer;
#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 QMarginsF;
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)
{

View File

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

View File

@ -26,6 +26,7 @@
**
*************************************************************************/
#include "vsvgglyph.h"
#include "../def.h"
#include "vsvgglyph_p.h"
#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)
: d(font.d)
{
}
COPY_CONSTRUCTOR_IMPL(VSvgGlyph)
//---------------------------------------------------------------------------------------------------------------------
VSvgGlyph::~VSvgGlyph() // NOLINT(modernize-use-equals-default)
{
}
VSvgGlyph::~VSvgGlyph() = default;
//---------------------------------------------------------------------------------------------------------------------
auto VSvgGlyph::operator=(const VSvgGlyph &glyph) -> VSvgGlyph &

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -33,8 +33,8 @@
#include <QtDebug>
#include "../ifc/ifcdef.h"
#include "vvariable.h"
#include "vmeasurement_p.h"
#include "vvariable.h"
//---------------------------------------------------------------------------------------------------------------------
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,
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);
VInternalVariable::SetValue(base);
}
//---------------------------------------------------------------------------------------------------------------------
VMeasurement::VMeasurement(const VMeasurement &m)
:VVariable(m), d(m.d)
{}
COPY_CONSTRUCTOR_IMPL_2(VMeasurement, VVariable)
//---------------------------------------------------------------------------------------------------------------------
auto VMeasurement::operator=(const VMeasurement &m) -> VMeasurement &
@ -93,8 +92,10 @@ auto VMeasurement::operator=(const VMeasurement &m) -> VMeasurement &
#ifdef Q_COMPILER_RVALUE_REFS
//---------------------------------------------------------------------------------------------------------------------
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 &
@ -106,8 +107,7 @@ auto VMeasurement::operator=(VMeasurement &&m) noexcept->VMeasurement &
#endif
//---------------------------------------------------------------------------------------------------------------------
VMeasurement::~VMeasurement()
{}
VMeasurement::~VMeasurement() = default;
//---------------------------------------------------------------------------------------------------------------------
auto VMeasurement::CorrectionHash(qreal baseA, qreal baseB, qreal baseC) -> QString

View File

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

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;

View File

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

View File

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

View File

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

View File

@ -27,29 +27,29 @@
*************************************************************************/
#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/vexceptionobjecterror.h"
#include "../vmisc/testpath.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/vpiecenode.h"
#include "vcontainer.h"
#include "vpassmark.h"
#include "vpiece_p.h"
#include <QSharedPointer>
#include <QDebug>
#include <QPainterPath>
#include <QTemporaryFile>
#include <QJsonObject>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QPainterPath>
#include <QSharedPointer>
#include <QTemporaryFile>
namespace
{
@ -116,13 +116,13 @@ auto RotatePath(const QVector<VPieceNode> &path, vsizetype index) -> QVector<VPi
//---------------------------------------------------------------------------------------------------------------------
VPiece::VPiece()
: VAbstractPiece(), d(new VPieceData(PiecePathType::PiecePath))
{}
: VAbstractPiece(),
d(new VPieceData(PiecePathType::PiecePath))
{
}
//---------------------------------------------------------------------------------------------------------------------
VPiece::VPiece(const VPiece &piece)
: VAbstractPiece(piece), d (piece.d)
{}
COPY_CONSTRUCTOR_IMPL_2(VPiece, VAbstractPiece)
//---------------------------------------------------------------------------------------------------------------------
auto VPiece::operator=(const VPiece &piece) -> VPiece &
@ -139,8 +139,10 @@ auto VPiece::operator=(const VPiece &piece) -> VPiece &
#ifdef Q_COMPILER_RVALUE_REFS
//---------------------------------------------------------------------------------------------------------------------
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 &
@ -152,8 +154,7 @@ auto VPiece::operator=(VPiece &&piece) noexcept->VPiece &
#endif
//---------------------------------------------------------------------------------------------------------------------
VPiece::~VPiece()
{}
VPiece::~VPiece() = default;
//---------------------------------------------------------------------------------------------------------------------
auto VPiece::GetPath() const -> VPiecePath
@ -662,8 +663,8 @@ auto VPiece::SeamAllowancePointsWithRotation(const VContainer *data, vsizetype m
int recordIndex = -1;
bool insertingCSA = false;
const qreal width = ToPixel(GetSAWidth(), *data->GetPatternUnit());
const QVector<VPieceNode> unitedPath = makeFirst > 0 ? RotatePath(GetUnitedPath(data), makeFirst)
: GetUnitedPath(data);
const QVector<VPieceNode> unitedPath =
makeFirst > 0 ? RotatePath(GetUnitedPath(data), makeFirst) : GetUnitedPath(data);
QVector<VSAPoint> pointsEkv;
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 indexEndPoint = d->m_path.indexOfNode(record.endPoint);
if (record.startPoint > NULL_ID
&& record.path > NULL_ID
&& record.endPoint > NULL_ID
&& indexStartPoint != -1
&& not d->m_path.at(indexStartPoint).IsExcluded()
&& indexEndPoint != -1
&& not d->m_path.at(indexEndPoint).IsExcluded())
if (record.startPoint > NULL_ID && record.path > NULL_ID && record.endPoint > NULL_ID &&
indexStartPoint != -1 && not d->m_path.at(indexStartPoint).IsExcluded() && indexEndPoint != -1 &&
not d->m_path.at(indexEndPoint).IsExcluded())
{
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'.")
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
VAbstractApplication::VApp()->IsPedantic()
? throw VExceptionInvalidNotch(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
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'.")
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
VAbstractApplication::VApp()->IsPedantic()
? throw VExceptionInvalidNotch(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
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'.")
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
VAbstractApplication::VApp()->IsPedantic()
? throw VExceptionInvalidNotch(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return {};
}
@ -1085,8 +1085,7 @@ auto VPiece::CreatePassmark(const QVector<VPieceNode> &path, vsizetype previousI
return {};
}
if (passmarkSAPoint.IsManualPasskmarkLength()
&& passmarkSAPoint.GetPasskmarkLength() <= accuracyPointOnLine)
if (passmarkSAPoint.IsManualPasskmarkLength() && passmarkSAPoint.GetPasskmarkLength() <= accuracyPointOnLine)
{
const QString infoMsg = tr("Notch for point '%1' in piece '%2' will be disabled. Manual length is less than "
"allowed value.")
@ -1243,8 +1242,7 @@ qreal VPiece::GlobalPassmarkWidth(const VContainer *data) const
//---------------------------------------------------------------------------------------------------------------------
auto VPiece::MainPathToJson() const -> QJsonObject
{
QJsonObject pieceObject
{
QJsonObject pieceObject{
{"seamAllowance", IsSeamAllowance()},
{"saWidth", GetSAWidth()},
};
@ -1252,8 +1250,7 @@ auto VPiece::MainPathToJson() const -> QJsonObject
QJsonArray nodesArray;
for (qint32 i = 0; i < d->m_path.CountNodes(); ++i)
{
QJsonObject nodeObject
{
QJsonObject nodeObject{
{"id", static_cast<qint64>(d->m_path.at(i).GetId())},
{"type", static_cast<int>(d->m_path.at(i).GetTypeTool())},
{"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());
}
QJsonObject dbObject
{
{"items", itemsArray}
};
QJsonObject dbObject{{"items", itemsArray}};
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
#endif
#endif
QJsonObject testCase
{
QJsonObject testCase{
{"bd", piece.DBToJson(data)},
{"piece", piece.MainPathToJson()},
};
QJsonObject json
{
QJsonObject json{
{"testCase", testCase},
};
@ -1358,18 +1350,22 @@ void VPiece::TestInternalPathCuttingPathIntersection(const VContainer *data) con
if (internalPath.intersects(contourPath))
{
const QString errorMsg = QObject::tr("Piece '%1'. Internal path '%2' intersects with cutting "
"contour.").arg(GetName(), path.GetName());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
"contour.")
.arg(GetName(), path.GetName());
VAbstractApplication::VApp()->IsPedantic()
? throw VExceptionObjectError(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
continue;
}
if (not contourPath.contains(internalPath))
{
const QString errorMsg = QObject::tr("Piece '%1'. Internal path '%2' not inside of cutting "
"contour.").arg(GetName(), path.GetName());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
"contour.")
.arg(GetName(), path.GetName());
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))
{
const QString errorMsg = QObject::tr("Piece '%1'. Internal path '%2' intersects with internal path "
"'%3'.").arg(GetName(), path1.GetName(), path2.GetName());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
"'%3'.")
.arg(GetName(), path1.GetName(), path2.GetName());
VAbstractApplication::VApp()->IsPedantic()
? throw VExceptionObjectError(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
}
}

View File

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

View File

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

View File

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

View File

@ -27,16 +27,16 @@
*************************************************************************/
#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 "../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 <qnumeric.h>
namespace
{
@ -238,22 +238,22 @@ void AppendCurveSegment(QVector<T> &points, QVector<QPointF> &segment, const VSA
points.append(lp);
}
}
}
} // namespace
//---------------------------------------------------------------------------------------------------------------------
VPiecePath::VPiecePath()
: d(new VPiecePathData)
{}
{
}
//---------------------------------------------------------------------------------------------------------------------
VPiecePath::VPiecePath(PiecePathType type)
: d(new VPiecePathData(type))
{}
{
}
//---------------------------------------------------------------------------------------------------------------------
VPiecePath::VPiecePath(const VPiecePath &path)
: d (path.d)
{}
COPY_CONSTRUCTOR_IMPL(VPiecePath)
//---------------------------------------------------------------------------------------------------------------------
auto VPiecePath::operator=(const VPiecePath &path) -> VPiecePath &
@ -270,7 +270,8 @@ auto VPiecePath::operator=(const VPiecePath &path) -> VPiecePath &
//---------------------------------------------------------------------------------------------------------------------
VPiecePath::VPiecePath(VPiecePath &&path) noexcept
: d(std::move(path.d))
{}
{
}
//---------------------------------------------------------------------------------------------------------------------
auto VPiecePath::operator=(VPiecePath &&path) noexcept -> VPiecePath &
@ -281,8 +282,7 @@ auto VPiecePath::operator=(VPiecePath &&path) noexcept->VPiecePath &
#endif
//---------------------------------------------------------------------------------------------------------------------
VPiecePath::~VPiecePath()
{}
VPiecePath::~VPiecePath() = default;
//---------------------------------------------------------------------------------------------------------------------
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 "
"point with cutting contour")
.arg(GetName());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
VAbstractApplication::VApp()->IsPedantic()
? 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 "
"point with cutting contour")
.arg(GetName());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
VAbstractApplication::VApp()->IsPedantic()
? throw VExceptionObjectError(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
}
@ -891,8 +893,7 @@ auto VPiecePath::RemoveEdge(quint32 index) const -> VPiecePath
{
j = 0;
}
}
while (j != j2);
} while (j != j2);
}
}
return path;

View File

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

View File

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

View File

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