diff --git a/src/app/puzzle/layout/vppiece.cpp b/src/app/puzzle/layout/vppiece.cpp index e3f166948..1632d47f0 100644 --- a/src/app/puzzle/layout/vppiece.cpp +++ b/src/app/puzzle/layout/vppiece.cpp @@ -149,7 +149,7 @@ void VPPiece::Update(const VPPiecePtr &piece) } SetName(piece->GetName()); - SetCountourPoints(piece->GetContourPoints(), piece->IsHideMainPath()); + SetContourPoints(piece->GetContourPoints(), piece->IsHideMainPath()); SetSeamAllowancePoints(piece->GetSeamAllowancePoints(), piece->IsSeamAllowance(), piece->IsSeamAllowanceBuiltIn()); SetInternalPaths(piece->GetInternalPaths()); SetPassmarks(piece->GetPassmarks()); diff --git a/src/app/puzzle/xml/vplayoutfilereader.cpp b/src/app/puzzle/xml/vplayoutfilereader.cpp index d6e04bcad..d3734fc4e 100644 --- a/src/app/puzzle/xml/vplayoutfilereader.cpp +++ b/src/app/puzzle/xml/vplayoutfilereader.cpp @@ -556,7 +556,7 @@ auto VPLayoutFileReader::ReadLayoutPoints() -> QVector void VPLayoutFileReader::ReadSeamLine(const VPPiecePtr &piece) { AssertRootTag(ML::TagSeamLine); - piece->SetCountourPoints(ReadLayoutPoints()); + piece->SetContourPoints(ReadLayoutPoints()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index dbf66a35e..63ec5c778 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -4057,8 +4057,8 @@ void VPattern::ParsePathElement(VMainGraphicsScene *scene, QDomElement &domEleme if (initData.path.GetType() == PiecePathType::InternalPath) { initData.path.SetCutPath(GetParametrBool(domElement, AttrCut, falseStr)); - initData.path.SetFirstToCuttingCountour(GetParametrBool(domElement, AttrFirstToCountour, falseStr)); - initData.path.SetLastToCuttingCountour(GetParametrBool(domElement, AttrLastToCountour, falseStr)); + initData.path.SetFirstToCuttingContour(GetParametrBool(domElement, AttrFirstToContour, falseStr)); + initData.path.SetLastToCuttingContour(GetParametrBool(domElement, AttrLastToContour, falseStr)); initData.path.SetVisibilityTrigger(GetParametrString(domElement, AttrVisible, QChar('1'))); } diff --git a/src/libs/ifc/ifcdef.cpp b/src/libs/ifc/ifcdef.cpp index 3494d0e5f..1063320a2 100644 --- a/src/libs/ifc/ifcdef.cpp +++ b/src/libs/ifc/ifcdef.cpp @@ -137,8 +137,8 @@ const QString AttrWidth = QStringLiteral("width"); const QString AttrHeight = QStringLiteral("height"); const QString AttrPlaceLabelType = QStringLiteral("placeLabelType"); const QString AttrVersion = QStringLiteral("version"); -const QString AttrFirstToCountour = QStringLiteral("firstToCountour"); -const QString AttrLastToCountour = QStringLiteral("lastToCountour"); +const QString AttrFirstToContour = QStringLiteral("firstToContour"); +const QString AttrLastToContour = QStringLiteral("lastToContour"); const QString AttrNotes = QStringLiteral("notes"); const QString AttrAlias = QStringLiteral("alias"); const QString AttrAlias1 = QStringLiteral("alias1"); diff --git a/src/libs/ifc/ifcdef.h b/src/libs/ifc/ifcdef.h index 3ef04aa29..7ce66fbe9 100644 --- a/src/libs/ifc/ifcdef.h +++ b/src/libs/ifc/ifcdef.h @@ -156,8 +156,8 @@ extern const QString AttrWidth; extern const QString AttrHeight; extern const QString AttrPlaceLabelType; extern const QString AttrVersion; -extern const QString AttrFirstToCountour; -extern const QString AttrLastToCountour; +extern const QString AttrFirstToContour; +extern const QString AttrLastToContour; extern const QString AttrNotes; extern const QString AttrAlias; extern const QString AttrAlias1; diff --git a/src/libs/ifc/schema/pattern/v0.9.2.xsd b/src/libs/ifc/schema/pattern/v0.9.2.xsd index 1dbc44128..2c1b42b19 100644 --- a/src/libs/ifc/schema/pattern/v0.9.2.xsd +++ b/src/libs/ifc/schema/pattern/v0.9.2.xsd @@ -441,8 +441,8 @@ - - + + diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index b55095018..cc1e5de88 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -169,6 +169,10 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCutNumber, (QLatin1String("cutNumber Q_GLOBAL_STATIC_WITH_ARGS(const QString, strQuantity, (QLatin1String("quantity"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, strExtension, (QLatin1String("extension"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, strContentType, (QLatin1String("contentType"))) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFirstToCountour, (QLatin1String("firstToCountour"))) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFirstToContour, (QLatin1String("firstToContour"))) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLastToCountour, (QLatin1String("lastToCountour"))) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLastToContour, (QLatin1String("lastToContour"))) // NOLINT } // anonymous namespace //--------------------------------------------------------------------------------------------------------------------- @@ -574,6 +578,7 @@ void VPatternConverter::ToV0_9_2() Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 2), "Time to refactor the code."); + ConvertPathAttributesToV0_9_2(); SetVersion(QStringLiteral("0.9.2")); Save(); } @@ -2218,6 +2223,37 @@ void VPatternConverter::ConvertMeasurementsPathToV0_9_1() } } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::ConvertPathAttributesToV0_9_2() +{ + // TODO. Delete if minimal supported version is 0.9.2 + Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 2), + "Time to refactor the code."); + + const QDomNodeList paths = this->elementsByTagName(*strPath); + for (int i=0; i < paths.size(); ++i) + { + QDomElement domElement = paths.at(i).toElement(); + + if (domElement.isNull()) + { + continue; + } + + if (domElement.hasAttribute(*strFirstToCountour)) + { + domElement.setAttribute(*strFirstToContour, domElement.attribute(*strFirstToCountour)); + domElement.removeAttribute(*strFirstToCountour); + } + + if (domElement.hasAttribute(*strLastToCountour)) + { + domElement.setAttribute(*strLastToContour, domElement.attribute(*strLastToCountour)); + domElement.removeAttribute(*strLastToCountour); + } + } +} + //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::TagUnionDetailsToV0_4_0() { diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index a0a669938..a52c9aed1 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -146,6 +146,8 @@ private: void ConvertImageToV0_9_0(); void ConvertMeasurementsPathToV0_9_1(); + + void ConvertPathAttributesToV0_9_2(); }; //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vlayout/vcontour.cpp b/src/libs/vlayout/vcontour.cpp index 0800698bf..e0728841c 100644 --- a/src/libs/vlayout/vcontour.cpp +++ b/src/libs/vlayout/vcontour.cpp @@ -295,7 +295,7 @@ QLineF VContour::GlobalEdge(int i) const edge = QLineF(d->globalContour.at(i-1), d->globalContour.at(i)); } else - { // Closed countour + { // Closed contour edge = QLineF(d->globalContour.at(GlobalEdgesCount()-1), d->globalContour.at(0)); } } diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index d8557c21b..2eb9bae11 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -654,7 +654,7 @@ auto VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContainer *pat qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; } - det.SetCountourPoints(futureMainPath.result(), + det.SetContourPoints(futureMainPath.result(), VAbstractApplication::VApp()->Settings()->IsPieceShowMainPath() ? false : piece.IsHideMainPath()); det.SetSeamAllowancePoints(futureSeamAllowance.result(), piece.IsSeamAllowance(), piece.IsSeamAllowanceBuiltIn()); @@ -764,7 +764,7 @@ auto VLayoutPiece::GetContourPoints() const -> QVector } //--------------------------------------------------------------------------------------------------------------------- -void VLayoutPiece::SetCountourPoints(const QVector &points, bool hideMainPath) +void VLayoutPiece::SetContourPoints(const QVector &points, bool hideMainPath) { d->m_contour = RemoveDublicates(points, false); SetHideMainPath(hideMainPath); diff --git a/src/libs/vlayout/vlayoutpiece.h b/src/libs/vlayout/vlayoutpiece.h index 6a1ff8e2b..9271f78ef 100644 --- a/src/libs/vlayout/vlayoutpiece.h +++ b/src/libs/vlayout/vlayoutpiece.h @@ -82,7 +82,7 @@ public: auto GetMappedContourPoints() const -> QVector; auto GetContourPoints() const -> QVector; - void SetCountourPoints(const QVector &points, bool hideMainPath = false); + void SetContourPoints(const QVector &points, bool hideMainPath = false); auto GetMappedSeamAllowancePoints() const -> QVector; auto GetSeamAllowancePoints() const -> QVector; diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index 9bbbaeb2c..2c9e38404 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -1243,7 +1243,7 @@ void VPiece::TestInternalPathCuttingPathIntersection(const VContainer *data) con if (internalPath.intersects(contourPath)) { const QString errorMsg = QObject::tr("Piece '%1'. Internal path '%2' intersects with cutting " - "countour.").arg(GetName(), path.GetName()); + "contour.").arg(GetName(), path.GetName()); VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; continue; @@ -1252,7 +1252,7 @@ void VPiece::TestInternalPathCuttingPathIntersection(const VContainer *data) con if (not contourPath.contains(internalPath)) { const QString errorMsg = QObject::tr("Piece '%1'. Internal path '%2' not inside of cutting " - "countour.").arg(GetName(), path.GetName()); + "contour.").arg(GetName(), path.GetName()); VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; } diff --git a/src/libs/vpatterndb/vpiecepath.cpp b/src/libs/vpatterndb/vpiecepath.cpp index 8860d9c1d..a1779d89f 100644 --- a/src/libs/vpatterndb/vpiecepath.cpp +++ b/src/libs/vpatterndb/vpiecepath.cpp @@ -198,7 +198,7 @@ qreal FindTipDirection(const QVector &points) } //--------------------------------------------------------------------------------------------------------------------- -bool IntersectionWithCuttingCountour(const QVector &cuttingPath, const QVector &points, +bool IntersectionWithCuttingContour(const QVector &cuttingPath, const QVector &points, QPointF *connection) { if (points.size() <= 1) @@ -209,7 +209,7 @@ bool IntersectionWithCuttingCountour(const QVector &cuttingPath, const const QPointF &first = ConstFirst(points); if (VAbstractCurve::IsPointOnCurve(cuttingPath, first)) - { // Point is already part of a cutting countour + { // Point is already part of a cutting contour *connection = first; return true; } @@ -390,27 +390,27 @@ void VPiecePath::SetVisibilityTrigger(const QString &formula) } //--------------------------------------------------------------------------------------------------------------------- -void VPiecePath::SetFirstToCuttingCountour(bool value) +void VPiecePath::SetFirstToCuttingContour(bool value) { - d->m_firstToCuttingCountour = value; + d->m_firstToCuttingContour = value; } //--------------------------------------------------------------------------------------------------------------------- -bool VPiecePath::IsFirstToCuttingCountour() const +bool VPiecePath::IsFirstToCuttingContour() const { - return d->m_firstToCuttingCountour; + return d->m_firstToCuttingContour; } //--------------------------------------------------------------------------------------------------------------------- -void VPiecePath::SetLastToCuttingCountour(bool value) +void VPiecePath::SetLastToCuttingContour(bool value) { - d->m_lastToCuttingCountour = value; + d->m_lastToCuttingContour = value; } //--------------------------------------------------------------------------------------------------------------------- -bool VPiecePath::IsLastToCuttingCountour() const +bool VPiecePath::IsLastToCuttingContour() const { - return d->m_lastToCuttingCountour; + return d->m_lastToCuttingContour; } //--------------------------------------------------------------------------------------------------------------------- @@ -422,10 +422,10 @@ QVector VPiecePath::PathPoints(const VContainer *data, const QVect { QVector extended = points; - if (IsFirstToCuttingCountour()) + if (IsFirstToCuttingContour()) { VLayoutPoint firstConnection; - if (IntersectionWithCuttingCountour(cuttingPath, points, &firstConnection)) + if (IntersectionWithCuttingContour(cuttingPath, points, &firstConnection)) { firstConnection.SetTurnPoint(true); extended.prepend(firstConnection); @@ -433,17 +433,17 @@ QVector VPiecePath::PathPoints(const VContainer *data, const QVect else { const QString errorMsg = QObject::tr("Error in internal path '%1'. There is no intersection of first " - "point with cutting countour") + "point with cutting contour") .arg(GetName()); VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; } } - if (IsLastToCuttingCountour()) + if (IsLastToCuttingContour()) { VLayoutPoint lastConnection; - if (IntersectionWithCuttingCountour(cuttingPath, Reverse(points), &lastConnection)) + if (IntersectionWithCuttingContour(cuttingPath, Reverse(points), &lastConnection)) { lastConnection.SetTurnPoint(true); extended.append(lastConnection); @@ -451,7 +451,7 @@ QVector VPiecePath::PathPoints(const VContainer *data, const QVect else { const QString errorMsg = QObject::tr("Error in internal path '%1'. There is no intersection of last " - "point with cutting countour") + "point with cutting contour") .arg(GetName()); VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; diff --git a/src/libs/vpatterndb/vpiecepath.h b/src/libs/vpatterndb/vpiecepath.h index 21c878e98..d2693e472 100644 --- a/src/libs/vpatterndb/vpiecepath.h +++ b/src/libs/vpatterndb/vpiecepath.h @@ -84,11 +84,11 @@ public: QString GetVisibilityTrigger() const; void SetVisibilityTrigger(const QString &formula); - void SetFirstToCuttingCountour(bool value); - bool IsFirstToCuttingCountour() const; + void SetFirstToCuttingContour(bool value); + bool IsFirstToCuttingContour() const; - void SetLastToCuttingCountour(bool value); - bool IsLastToCuttingCountour() const; + void SetLastToCuttingContour(bool value); + bool IsLastToCuttingContour() const; QVector PathPoints(const VContainer *data, const QVector &cuttingPath = QVector()) const; diff --git a/src/libs/vpatterndb/vpiecepath_p.h b/src/libs/vpatterndb/vpiecepath_p.h index f0b90a09e..bd246b9bd 100644 --- a/src/libs/vpatterndb/vpiecepath_p.h +++ b/src/libs/vpatterndb/vpiecepath_p.h @@ -59,8 +59,8 @@ public: m_penType(path.m_penType), m_cut(path.m_cut), m_visibilityTrigger(path.m_visibilityTrigger), - m_firstToCuttingCountour(path.m_firstToCuttingCountour), - m_lastToCuttingCountour(path.m_lastToCuttingCountour) + m_firstToCuttingContour(path.m_firstToCuttingContour), + m_lastToCuttingContour(path.m_lastToCuttingContour) {} ~VPiecePathData(); @@ -71,8 +71,8 @@ public: Qt::PenStyle m_penType{Qt::SolidLine}; bool m_cut{false}; QString m_visibilityTrigger{'1'}; - bool m_firstToCuttingCountour{false}; - bool m_lastToCuttingCountour{false}; + bool m_firstToCuttingContour{false}; + bool m_lastToCuttingContour{false}; private: Q_DISABLE_ASSIGN(VPiecePathData) diff --git a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp index 774ab78f7..666267ece 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp @@ -1358,8 +1358,8 @@ void DialogPiecePath::SetPiecePath(const VPiecePath &path) SetPenType(path.GetPenType()); SetCutPath(path.IsCutPath()); - ui->checkBoxFirstPointToCuttingContour->setChecked(path.IsFirstToCuttingCountour()); - ui->checkBoxLastPointToCuttingContour->setChecked(path.IsLastToCuttingCountour()); + ui->checkBoxFirstPointToCuttingContour->setChecked(path.IsFirstToCuttingContour()); + ui->checkBoxLastPointToCuttingContour->setChecked(path.IsLastToCuttingContour()); if (path.GetType() == PiecePathType::InternalPath) { @@ -1628,8 +1628,8 @@ VPiecePath DialogPiecePath::CreatePath() const path.SetName(ui->lineEditName->text()); path.SetPenType(isInternalPath ? GetPenType() : Qt::SolidLine); path.SetCutPath(isInternalPath ? IsCutPath() : false); - path.SetFirstToCuttingCountour(isInternalPath ? ui->checkBoxFirstPointToCuttingContour->isChecked() : false); - path.SetLastToCuttingCountour(isInternalPath ? ui->checkBoxLastPointToCuttingContour->isChecked() : false); + path.SetFirstToCuttingContour(isInternalPath ? ui->checkBoxFirstPointToCuttingContour->isChecked() : false); + path.SetLastToCuttingContour(isInternalPath ? ui->checkBoxLastPointToCuttingContour->isChecked() : false); path.SetVisibilityTrigger(isInternalPath ? GetFormulaVisible() : QChar('1')); return path; diff --git a/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp b/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp index 9ab0183b1..b88e4bf1b 100644 --- a/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp +++ b/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp @@ -194,8 +194,8 @@ void VToolPiecePath::AddAttributes(VAbstractPattern *doc, QDomElement &domElemen { doc->SetAttribute(domElement, VAbstractPattern::AttrVisible, path.GetVisibilityTrigger()); doc->SetAttribute(domElement, AttrCut, path.IsCutPath()); - doc->SetAttribute(domElement, AttrFirstToCountour, path.IsFirstToCuttingCountour()); - doc->SetAttribute(domElement, AttrLastToCountour, path.IsLastToCuttingCountour()); + doc->SetAttribute(domElement, AttrFirstToContour, path.IsFirstToCuttingContour()); + doc->SetAttribute(domElement, AttrLastToContour, path.IsLastToCuttingContour()); } } diff --git a/src/test/ValentinaTest/tst_vlayoutdetail.cpp b/src/test/ValentinaTest/tst_vlayoutdetail.cpp index 4fa50222e..056405f46 100644 --- a/src/test/ValentinaTest/tst_vlayoutdetail.cpp +++ b/src/test/ValentinaTest/tst_vlayoutdetail.cpp @@ -59,7 +59,7 @@ void TST_VLayoutDetail::Case1() const VLayoutPiece det = VLayoutPiece(); QVector inputPoints; CastTo(InputPointsCase1(), inputPoints); - det.SetCountourPoints(inputPoints); + det.SetContourPoints(inputPoints); // Begin comparison QVector contourPoints; @@ -125,7 +125,7 @@ void TST_VLayoutDetail::Case2() const VLayoutPiece det = VLayoutPiece(); QVector inputPoints; CastTo(InputPointsCase2(), inputPoints); - det.SetCountourPoints(inputPoints); + det.SetContourPoints(inputPoints); // Begin comparison QVector contourPoints; @@ -170,7 +170,7 @@ void TST_VLayoutDetail::Case3() const VLayoutPiece det = VLayoutPiece(); QVector inputPoints; CastTo(InputPointsCase3(), inputPoints); - det.SetCountourPoints(inputPoints); + det.SetContourPoints(inputPoints); // Begin comparison QVector contourPoints;