Refactoring.
This commit is contained in:
parent
bd10a78f55
commit
6c0863ca62
|
@ -67,7 +67,7 @@
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLayoutPiecePath> ConvertInternalPaths(const VPiece &piece, const VContainer *pattern)
|
auto ConvertInternalPaths(const VPiece &piece, const VContainer *pattern) -> QVector<VLayoutPiecePath>
|
||||||
{
|
{
|
||||||
SCASSERT(pattern != nullptr)
|
SCASSERT(pattern != nullptr)
|
||||||
|
|
||||||
|
@ -90,8 +90,8 @@ QVector<VLayoutPiecePath> ConvertInternalPaths(const VPiece &piece, const VConta
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pattern, qreal &rotationAngle,
|
auto FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pattern, qreal &rotationAngle,
|
||||||
qreal &labelWidth, qreal &labelHeight, QPointF &pos)
|
qreal &labelWidth, qreal &labelHeight, QPointF &pos) -> bool
|
||||||
{
|
{
|
||||||
SCASSERT(pattern != nullptr)
|
SCASSERT(pattern != nullptr)
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ bool FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pat
|
||||||
* @param dAng angle of rotation
|
* @param dAng angle of rotation
|
||||||
* @return position of point pt after rotating it around the center for dAng radians
|
* @return position of point pt after rotating it around the center for dAng radians
|
||||||
*/
|
*/
|
||||||
QPointF RotatePoint(const QPointF &ptCenter, const QPointF& pt, qreal dAng)
|
auto RotatePoint(const QPointF &ptCenter, const QPointF& pt, qreal dAng) -> QPointF
|
||||||
{
|
{
|
||||||
QPointF ptDest;
|
QPointF ptDest;
|
||||||
QPointF ptRel = pt - ptCenter;
|
QPointF ptRel = pt - ptCenter;
|
||||||
|
@ -187,7 +187,7 @@ QPointF RotatePoint(const QPointF &ptCenter, const QPointF& pt, qreal dAng)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList PieceLabelText(const QVector<QPointF> &labelShape, const VTextManager &tm)
|
auto PieceLabelText(const QVector<QPointF> &labelShape, const VTextManager &tm) -> QStringList
|
||||||
{
|
{
|
||||||
QStringList text;
|
QStringList text;
|
||||||
if (labelShape.count() > 2)
|
if (labelShape.count() > 2)
|
||||||
|
@ -203,7 +203,7 @@ QStringList PieceLabelText(const QVector<QPointF> &labelShape, const VTextManage
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLayoutPlaceLabel> ConvertPlaceLabels(const VPiece &piece, const VContainer *pattern)
|
auto ConvertPlaceLabels(const VPiece &piece, const VContainer *pattern) -> QVector<VLayoutPlaceLabel>
|
||||||
{
|
{
|
||||||
QVector<VLayoutPlaceLabel> labels;
|
QVector<VLayoutPlaceLabel> labels;
|
||||||
const auto placeLabels = piece.GetPlaceLabels();
|
const auto placeLabels = piece.GetPlaceLabels();
|
||||||
|
@ -226,18 +226,9 @@ QVector<VLayoutPlaceLabel> ConvertPlaceLabels(const VPiece &piece, const VContai
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer *pattern)
|
auto PrepareSAPassmark(const VPiece &piece, const VContainer *pattern, const VPassmark &passmark,
|
||||||
|
PassmarkSide side, bool &ok) -> VLayoutPassmark
|
||||||
{
|
{
|
||||||
const QVector<VPassmark> passmarks = piece.Passmarks(pattern);
|
|
||||||
QVector<VLayoutPassmark> layoutPassmarks;
|
|
||||||
for(const auto &passmark : passmarks)
|
|
||||||
{
|
|
||||||
if (not passmark.IsNull())
|
|
||||||
{
|
|
||||||
VPiecePassmarkData pData = passmark.Data();
|
|
||||||
|
|
||||||
auto PreapreBuiltInSAPassmark = [pData, passmark, piece, &layoutPassmarks, pattern]()
|
|
||||||
{
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wnoexcept")
|
QT_WARNING_DISABLE_GCC("-Wnoexcept")
|
||||||
// noexcept-expression evaluates to 'false' because of a call to 'constexpr QPointF::QPointF()'
|
// noexcept-expression evaluates to 'false' because of a call to 'constexpr QPointF::QPointF()'
|
||||||
|
@ -246,68 +237,21 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
|
VPiecePassmarkData pData = passmark.Data();
|
||||||
const QVector<VPieceNode> path = piece.GetUnitedPath(pattern);
|
const QVector<VPieceNode> path = piece.GetUnitedPath(pattern);
|
||||||
const int nodeIndex = VPiecePath::indexOfNode(path, pData.id);
|
const int nodeIndex = VPiecePath::indexOfNode(path, pData.id);
|
||||||
if (nodeIndex != -1)
|
if (nodeIndex == -1)
|
||||||
{
|
|
||||||
const QVector<QLineF> lines = passmark.BuiltInSAPassmark(piece, pattern);
|
|
||||||
if (lines.isEmpty())
|
|
||||||
{
|
|
||||||
const QString errorMsg =
|
|
||||||
QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark is empty.")
|
|
||||||
.arg(pData.nodeName, piece.GetName());
|
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
layoutPassmark.lines = lines;
|
|
||||||
|
|
||||||
const QVector<QLineF> baseLines = passmark.BuiltInSAPassmarkBaseLine(piece);
|
|
||||||
if (baseLines.isEmpty())
|
|
||||||
{
|
|
||||||
const QString errorMsg =
|
|
||||||
QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark base line is "
|
|
||||||
"empty.")
|
|
||||||
.arg(pData.nodeName, piece.GetName());
|
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
layoutPassmark.baseLine = ConstFirst (baseLines);
|
|
||||||
|
|
||||||
|
|
||||||
layoutPassmark.type = pData.passmarkLineType;
|
|
||||||
layoutPassmark.isBuiltIn = true;
|
|
||||||
|
|
||||||
layoutPassmarks.append(layoutPassmark);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
const QString errorMsg =
|
const QString errorMsg =
|
||||||
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
||||||
.arg(pData.nodeName, piece.GetName());
|
.arg(pData.nodeName, piece.GetName());
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
|
ok = false;
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
auto PrepareSAPassmark = [pData, passmark, piece, &layoutPassmarks, pattern](PassmarkSide side)
|
QVector<QLineF> baseLines = passmark.SAPassmarkBaseLine(piece, pattern, static_cast<PassmarkSide>(side));
|
||||||
{
|
|
||||||
QT_WARNING_PUSH
|
|
||||||
QT_WARNING_DISABLE_GCC("-Wnoexcept")
|
|
||||||
// noexcept-expression evaluates to 'false' because of a call to 'constexpr QPointF::QPointF()'
|
|
||||||
|
|
||||||
VLayoutPassmark layoutPassmark;
|
|
||||||
|
|
||||||
QT_WARNING_POP
|
|
||||||
|
|
||||||
const QVector<VPieceNode> path = piece.GetUnitedPath(pattern);
|
|
||||||
const int nodeIndex = VPiecePath::indexOfNode(path, pData.id);
|
|
||||||
if (nodeIndex != -1)
|
|
||||||
{
|
|
||||||
QVector<QLineF> baseLines =
|
|
||||||
passmark.SAPassmarkBaseLine(piece, pattern, static_cast<PassmarkSide>(side));
|
|
||||||
if (baseLines.isEmpty())
|
if (baseLines.isEmpty())
|
||||||
{
|
{
|
||||||
const QString errorMsg =
|
const QString errorMsg =
|
||||||
|
@ -315,7 +259,8 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
.arg(pData.nodeName, piece.GetName());
|
.arg(pData.nodeName, piece.GetName());
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return;
|
ok = false;
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (side == PassmarkSide::All || side == PassmarkSide::Right)
|
if (side == PassmarkSide::All || side == PassmarkSide::Right)
|
||||||
|
@ -335,55 +280,142 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
.arg(pData.nodeName, piece.GetName());
|
.arg(pData.nodeName, piece.GetName());
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return;
|
ok = false;
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
layoutPassmark.lines = lines;
|
layoutPassmark.lines = lines;
|
||||||
layoutPassmark.type = pData.passmarkLineType;
|
layoutPassmark.type = pData.passmarkLineType;
|
||||||
layoutPassmark.isBuiltIn = false;
|
layoutPassmark.isBuiltIn = false;
|
||||||
|
|
||||||
layoutPassmarks.append(layoutPassmark);
|
ok = true;
|
||||||
}
|
return layoutPassmark;
|
||||||
else
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto PreapreBuiltInSAPassmark(const VPiece &piece, const VContainer *pattern, const VPassmark &passmark,
|
||||||
|
bool &ok) -> VLayoutPassmark
|
||||||
|
{
|
||||||
|
QT_WARNING_PUSH
|
||||||
|
QT_WARNING_DISABLE_GCC("-Wnoexcept")
|
||||||
|
// noexcept-expression evaluates to 'false' because of a call to 'constexpr QPointF::QPointF()'
|
||||||
|
|
||||||
|
VLayoutPassmark layoutPassmark;
|
||||||
|
|
||||||
|
QT_WARNING_POP
|
||||||
|
|
||||||
|
VPiecePassmarkData pData = passmark.Data();
|
||||||
|
const QVector<VPieceNode> path = piece.GetUnitedPath(pattern);
|
||||||
|
const int nodeIndex = VPiecePath::indexOfNode(path, pData.id);
|
||||||
|
if (nodeIndex == -1)
|
||||||
{
|
{
|
||||||
const QString errorMsg =
|
const QString errorMsg =
|
||||||
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
||||||
.arg(pData.nodeName, piece.GetName());
|
.arg(pData.nodeName, piece.GetName());
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
|
ok = false;
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const QVector<QLineF> lines = passmark.BuiltInSAPassmark(piece, pattern);
|
||||||
|
if (lines.isEmpty())
|
||||||
|
{
|
||||||
|
const QString errorMsg =
|
||||||
|
QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark is empty.")
|
||||||
|
.arg(pData.nodeName, piece.GetName());
|
||||||
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
|
ok = false;
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
layoutPassmark.lines = lines;
|
||||||
|
|
||||||
|
const QVector<QLineF> baseLines = passmark.BuiltInSAPassmarkBaseLine(piece);
|
||||||
|
if (baseLines.isEmpty())
|
||||||
|
{
|
||||||
|
const QString errorMsg =
|
||||||
|
QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark base line is "
|
||||||
|
"empty.")
|
||||||
|
.arg(pData.nodeName, piece.GetName());
|
||||||
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
|
ok = false;
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
layoutPassmark.baseLine = ConstFirst (baseLines);
|
||||||
|
layoutPassmark.type = pData.passmarkLineType;
|
||||||
|
layoutPassmark.isBuiltIn = true;
|
||||||
|
|
||||||
|
ok = true;
|
||||||
|
return layoutPassmark;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto ConvertPassmarks(const VPiece &piece, const VContainer *pattern) -> QVector<VLayoutPassmark>
|
||||||
|
{
|
||||||
|
const QVector<VPassmark> passmarks = piece.Passmarks(pattern);
|
||||||
|
QVector<VLayoutPassmark> layoutPassmarks;
|
||||||
|
layoutPassmarks.reserve(passmarks.size());
|
||||||
|
|
||||||
|
for(const auto &passmark : passmarks)
|
||||||
|
{
|
||||||
|
if (passmark.IsNull())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto AddPassmark = [passmark, piece, pattern, &layoutPassmarks](PassmarkSide side)
|
||||||
|
{
|
||||||
|
bool ok = false;
|
||||||
|
VLayoutPassmark layoutPassmark = PrepareSAPassmark(piece, pattern, passmark, side, ok);
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
layoutPassmarks.append(layoutPassmark);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (not piece.IsSeamAllowanceBuiltIn())
|
auto AddBuiltInPassmark = [passmark, piece, pattern, &layoutPassmarks]()
|
||||||
{
|
{
|
||||||
if (pData.passmarkAngleType == PassmarkAngleType::Straightforward
|
bool ok = false;
|
||||||
|| pData.passmarkAngleType == PassmarkAngleType::Bisector)
|
VLayoutPassmark layoutPassmark = PreapreBuiltInSAPassmark(piece, pattern, passmark, ok);
|
||||||
|
if (ok)
|
||||||
{
|
{
|
||||||
PrepareSAPassmark(PassmarkSide::All);
|
layoutPassmarks.append(layoutPassmark);
|
||||||
}
|
}
|
||||||
else if (pData.passmarkAngleType == PassmarkAngleType::Intersection
|
};
|
||||||
|| pData.passmarkAngleType == PassmarkAngleType::IntersectionOnlyLeft
|
|
||||||
|| pData.passmarkAngleType == PassmarkAngleType::IntersectionOnlyRight
|
if (piece.IsSeamAllowanceBuiltIn())
|
||||||
|| pData.passmarkAngleType == PassmarkAngleType::Intersection2
|
|
||||||
|| pData.passmarkAngleType == PassmarkAngleType::Intersection2OnlyLeft
|
|
||||||
|| pData.passmarkAngleType == PassmarkAngleType::Intersection2OnlyRight)
|
|
||||||
{
|
{
|
||||||
if (pData.passmarkAngleType == PassmarkAngleType::Intersection ||
|
AddBuiltInPassmark();
|
||||||
pData.passmarkAngleType == PassmarkAngleType::Intersection2)
|
continue;
|
||||||
{
|
|
||||||
PrepareSAPassmark(PassmarkSide::Left);
|
|
||||||
PrepareSAPassmark(PassmarkSide::Right);
|
|
||||||
}
|
}
|
||||||
else if (pData.passmarkAngleType == PassmarkAngleType::IntersectionOnlyLeft ||
|
|
||||||
pData.passmarkAngleType == PassmarkAngleType::Intersection2OnlyLeft)
|
VPiecePassmarkData pData = passmark.Data();
|
||||||
|
|
||||||
|
switch(pData.passmarkAngleType)
|
||||||
{
|
{
|
||||||
PrepareSAPassmark(PassmarkSide::Left);
|
case PassmarkAngleType::Straightforward:
|
||||||
}
|
case PassmarkAngleType::Bisector:
|
||||||
else if (pData.passmarkAngleType == PassmarkAngleType::IntersectionOnlyRight ||
|
AddPassmark(PassmarkSide::All);
|
||||||
pData.passmarkAngleType == PassmarkAngleType::Intersection2OnlyRight)
|
break;
|
||||||
{
|
case PassmarkAngleType::Intersection:
|
||||||
PrepareSAPassmark(PassmarkSide::Right);
|
case PassmarkAngleType::Intersection2:
|
||||||
}
|
AddPassmark(PassmarkSide::Left);
|
||||||
|
AddPassmark(PassmarkSide::Right);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::IntersectionOnlyLeft:
|
||||||
|
case PassmarkAngleType::Intersection2OnlyLeft:
|
||||||
|
AddPassmark(PassmarkSide::Left);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::IntersectionOnlyRight:
|
||||||
|
case PassmarkAngleType::Intersection2OnlyRight:
|
||||||
|
AddPassmark(PassmarkSide::Right);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VAbstractApplication::VApp()->Settings()->IsDoublePassmark()
|
if (VAbstractApplication::VApp()->Settings()->IsDoublePassmark()
|
||||||
|
@ -398,13 +430,7 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
&& pData.passmarkAngleType != PassmarkAngleType::Intersection2OnlyRight
|
&& pData.passmarkAngleType != PassmarkAngleType::Intersection2OnlyRight
|
||||||
&& pData.isShowSecondPassmark)
|
&& pData.isShowSecondPassmark)
|
||||||
{
|
{
|
||||||
PreapreBuiltInSAPassmark();
|
AddBuiltInPassmark();
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PreapreBuiltInSAPassmark();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,16 +535,16 @@ auto PrepareGradationId(const QString &label, const VContainer *pattern) -> QStr
|
||||||
|
|
||||||
// Friend functions
|
// Friend functions
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDataStream &operator<<(QDataStream &dataStream, const VLayoutPoint &p)
|
auto operator<<(QDataStream &dataStream, const VLayoutPoint &p) -> QDataStream &
|
||||||
{
|
{
|
||||||
dataStream << static_cast<QPointF>(p);
|
dataStream << static_cast<QPointF>(p); // NOLINT(cppcoreguidelines-slicing)
|
||||||
dataStream << p.TurnPoint();
|
dataStream << p.TurnPoint();
|
||||||
dataStream << p.CurvePoint();
|
dataStream << p.CurvePoint();
|
||||||
return dataStream;
|
return dataStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDataStream &operator>>(QDataStream &dataStream, VLayoutPoint &p)
|
auto operator>>(QDataStream &dataStream, VLayoutPoint &p) -> QDataStream &
|
||||||
{
|
{
|
||||||
QPointF tmp;
|
QPointF tmp;
|
||||||
bool turnPointFlag = false;
|
bool turnPointFlag = false;
|
||||||
|
@ -535,15 +561,15 @@ QDataStream &operator>>(QDataStream &dataStream, VLayoutPoint &p)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDataStream &operator<<(QDataStream &dataStream, const VLayoutPiece &piece)
|
auto operator<<(QDataStream &dataStream, const VLayoutPiece &piece) -> QDataStream &
|
||||||
{
|
{
|
||||||
dataStream << static_cast<VAbstractPiece>(piece);
|
dataStream << static_cast<VAbstractPiece>(piece); // NOLINT(cppcoreguidelines-slicing)
|
||||||
dataStream << *piece.d;
|
dataStream << *piece.d;
|
||||||
return dataStream;
|
return dataStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDataStream &operator>>(QDataStream &dataStream, VLayoutPiece &piece)
|
auto operator>>(QDataStream &dataStream, VLayoutPiece &piece) -> QDataStream &
|
||||||
{
|
{
|
||||||
dataStream >> static_cast<VAbstractPiece &>(piece);
|
dataStream >> static_cast<VAbstractPiece &>(piece);
|
||||||
dataStream >> *piece.d;
|
dataStream >> *piece.d;
|
||||||
|
@ -552,16 +578,16 @@ QDataStream &operator>>(QDataStream &dataStream, VLayoutPiece &piece)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutPiece::VLayoutPiece()
|
VLayoutPiece::VLayoutPiece()
|
||||||
:VAbstractPiece(), d(new VLayoutPieceData)
|
:d(new VLayoutPieceData)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutPiece::VLayoutPiece(const VLayoutPiece &detail)
|
VLayoutPiece::VLayoutPiece(const VLayoutPiece &detail) // NOLINT(modernize-use-equals-default)
|
||||||
:VAbstractPiece(detail), d(detail.d)
|
:VAbstractPiece(detail), d(detail.d)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutPiece &VLayoutPiece::operator=(const VLayoutPiece &detail)
|
auto VLayoutPiece::operator=(const VLayoutPiece &detail) -> VLayoutPiece &
|
||||||
{
|
{
|
||||||
if ( &detail == this )
|
if ( &detail == this )
|
||||||
{
|
{
|
||||||
|
@ -579,7 +605,7 @@ VLayoutPiece::VLayoutPiece(VLayoutPiece &&detail) Q_DECL_NOTHROW
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutPiece &VLayoutPiece::operator=(VLayoutPiece &&detail) Q_DECL_NOTHROW
|
auto VLayoutPiece::operator=(VLayoutPiece &&detail) Q_DECL_NOTHROW -> VLayoutPiece &
|
||||||
{
|
{
|
||||||
VAbstractPiece::operator=(detail);
|
VAbstractPiece::operator=(detail);
|
||||||
std::swap(d, detail.d);
|
std::swap(d, detail.d);
|
||||||
|
@ -588,11 +614,11 @@ VLayoutPiece &VLayoutPiece::operator=(VLayoutPiece &&detail) Q_DECL_NOTHROW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutPiece::~VLayoutPiece()
|
VLayoutPiece::~VLayoutPiece() //NOLINT(modernize-use-equals-default)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutPiece VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContainer *pattern)
|
auto VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContainer *pattern) -> VLayoutPiece
|
||||||
{
|
{
|
||||||
QFuture<QVector<VLayoutPoint> > futureSeamAllowance = QtConcurrent::run(piece, &VPiece::SeamAllowancePoints,
|
QFuture<QVector<VLayoutPoint> > futureSeamAllowance = QtConcurrent::run(piece, &VPiece::SeamAllowancePoints,
|
||||||
pattern);
|
pattern);
|
||||||
|
@ -689,13 +715,13 @@ auto VLayoutPiece::Map(QVector<T> points) const -> QVector<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <>
|
template <> // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name)
|
||||||
QVector<VLayoutPassmark> VLayoutPiece::Map<VLayoutPassmark>(QVector<VLayoutPassmark> passmarks) const
|
auto VLayoutPiece::Map<VLayoutPassmark>(QVector<VLayoutPassmark> passmarks) const -> QVector<VLayoutPassmark>
|
||||||
{
|
{
|
||||||
for (int i = 0; i < passmarks.size(); ++i)
|
for (auto & passmark : passmarks)
|
||||||
{
|
{
|
||||||
passmarks[i].lines = Map(passmarks.at(i).lines);
|
passmark.lines = Map(passmark.lines);
|
||||||
passmarks[i].baseLine = d->m_matrix.map(passmarks.at(i).baseLine);
|
passmark.baseLine = d->m_matrix.map(passmark.baseLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
return passmarks;
|
return passmarks;
|
||||||
|
@ -703,11 +729,11 @@ QVector<VLayoutPassmark> VLayoutPiece::Map<VLayoutPassmark>(QVector<VLayoutPassm
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <>
|
template <>
|
||||||
QVector<VLayoutPoint> VLayoutPiece::Map<VLayoutPoint>(QVector<VLayoutPoint> points) const
|
auto VLayoutPiece::Map<VLayoutPoint>(QVector<VLayoutPoint> points) const -> QVector<VLayoutPoint>
|
||||||
{
|
{
|
||||||
std::transform(points.begin(), points.end(), points.begin(), [this](VLayoutPoint point)
|
std::transform(points.begin(), points.end(), points.begin(), [this](VLayoutPoint point)
|
||||||
{
|
{
|
||||||
auto p = static_cast<QPointF>(point);
|
auto p = static_cast<QPointF>(point); // NOLINT(cppcoreguidelines-slicing)
|
||||||
p = d->m_matrix.map(p);
|
p = d->m_matrix.map(p);
|
||||||
point.rx() = p.x();
|
point.rx() = p.x();
|
||||||
point.ry() = p.y();
|
point.ry() = p.y();
|
||||||
|
@ -722,13 +748,13 @@ QVector<VLayoutPoint> VLayoutPiece::Map<VLayoutPoint>(QVector<VLayoutPoint> poin
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
QVector<VLayoutPoint> VLayoutPiece::GetMappedContourPoints() const
|
auto VLayoutPiece::GetMappedContourPoints() const -> QVector<VLayoutPoint>
|
||||||
{
|
{
|
||||||
return Map(d->m_contour);
|
return Map(d->m_contour);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLayoutPoint> VLayoutPiece::GetContourPoints() const
|
auto VLayoutPiece::GetContourPoints() const -> QVector<VLayoutPoint>
|
||||||
{
|
{
|
||||||
return d->m_contour;
|
return d->m_contour;
|
||||||
}
|
}
|
||||||
|
@ -742,13 +768,13 @@ void VLayoutPiece::SetCountourPoints(const QVector<VLayoutPoint> &points, bool h
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
QVector<VLayoutPoint> VLayoutPiece::GetMappedSeamAllowancePoints() const
|
auto VLayoutPiece::GetMappedSeamAllowancePoints() const -> QVector<VLayoutPoint>
|
||||||
{
|
{
|
||||||
return Map(d->m_seamAllowance);
|
return Map(d->m_seamAllowance);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLayoutPoint> VLayoutPiece::GetSeamAllowancePoints() const
|
auto VLayoutPiece::GetSeamAllowancePoints() const -> QVector<VLayoutPoint>
|
||||||
{
|
{
|
||||||
return d->m_seamAllowance;
|
return d->m_seamAllowance;
|
||||||
}
|
}
|
||||||
|
@ -775,32 +801,30 @@ void VLayoutPiece::SetSeamAllowancePoints(const QVector<VLayoutPoint> &points, b
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QPointF> VLayoutPiece::GetMappedLayoutAllowancePoints() const
|
auto VLayoutPiece::GetMappedLayoutAllowancePoints() const -> QVector<QPointF>
|
||||||
{
|
{
|
||||||
return Map(d->m_layoutAllowance);
|
return Map(d->m_layoutAllowance);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QPointF> VLayoutPiece::GetLayoutAllowancePoints() const
|
auto VLayoutPiece::GetLayoutAllowancePoints() const -> QVector<QPointF>
|
||||||
{
|
{
|
||||||
return d->m_layoutAllowance;
|
return d->m_layoutAllowance;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPointF VLayoutPiece::GetPieceTextPosition() const
|
auto VLayoutPiece::GetPieceTextPosition() const -> QPointF
|
||||||
{
|
{
|
||||||
if (d->m_detailLabel.count() > 2)
|
if (d->m_detailLabel.count() > 2)
|
||||||
{
|
{
|
||||||
return d->m_matrix.map(ConstFirst(d->m_detailLabel));
|
return d->m_matrix.map(ConstFirst(d->m_detailLabel));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return {};
|
||||||
return QPointF();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VLayoutPiece::GetPieceText() const
|
auto VLayoutPiece::GetPieceText() const -> QStringList
|
||||||
{
|
{
|
||||||
return PieceLabelText(d->m_detailLabel, d->m_tmDetail);
|
return PieceLabelText(d->m_detailLabel, d->m_tmDetail);
|
||||||
}
|
}
|
||||||
|
@ -869,20 +893,18 @@ void VLayoutPiece::SetPieceLabelData(const VTextManager &data)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPointF VLayoutPiece::GetPatternTextPosition() const
|
auto VLayoutPiece::GetPatternTextPosition() const -> QPointF
|
||||||
{
|
{
|
||||||
if (d->m_patternInfo.count() > 2)
|
if (d->m_patternInfo.count() > 2)
|
||||||
{
|
{
|
||||||
return d->m_matrix.map(ConstFirst(d->m_patternInfo));
|
return d->m_matrix.map(ConstFirst(d->m_patternInfo));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return {};
|
||||||
return QPointF();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VLayoutPiece::GetPatternText() const
|
auto VLayoutPiece::GetPatternText() const -> QStringList
|
||||||
{
|
{
|
||||||
return PieceLabelText(d->m_patternInfo, d->m_tmPattern);
|
return PieceLabelText(d->m_patternInfo, d->m_tmPattern);
|
||||||
}
|
}
|
||||||
|
@ -970,19 +992,19 @@ void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer* pa
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QPointF> VLayoutPiece::GetMappedGrainline() const
|
auto VLayoutPiece::GetMappedGrainline() const -> QVector<QPointF>
|
||||||
{
|
{
|
||||||
return Map(d->m_grainlinePoints);
|
return Map(d->m_grainlinePoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QPointF> VLayoutPiece::GetGrainline() const
|
auto VLayoutPiece::GetGrainline() const -> QVector<QPointF>
|
||||||
{
|
{
|
||||||
return d->m_grainlinePoints;
|
return d->m_grainlinePoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VLayoutPiece::IsGrainlineEnabled() const
|
auto VLayoutPiece::IsGrainlineEnabled() const -> bool
|
||||||
{
|
{
|
||||||
return d->m_grainlineEnabled;
|
return d->m_grainlineEnabled;
|
||||||
}
|
}
|
||||||
|
@ -1012,19 +1034,19 @@ void VLayoutPiece::SetGrainlinePoints(const QVector<QPointF> &points)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VLayoutPiece::GrainlineAngle() const
|
auto VLayoutPiece::GrainlineAngle() const -> qreal
|
||||||
{
|
{
|
||||||
return d->m_grainlineAngle;
|
return d->m_grainlineAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
GrainlineArrowDirection VLayoutPiece::GrainlineArrowType() const
|
auto VLayoutPiece::GrainlineArrowType() const -> GrainlineArrowDirection
|
||||||
{
|
{
|
||||||
return d->m_grainlineArrowType;
|
return d->m_grainlineArrowType;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QTransform VLayoutPiece::GetMatrix() const
|
auto VLayoutPiece::GetMatrix() const -> QTransform
|
||||||
{
|
{
|
||||||
return d->m_matrix;
|
return d->m_matrix;
|
||||||
}
|
}
|
||||||
|
@ -1036,7 +1058,7 @@ void VLayoutPiece::SetMatrix(const QTransform &matrix)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VLayoutPiece::GetLayoutWidth() const
|
auto VLayoutPiece::GetLayoutWidth() const -> qreal
|
||||||
{
|
{
|
||||||
return d->m_layoutWidth;
|
return d->m_layoutWidth;
|
||||||
}
|
}
|
||||||
|
@ -1048,7 +1070,7 @@ void VLayoutPiece::SetLayoutWidth(qreal value)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint16 VLayoutPiece::GetQuantity() const
|
auto VLayoutPiece::GetQuantity() const -> quint16
|
||||||
{
|
{
|
||||||
return d->m_quantity;
|
return d->m_quantity;
|
||||||
}
|
}
|
||||||
|
@ -1060,7 +1082,7 @@ void VLayoutPiece::SetQuantity(quint16 value)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
vidtype VLayoutPiece::GetId() const
|
auto VLayoutPiece::GetId() const -> vidtype
|
||||||
{
|
{
|
||||||
return d->m_id;
|
return d->m_id;
|
||||||
}
|
}
|
||||||
|
@ -1149,77 +1171,67 @@ void VLayoutPiece::Mirror()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int VLayoutPiece::DetailEdgesCount() const
|
auto VLayoutPiece::DetailEdgesCount() const -> int
|
||||||
{
|
{
|
||||||
return DetailPath().count();
|
return DetailPath().count();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int VLayoutPiece::LayoutEdgesCount() const
|
auto VLayoutPiece::LayoutEdgesCount() const -> int
|
||||||
{
|
{
|
||||||
const int count = d->m_layoutAllowance.count();
|
const int count = d->m_layoutAllowance.count();
|
||||||
return count > 2 ? count : 0;
|
return count > 2 ? count : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QLineF VLayoutPiece::LayoutEdge(int i) const
|
auto VLayoutPiece::LayoutEdge(int i) const -> QLineF
|
||||||
{
|
{
|
||||||
return Edge(d->m_layoutAllowance, i);
|
return Edge(d->m_layoutAllowance, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int VLayoutPiece::LayoutEdgeByPoint(const QPointF &p1) const
|
auto VLayoutPiece::LayoutEdgeByPoint(const QPointF &p1) const -> int
|
||||||
{
|
{
|
||||||
return EdgeByPoint(d->m_layoutAllowance, p1);
|
return EdgeByPoint(d->m_layoutAllowance, p1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QRectF VLayoutPiece::MappedDetailBoundingRect() const
|
auto VLayoutPiece::MappedDetailBoundingRect() const -> QRectF
|
||||||
{
|
{
|
||||||
return BoundingRect(CastTo<QPointF>(GetMappedExternalContourPoints()));
|
return BoundingRect(CastTo<QPointF>(GetMappedExternalContourPoints()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QRectF VLayoutPiece::DetailBoundingRect() const
|
auto VLayoutPiece::DetailBoundingRect() const -> QRectF
|
||||||
{
|
{
|
||||||
return BoundingRect(CastTo<QPointF>(GetExternalContourPoints()));
|
return BoundingRect(CastTo<QPointF>(GetExternalContourPoints()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QRectF VLayoutPiece::MappedLayoutBoundingRect() const
|
auto VLayoutPiece::MappedLayoutBoundingRect() const -> QRectF
|
||||||
{
|
{
|
||||||
return BoundingRect(GetMappedLayoutAllowancePoints());
|
return BoundingRect(GetMappedLayoutAllowancePoints());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VLayoutPiece::Diagonal() const
|
auto VLayoutPiece::Diagonal() const -> qreal
|
||||||
{
|
{
|
||||||
const QRectF rec = MappedLayoutBoundingRect();
|
const QRectF rec = MappedLayoutBoundingRect();
|
||||||
return qSqrt(pow(rec.height(), 2) + pow(rec.width(), 2));
|
return qSqrt(pow(rec.height(), 2) + pow(rec.width(), 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VLayoutPiece::isNull() const
|
auto VLayoutPiece::isNull() const -> bool
|
||||||
{
|
{
|
||||||
if (d->m_contour.isEmpty() == false && d->m_layoutWidth > 0)
|
if (not d->m_contour.isEmpty() && d->m_layoutWidth > 0)
|
||||||
{
|
{
|
||||||
if (IsSeamAllowance() && not IsSeamAllowanceBuiltIn() && d->m_seamAllowance.isEmpty() == false)
|
return not (IsSeamAllowance() && not IsSeamAllowanceBuiltIn() && not d->m_seamAllowance.isEmpty());
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qint64 VLayoutPiece::Square() const
|
auto VLayoutPiece::Square() const -> qint64
|
||||||
{
|
{
|
||||||
return d->m_square;
|
return d->m_square;
|
||||||
}
|
}
|
||||||
|
@ -1261,27 +1273,27 @@ void VLayoutPiece::SetLayoutAllowancePoints()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLayoutPoint> VLayoutPiece::GetMappedExternalContourPoints() const
|
auto VLayoutPiece::GetMappedExternalContourPoints() const -> QVector<VLayoutPoint>
|
||||||
{
|
{
|
||||||
return IsSeamAllowance() && not IsSeamAllowanceBuiltIn() ? GetMappedSeamAllowancePoints() :
|
return IsSeamAllowance() && not IsSeamAllowanceBuiltIn() ? GetMappedSeamAllowancePoints() :
|
||||||
GetMappedContourPoints();
|
GetMappedContourPoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLayoutPoint> VLayoutPiece::GetExternalContourPoints() const
|
auto VLayoutPiece::GetExternalContourPoints() const -> QVector<VLayoutPoint>
|
||||||
{
|
{
|
||||||
return IsSeamAllowance() && not IsSeamAllowanceBuiltIn() ? GetSeamAllowancePoints() :
|
return IsSeamAllowance() && not IsSeamAllowanceBuiltIn() ? GetSeamAllowancePoints() :
|
||||||
GetContourPoints();
|
GetContourPoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLayoutPassmark> VLayoutPiece::GetMappedPassmarks() const
|
auto VLayoutPiece::GetMappedPassmarks() const -> QVector<VLayoutPassmark>
|
||||||
{
|
{
|
||||||
return Map(d->m_passmarks);
|
return Map(d->m_passmarks);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLayoutPassmark> VLayoutPiece::GetPassmarks() const
|
auto VLayoutPiece::GetPassmarks() const -> QVector<VLayoutPassmark>
|
||||||
{
|
{
|
||||||
return d->m_passmarks;
|
return d->m_passmarks;
|
||||||
}
|
}
|
||||||
|
@ -1296,7 +1308,7 @@ void VLayoutPiece::SetPassmarks(const QVector<VLayoutPassmark> &passmarks)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLayoutPlaceLabel> VLayoutPiece::GetPlaceLabels() const
|
auto VLayoutPiece::GetPlaceLabels() const -> QVector<VLayoutPlaceLabel>
|
||||||
{
|
{
|
||||||
return d->m_placeLabels;
|
return d->m_placeLabels;
|
||||||
}
|
}
|
||||||
|
@ -1308,7 +1320,7 @@ void VLayoutPiece::SetPlaceLabels(const QVector<VLayoutPlaceLabel> &labels)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QVector<VLayoutPoint> > VLayoutPiece::MappedInternalPathsForCut(bool cut) const
|
auto VLayoutPiece::MappedInternalPathsForCut(bool cut) const -> QVector<QVector<VLayoutPoint> >
|
||||||
{
|
{
|
||||||
QVector<QVector<VLayoutPoint> > paths;
|
QVector<QVector<VLayoutPoint> > paths;
|
||||||
paths.reserve(d->m_internalPaths.size());
|
paths.reserve(d->m_internalPaths.size());
|
||||||
|
@ -1325,7 +1337,7 @@ QVector<QVector<VLayoutPoint> > VLayoutPiece::MappedInternalPathsForCut(bool cut
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLayoutPiecePath> VLayoutPiece::GetInternalPaths() const
|
auto VLayoutPiece::GetInternalPaths() const -> QVector<VLayoutPiecePath>
|
||||||
{
|
{
|
||||||
return d->m_internalPaths;
|
return d->m_internalPaths;
|
||||||
}
|
}
|
||||||
|
@ -1337,13 +1349,13 @@ void VLayoutPiece::SetInternalPaths(const QVector<VLayoutPiecePath> &internalPat
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPainterPath VLayoutPiece::MappedContourPath() const
|
auto VLayoutPiece::MappedContourPath() const -> QPainterPath
|
||||||
{
|
{
|
||||||
return d->m_matrix.map(ContourPath());
|
return d->m_matrix.map(ContourPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPainterPath VLayoutPiece::ContourPath() const
|
auto VLayoutPiece::ContourPath() const -> QPainterPath
|
||||||
{
|
{
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
|
|
||||||
|
@ -1396,7 +1408,7 @@ QPainterPath VLayoutPiece::ContourPath() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPainterPath VLayoutPiece::MappedLayoutAllowancePath() const
|
auto VLayoutPiece::MappedLayoutAllowancePath() const -> QPainterPath
|
||||||
{
|
{
|
||||||
return PainterPath(GetMappedLayoutAllowancePoints());
|
return PainterPath(GetMappedLayoutAllowancePoints());
|
||||||
}
|
}
|
||||||
|
@ -1438,7 +1450,7 @@ void VLayoutPiece::DrawMiniature(QPainter &painter) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QGraphicsItem *VLayoutPiece::GetItem(bool textAsPaths) const
|
auto VLayoutPiece::GetItem(bool textAsPaths) const -> QGraphicsItem *
|
||||||
{
|
{
|
||||||
QGraphicsPathItem *item = GetMainItem();
|
QGraphicsPathItem *item = GetMainItem();
|
||||||
|
|
||||||
|
@ -1470,7 +1482,7 @@ QGraphicsItem *VLayoutPiece::GetItem(bool textAsPaths) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VLayoutPiece::IsLayoutAllowanceValid() const
|
auto VLayoutPiece::IsLayoutAllowanceValid() const -> bool
|
||||||
{
|
{
|
||||||
QVector<VLayoutPoint> base = (IsSeamAllowance() && not IsSeamAllowanceBuiltIn()) ?
|
QVector<VLayoutPoint> base = (IsSeamAllowance() && not IsSeamAllowanceBuiltIn()) ?
|
||||||
d->m_seamAllowance : d->m_contour;
|
d->m_seamAllowance : d->m_contour;
|
||||||
|
@ -1478,7 +1490,7 @@ bool VLayoutPiece::IsLayoutAllowanceValid() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VLayoutPiece::BiggestEdge() const
|
auto VLayoutPiece::BiggestEdge() const -> qreal
|
||||||
{
|
{
|
||||||
qreal edge = 0;
|
qreal edge = 0;
|
||||||
|
|
||||||
|
@ -1501,18 +1513,18 @@ qreal VLayoutPiece::BiggestEdge() const
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
PlaceLabelImg VLayoutPiece::MapPlaceLabelShape(PlaceLabelImg shape) const
|
auto VLayoutPiece::MapPlaceLabelShape(PlaceLabelImg shape) const -> PlaceLabelImg
|
||||||
{
|
{
|
||||||
for (int i = 0; i < shape.size(); ++i)
|
for (auto & i : shape)
|
||||||
{
|
{
|
||||||
shape[i] = Map(shape.at(i));
|
i = Map(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QRectF VLayoutPiece::BoundingRect(QVector<QPointF> points)
|
auto VLayoutPiece::BoundingRect(QVector<QPointF> points) -> QRectF
|
||||||
{
|
{
|
||||||
points.append(ConstFirst(points));
|
points.append(ConstFirst(points));
|
||||||
return QPolygonF(points).boundingRect();
|
return QPolygonF(points).boundingRect();
|
||||||
|
@ -1524,8 +1536,11 @@ void VLayoutPiece::CreateLabelStrings(QGraphicsItem *parent, const QVector<QPoin
|
||||||
{
|
{
|
||||||
SCASSERT(parent != nullptr)
|
SCASSERT(parent != nullptr)
|
||||||
|
|
||||||
if (labelShape.count() > 2)
|
if (labelShape.count() <= 2)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const qreal dW = QLineF(labelShape.at(0), labelShape.at(1)).length();
|
const qreal dW = QLineF(labelShape.at(0), labelShape.at(1)).length();
|
||||||
const qreal dH = QLineF(labelShape.at(1), labelShape.at(2)).length();
|
const qreal dH = QLineF(labelShape.at(1), labelShape.at(2)).length();
|
||||||
const qreal angle = - QLineF(labelShape.at(0), labelShape.at(1)).angle();
|
const qreal angle = - QLineF(labelShape.at(0), labelShape.at(1)).angle();
|
||||||
|
@ -1533,7 +1548,6 @@ void VLayoutPiece::CreateLabelStrings(QGraphicsItem *parent, const QVector<QPoin
|
||||||
|
|
||||||
for (int i = 0; i < tm.GetSourceLinesCount(); ++i)
|
for (int i = 0; i < tm.GetSourceLinesCount(); ++i)
|
||||||
{
|
{
|
||||||
|
|
||||||
const TextLine& tl = tm.GetSourceLine(i);
|
const TextLine& tl = tm.GetSourceLine(i);
|
||||||
QFont fnt = tm.GetFont();
|
QFont fnt = tm.GetFont();
|
||||||
fnt.setPixelSize(tm.GetFont().pixelSize() + tl.m_iFontSize);
|
fnt.setPixelSize(tm.GetFont().pixelSize() + tl.m_iFontSize);
|
||||||
|
@ -1612,7 +1626,6 @@ void VLayoutPiece::CreateLabelStrings(QGraphicsItem *parent, const QVector<QPoin
|
||||||
dY += (fm.height() + tm.GetSpacing());
|
dY += (fm.height() + tm.GetSpacing());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1639,7 +1652,7 @@ void VLayoutPiece::CreateGrainlineItem(QGraphicsItem *parent) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLayoutPoint> VLayoutPiece::DetailPath() const
|
auto VLayoutPiece::DetailPath() const -> QVector<VLayoutPoint>
|
||||||
{
|
{
|
||||||
if (IsSeamAllowance() && not IsSeamAllowanceBuiltIn())
|
if (IsSeamAllowance() && not IsSeamAllowanceBuiltIn())
|
||||||
{
|
{
|
||||||
|
@ -1650,9 +1663,9 @@ QVector<VLayoutPoint> VLayoutPiece::DetailPath() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QGraphicsPathItem *VLayoutPiece::GetMainItem() const
|
auto VLayoutPiece::GetMainItem() const -> QGraphicsPathItem *
|
||||||
{
|
{
|
||||||
QGraphicsPathItem *item = new QGraphicsPathItem();
|
auto *item = new QGraphicsPathItem();
|
||||||
QPen pen = item->pen();
|
QPen pen = item->pen();
|
||||||
pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
|
pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
|
||||||
item->setPen(pen);
|
item->setPen(pen);
|
||||||
|
@ -1661,9 +1674,9 @@ QGraphicsPathItem *VLayoutPiece::GetMainItem() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QGraphicsPathItem *VLayoutPiece::GetMainPathItem() const
|
auto VLayoutPiece::GetMainPathItem() const -> QGraphicsPathItem *
|
||||||
{
|
{
|
||||||
QGraphicsPathItem *item = new QGraphicsPathItem();
|
auto *item = new QGraphicsPathItem();
|
||||||
QPen pen = item->pen();
|
QPen pen = item->pen();
|
||||||
pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
|
pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
|
||||||
item->setPen(pen);
|
item->setPen(pen);
|
||||||
|
@ -1685,7 +1698,7 @@ QGraphicsPathItem *VLayoutPiece::GetMainPathItem() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VLayoutPiece::IsMirror() const
|
auto VLayoutPiece::IsMirror() const -> bool
|
||||||
{
|
{
|
||||||
return d->m_mirror;
|
return d->m_mirror;
|
||||||
}
|
}
|
||||||
|
@ -1733,11 +1746,11 @@ void VLayoutPiece::SetYScale(qreal ys)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QLineF VLayoutPiece::Edge(const QVector<QPointF> &path, int i) const
|
auto VLayoutPiece::Edge(const QVector<QPointF> &path, int i) const -> QLineF
|
||||||
{
|
{
|
||||||
if (i < 1)
|
if (i < 1)
|
||||||
{ // Doesn't exist such edge
|
{ // Doesn't exist such edge
|
||||||
return QLineF();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
int i1, i2;
|
int i1, i2;
|
||||||
|
@ -1755,17 +1768,14 @@ QLineF VLayoutPiece::Edge(const QVector<QPointF> &path, int i) const
|
||||||
if (d->m_mirror)
|
if (d->m_mirror)
|
||||||
{
|
{
|
||||||
QVector<QPointF> newPath = Map(path);
|
QVector<QPointF> newPath = Map(path);
|
||||||
return QLineF(newPath.at(i1), newPath.at(i2));
|
return {newPath.at(i1), newPath.at(i2)};
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return QLineF(d->m_matrix.map(path.at(i1)), d->m_matrix.map(path.at(i2)));
|
|
||||||
}
|
}
|
||||||
|
return {d->m_matrix.map(path.at(i1)), d->m_matrix.map(path.at(i2))};
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// NOTE: Once C++17 is made mandatory, this method can further be refactored with std::optional<int>
|
// NOTE: Once C++17 is made mandatory, this method can further be refactored with std::optional<int>
|
||||||
int VLayoutPiece::EdgeByPoint(const QVector<QPointF> &path, const QPointF &p1) const
|
auto VLayoutPiece::EdgeByPoint(const QVector<QPointF> &path, const QPointF &p1) const -> int
|
||||||
{
|
{
|
||||||
if (p1.isNull() || path.count() < 3)
|
if (p1.isNull() || path.count() < 3)
|
||||||
{
|
{
|
||||||
|
@ -1773,7 +1783,7 @@ int VLayoutPiece::EdgeByPoint(const QVector<QPointF> &path, const QPointF &p1) c
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto points = Map(path);
|
const auto points = Map(path);
|
||||||
const auto posIter = std::find_if(points.cbegin(), points.cend(),
|
const auto *const posIter = std::find_if(points.cbegin(), points.cend(),
|
||||||
[&p1](const QPointF &point){ return VFuzzyComparePoints(point, p1); });
|
[&p1](const QPointF &point){ return VFuzzyComparePoints(point, p1); });
|
||||||
if (posIter != points.cend())
|
if (posIter != points.cend())
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,74 +68,74 @@ public:
|
||||||
VLayoutPiece();
|
VLayoutPiece();
|
||||||
VLayoutPiece(const VLayoutPiece &detail);
|
VLayoutPiece(const VLayoutPiece &detail);
|
||||||
|
|
||||||
virtual ~VLayoutPiece() override;
|
~VLayoutPiece() override;
|
||||||
|
|
||||||
VLayoutPiece &operator=(const VLayoutPiece &detail);
|
auto operator=(const VLayoutPiece &detail) -> VLayoutPiece &;
|
||||||
#ifdef Q_COMPILER_RVALUE_REFS
|
#ifdef Q_COMPILER_RVALUE_REFS
|
||||||
VLayoutPiece(VLayoutPiece &&detail) Q_DECL_NOTHROW;
|
VLayoutPiece(VLayoutPiece &&detail) Q_DECL_NOTHROW;
|
||||||
VLayoutPiece &operator=(VLayoutPiece &&detail) Q_DECL_NOTHROW;
|
auto operator=(VLayoutPiece &&detail) Q_DECL_NOTHROW -> VLayoutPiece &;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static VLayoutPiece Create(const VPiece &piece, vidtype id, const VContainer *pattern);
|
static auto Create(const VPiece &piece, vidtype id, const VContainer *pattern) -> VLayoutPiece;
|
||||||
|
|
||||||
virtual auto GetUniqueID() const -> QString override;
|
auto GetUniqueID() const -> QString override;
|
||||||
|
|
||||||
QVector<VLayoutPoint> GetMappedContourPoints() const;
|
auto GetMappedContourPoints() const -> QVector<VLayoutPoint>;
|
||||||
QVector<VLayoutPoint> GetContourPoints() const;
|
auto GetContourPoints() const -> QVector<VLayoutPoint>;
|
||||||
void SetCountourPoints(const QVector<VLayoutPoint> &points, bool hideMainPath = false);
|
void SetCountourPoints(const QVector<VLayoutPoint> &points, bool hideMainPath = false);
|
||||||
|
|
||||||
QVector<VLayoutPoint> GetMappedSeamAllowancePoints() const;
|
auto GetMappedSeamAllowancePoints() const -> QVector<VLayoutPoint>;
|
||||||
QVector<VLayoutPoint> GetSeamAllowancePoints() const;
|
auto GetSeamAllowancePoints() const -> QVector<VLayoutPoint>;
|
||||||
void SetSeamAllowancePoints(const QVector<VLayoutPoint> &points, bool seamAllowance = true,
|
void SetSeamAllowancePoints(const QVector<VLayoutPoint> &points, bool seamAllowance = true,
|
||||||
bool seamAllowanceBuiltIn = false);
|
bool seamAllowanceBuiltIn = false);
|
||||||
|
|
||||||
QVector<QPointF> GetMappedLayoutAllowancePoints() const;
|
auto GetMappedLayoutAllowancePoints() const -> QVector<QPointF>;
|
||||||
QVector<QPointF> GetLayoutAllowancePoints() const;
|
auto GetLayoutAllowancePoints() const -> QVector<QPointF>;
|
||||||
void SetLayoutAllowancePoints();
|
void SetLayoutAllowancePoints();
|
||||||
|
|
||||||
QVector<VLayoutPoint> GetMappedExternalContourPoints() const;
|
auto GetMappedExternalContourPoints() const -> QVector<VLayoutPoint>;
|
||||||
QVector<VLayoutPoint> GetExternalContourPoints() const;
|
auto GetExternalContourPoints() const -> QVector<VLayoutPoint>;
|
||||||
|
|
||||||
QVector<VLayoutPassmark> GetMappedPassmarks() const;
|
auto GetMappedPassmarks() const -> QVector<VLayoutPassmark>;
|
||||||
QVector<VLayoutPassmark> GetPassmarks() const;
|
auto GetPassmarks() const -> QVector<VLayoutPassmark>;
|
||||||
void SetPassmarks(const QVector<VLayoutPassmark> &passmarks);
|
void SetPassmarks(const QVector<VLayoutPassmark> &passmarks);
|
||||||
|
|
||||||
QVector<VLayoutPlaceLabel> GetPlaceLabels() const;
|
auto GetPlaceLabels() const -> QVector<VLayoutPlaceLabel>;
|
||||||
void SetPlaceLabels(const QVector<VLayoutPlaceLabel> &labels);
|
void SetPlaceLabels(const QVector<VLayoutPlaceLabel> &labels);
|
||||||
|
|
||||||
QVector<QVector<VLayoutPoint> > MappedInternalPathsForCut(bool cut) const;
|
auto MappedInternalPathsForCut(bool cut) const -> QVector<QVector<VLayoutPoint> >;
|
||||||
QVector<VLayoutPiecePath> GetInternalPaths() const;
|
auto GetInternalPaths() const -> QVector<VLayoutPiecePath>;
|
||||||
void SetInternalPaths(const QVector<VLayoutPiecePath> &internalPaths);
|
void SetInternalPaths(const QVector<VLayoutPiecePath> &internalPaths);
|
||||||
|
|
||||||
QPointF GetPieceTextPosition() const;
|
auto GetPieceTextPosition() const -> QPointF;
|
||||||
QStringList GetPieceText() const;
|
auto GetPieceText() const -> QStringList;
|
||||||
void SetPieceText(const QString &qsName, const VPieceLabelData& data, const QFont& font, const VContainer *pattern);
|
void SetPieceText(const QString &qsName, const VPieceLabelData& data, const QFont& font, const VContainer *pattern);
|
||||||
|
|
||||||
QPointF GetPatternTextPosition() const;
|
auto GetPatternTextPosition() const -> QPointF;
|
||||||
QStringList GetPatternText() const;
|
auto GetPatternText() const -> QStringList;
|
||||||
void SetPatternInfo(VAbstractPattern *pDoc, const VPatternLabelData& geom, const QFont& font,
|
void SetPatternInfo(VAbstractPattern *pDoc, const VPatternLabelData& geom, const QFont& font,
|
||||||
const VContainer *pattern);
|
const VContainer *pattern);
|
||||||
|
|
||||||
void SetGrainline(const VGrainlineData& geom, const VContainer *pattern);
|
void SetGrainline(const VGrainlineData& geom, const VContainer *pattern);
|
||||||
QVector<QPointF> GetMappedGrainline() const;
|
auto GetMappedGrainline() const -> QVector<QPointF>;
|
||||||
QVector<QPointF> GetGrainline() const;
|
auto GetGrainline() const -> QVector<QPointF>;
|
||||||
bool IsGrainlineEnabled() const;
|
auto IsGrainlineEnabled() const -> bool;
|
||||||
qreal GrainlineAngle() const;
|
auto GrainlineAngle() const -> qreal;
|
||||||
GrainlineArrowDirection GrainlineArrowType() const;
|
auto GrainlineArrowType() const -> GrainlineArrowDirection;
|
||||||
|
|
||||||
QTransform GetMatrix() const;
|
auto GetMatrix() const -> QTransform;
|
||||||
void SetMatrix(const QTransform &matrix);
|
void SetMatrix(const QTransform &matrix);
|
||||||
|
|
||||||
qreal GetLayoutWidth() const;
|
auto GetLayoutWidth() const -> qreal;
|
||||||
void SetLayoutWidth(qreal value);
|
void SetLayoutWidth(qreal value);
|
||||||
|
|
||||||
quint16 GetQuantity() const;
|
auto GetQuantity() const -> quint16;
|
||||||
void SetQuantity(quint16 value);
|
void SetQuantity(quint16 value);
|
||||||
|
|
||||||
vidtype GetId() const;
|
auto GetId() const -> vidtype;
|
||||||
void SetId(vidtype id);
|
void SetId(vidtype id);
|
||||||
|
|
||||||
bool IsMirror() const;
|
auto IsMirror() const -> bool;
|
||||||
void SetMirror(bool value);
|
void SetMirror(bool value);
|
||||||
|
|
||||||
void SetGradationId(const QString &id);
|
void SetGradationId(const QString &id);
|
||||||
|
@ -154,36 +154,36 @@ public:
|
||||||
void Mirror(const QLineF &edge);
|
void Mirror(const QLineF &edge);
|
||||||
void Mirror();
|
void Mirror();
|
||||||
|
|
||||||
int DetailEdgesCount() const;
|
auto DetailEdgesCount() const -> int;
|
||||||
int LayoutEdgesCount() const;
|
auto LayoutEdgesCount() const -> int;
|
||||||
|
|
||||||
QLineF LayoutEdge(int i) const;
|
auto LayoutEdge(int i) const -> QLineF;
|
||||||
int LayoutEdgeByPoint(const QPointF &p1) const;
|
auto LayoutEdgeByPoint(const QPointF &p1) const -> int;
|
||||||
|
|
||||||
QRectF MappedDetailBoundingRect() const;
|
auto MappedDetailBoundingRect() const -> QRectF;
|
||||||
QRectF DetailBoundingRect() const;
|
auto DetailBoundingRect() const -> QRectF;
|
||||||
QRectF MappedLayoutBoundingRect() const;
|
auto MappedLayoutBoundingRect() const -> QRectF;
|
||||||
qreal Diagonal() const;
|
auto Diagonal() const -> qreal;
|
||||||
|
|
||||||
static QRectF BoundingRect(QVector<QPointF> points);
|
static auto BoundingRect(QVector<QPointF> points) -> QRectF;
|
||||||
|
|
||||||
bool isNull() const;
|
auto isNull() const -> bool;
|
||||||
qint64 Square() const;
|
auto Square() const -> qint64;
|
||||||
|
|
||||||
QPainterPath MappedContourPath() const;
|
auto MappedContourPath() const -> QPainterPath;
|
||||||
QPainterPath ContourPath() const;
|
auto ContourPath() const -> QPainterPath;
|
||||||
QPainterPath MappedLayoutAllowancePath() const;
|
auto MappedLayoutAllowancePath() const -> QPainterPath;
|
||||||
|
|
||||||
void DrawMiniature(QPainter &painter) const;
|
void DrawMiniature(QPainter &painter) const;
|
||||||
|
|
||||||
Q_REQUIRED_RESULT QGraphicsItem *GetItem(bool textAsPaths) const;
|
Q_REQUIRED_RESULT auto GetItem(bool textAsPaths) const -> QGraphicsItem *;
|
||||||
|
|
||||||
bool IsLayoutAllowanceValid() const;
|
auto IsLayoutAllowanceValid() const -> bool;
|
||||||
|
|
||||||
qreal BiggestEdge() const;
|
auto BiggestEdge() const -> qreal;
|
||||||
|
|
||||||
friend QDataStream& operator<< (QDataStream& dataStream, const VLayoutPiece& piece);
|
friend auto operator<< (QDataStream& dataStream, const VLayoutPiece& piece) -> QDataStream&;
|
||||||
friend QDataStream& operator>> (QDataStream& dataStream, VLayoutPiece& piece);
|
friend auto operator>> (QDataStream& dataStream, VLayoutPiece& piece) -> QDataStream&;
|
||||||
|
|
||||||
auto MapPlaceLabelShape(PlaceLabelImg shape) const -> PlaceLabelImg;
|
auto MapPlaceLabelShape(PlaceLabelImg shape) const -> PlaceLabelImg;
|
||||||
|
|
||||||
|
@ -208,20 +208,20 @@ protected:
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<VLayoutPieceData> d;
|
QSharedDataPointer<VLayoutPieceData> d;
|
||||||
|
|
||||||
QVector<VLayoutPoint> DetailPath() const;
|
auto DetailPath() const -> QVector<VLayoutPoint>;
|
||||||
|
|
||||||
Q_REQUIRED_RESULT QGraphicsPathItem *GetMainItem() const;
|
Q_REQUIRED_RESULT auto GetMainItem() const -> QGraphicsPathItem *;
|
||||||
Q_REQUIRED_RESULT QGraphicsPathItem *GetMainPathItem() const;
|
Q_REQUIRED_RESULT auto GetMainPathItem() const -> QGraphicsPathItem *;
|
||||||
|
|
||||||
void CreateLabelStrings(QGraphicsItem *parent, const QVector<QPointF> &labelShape, const VTextManager &tm,
|
void CreateLabelStrings(QGraphicsItem *parent, const QVector<QPointF> &labelShape, const VTextManager &tm,
|
||||||
bool textAsPaths) const;
|
bool textAsPaths) const;
|
||||||
void CreateGrainlineItem(QGraphicsItem *parent) const;
|
void CreateGrainlineItem(QGraphicsItem *parent) const;
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
QVector<T> Map(QVector<T> points) const;
|
auto Map(QVector<T> points) const -> QVector<T>;
|
||||||
|
|
||||||
QLineF Edge(const QVector<QPointF> &path, int i) const;
|
auto Edge(const QVector<QPointF> &path, int i) const -> QLineF;
|
||||||
int EdgeByPoint(const QVector<QPointF> &path, const QPointF &p1) const;
|
auto EdgeByPoint(const QVector<QPointF> &path, const QPointF &p1) const -> int;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
Loading…
Reference in New Issue
Block a user