Refactoring.
Code style.
This commit is contained in:
parent
97957cf4d7
commit
49b0ae49f5
|
@ -36,10 +36,10 @@
|
|||
#include <QRectF>
|
||||
#include <Qt>
|
||||
|
||||
#include "vcontour_p.h"
|
||||
#include "vlayoutpiece.h"
|
||||
#include "../vgeometry/vgeometrydef.h"
|
||||
#include "../vgeometry/vgobject.h"
|
||||
#include "vcontour_p.h"
|
||||
#include "vlayoutpiece.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -96,17 +96,17 @@ auto OptimizeCombining(const QVector<QPointF> &contour, const QPointF &withdrawE
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VContour::VContour()
|
||||
: d(new VContourData())
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VContour::VContour(int height, int width, qreal layoutWidth)
|
||||
: d(new VContourData(height, width, layoutWidth))
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VContour::VContour(const VContour &contour)
|
||||
:d (contour.d)
|
||||
{}
|
||||
VContour::VContour(const VContour &contour) = default;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VContour::operator=(const VContour &contour) -> VContour &
|
||||
|
@ -123,7 +123,8 @@ auto VContour::operator=(const VContour &contour) -> VContour &
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VContour::VContour(VContour &&contour) noexcept
|
||||
: d(std::move(contour.d))
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VContour::operator=(VContour &&contour) noexcept -> VContour &
|
||||
|
@ -134,8 +135,7 @@ auto VContour::operator=(VContour &&contour) noexcept->VContour &
|
|||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VContour::~VContour()
|
||||
{}
|
||||
VContour::~VContour() = default;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VContour::CeateEmptySheetContour()
|
||||
|
@ -204,7 +204,7 @@ void VContour::SetWidth(int width)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VContour::GetSize() const -> QSizeF
|
||||
{
|
||||
return QSizeF(d->paperWidth, d->paperHeight);
|
||||
return {static_cast<qreal>(d->paperWidth), static_cast<qreal>(d->paperHeight)};
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -220,12 +220,12 @@ auto VContour::UniteWithContour(const VLayoutPiece &detail, int globalI, int det
|
|||
{
|
||||
if (globalI <= 0 || globalI > GlobalEdgesCount())
|
||||
{
|
||||
return QVector<QPointF>();
|
||||
return {};
|
||||
}
|
||||
|
||||
if (detJ <= 0 || detJ > detail.LayoutEdgesCount())
|
||||
{
|
||||
return QVector<QPointF>();
|
||||
return {};
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
|
@ -274,16 +274,16 @@ auto VContour::GlobalEdge(int i) const -> QLineF
|
|||
|
||||
const QLineF emptyEdge = EmptySheetEdge();
|
||||
const qreal nShift = emptyEdge.length() / static_cast<int>(GlobalEdgesCount());
|
||||
edge = IsPortrait() ? QLineF(nShift*(i-1) + emptyEdge.x1(), emptyEdge.y1(),
|
||||
nShift*i + emptyEdge.x1(), emptyEdge.y2()) :
|
||||
QLineF(emptyEdge.x1(), nShift*(i-1) + emptyEdge.y1(),
|
||||
emptyEdge.x2(), nShift*i + emptyEdge.y1());
|
||||
edge = IsPortrait() ? QLineF(nShift * (i - 1) + emptyEdge.x1(), emptyEdge.y1(), nShift * i + emptyEdge.x1(),
|
||||
emptyEdge.y2())
|
||||
: QLineF(emptyEdge.x1(), nShift * (i - 1) + emptyEdge.y1(), emptyEdge.x2(),
|
||||
nShift * i + emptyEdge.y1());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i < 1 || i > GlobalEdgesCount())
|
||||
{ // Doesn't exist such edge
|
||||
return QLineF();
|
||||
return {};
|
||||
}
|
||||
|
||||
if (i < GlobalEdgesCount())
|
||||
|
@ -335,6 +335,8 @@ auto VContour::CutEdge(const QLineF &edge) const -> QVector<QPointF>
|
|||
auto VContour::CutEmptySheetEdge() const -> QVector<QPointF>
|
||||
{
|
||||
QVector<QPointF> points;
|
||||
points.reserve(GlobalEdgesCount() + 1);
|
||||
|
||||
const qreal nShift = EmptySheetEdge().length() / static_cast<int>(GlobalEdgesCount());
|
||||
for (int i = 1; i <= GlobalEdgesCount() + 1; ++i)
|
||||
{
|
||||
|
@ -373,8 +375,7 @@ void VContour::AppendWhole(QVector<QPointF> &contour, const VLayoutPiece &detail
|
|||
}
|
||||
++processedEdges;
|
||||
++j;
|
||||
}
|
||||
while (processedEdges < nD);
|
||||
} while (processedEdges < nD);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -402,8 +403,7 @@ void VContour::InsertDetail(QVector<QPointF> &contour, const VLayoutPiece &detai
|
|||
}
|
||||
++processedEdges;
|
||||
++j;
|
||||
}
|
||||
while (processedEdges < nD);
|
||||
} while (processedEdges < nD);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -444,6 +444,6 @@ auto VContour::EmptySheetEdge() const -> QLineF
|
|||
{
|
||||
const int offset = qRound(accuracyPointOnLine * 4.);
|
||||
const int layoutOffset = qCeil(d->layoutWidth - accuracyPointOnLine * 2.);
|
||||
return IsPortrait() ? QLineF(offset, -layoutOffset, d->paperWidth-offset, -layoutOffset) :
|
||||
QLineF(-layoutOffset, offset, -layoutOffset, d->paperHeight-offset);
|
||||
return IsPortrait() ? QLineF(offset, -layoutOffset, d->paperWidth - offset, -layoutOffset)
|
||||
: QLineF(-layoutOffset, offset, -layoutOffset, d->paperHeight - offset);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
|
||||
/** @brief id each increment have unique identificator */
|
||||
quint32 index{0}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
QString formula; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
QString formula{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
bool formulaOk{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
bool previewCalculation{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
QSharedPointer<VContainer> data; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
|
|
Loading…
Reference in New Issue
Block a user