diff --git a/ChangeLog.txt b/ChangeLog.txt index b6fb43eec..b970dacc5 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -36,6 +36,7 @@ - [#496] Selector for selecting which pieces to print. - [#520] Improve Union tool. An option to select about original pieces. - [#262] Automatic Update notification. +- [#424] Improve Formula Wizard dialog. # Version 0.4.5 - [#435] Valentina doesn't change the cursor. @@ -56,6 +57,8 @@ - [#537] Valentina crashes when use undo command. - [#544] Error: Color Lines are black until touched. - [#543] Detail loses details. +- [#548] Bug Detail tool. Case when seam allowance is wrong. +- Called the main app in console mode doesn't show opening file error in some cases. # Version 0.4.4 April 12, 2016 - Updated measurement templates with all measurements. Added new template Aldrich/Women measurements. diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 710a8e2e8..4e7ef0147 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -3855,9 +3855,15 @@ bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu ZoomFirstShow(); ActionDraw(true); + + qApp->setOpeningPattern();// End opening file + return true; + } + else + { + qApp->setOpeningPattern();// End opening file + return false; } - qApp->setOpeningPattern();// End opening file - return true; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index d481947e7..731f47a14 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -64,6 +64,58 @@ const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pa //VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! +// The list of all string we use for conversion +// Better to use global variables because repeating QStringLiteral blows up code size +const QString strUnit = QStringLiteral("unit"); +const QString strVersion = QStringLiteral("version"); +const QString strName = QStringLiteral("name"); +const QString strBase = QStringLiteral("base"); +const QString strFormula = QStringLiteral("formula"); +const QString strId = QStringLiteral("id"); +const QString strKGrowth = QStringLiteral("kgrowth"); +const QString strKSize = QStringLiteral("ksize"); +const QString strPoint = QStringLiteral("point"); +const QString strLength = QStringLiteral("length"); +const QString strAngle = QStringLiteral("angle"); +const QString strC1Radius = QStringLiteral("c1Radius"); +const QString strC2Radius = QStringLiteral("c2Radius"); +const QString strCRadius = QStringLiteral("cRadius"); +const QString strArc = QStringLiteral("arc"); +const QString strAngle1 = QStringLiteral("angle1"); +const QString strAngle2 = QStringLiteral("angle2"); +const QString strRadius = QStringLiteral("radius"); +const QString strPathPoint = QStringLiteral("pathPoint"); +const QString strKAsm1 = QStringLiteral("kAsm1"); +const QString strKAsm2 = QStringLiteral("kAsm2"); +const QString strPath = QStringLiteral("path"); +const QString strType = QStringLiteral("type"); +const QString strCutArc = QStringLiteral("cutArc"); +const QString strSpline = QStringLiteral("spline"); +const QString strSplinePath = QStringLiteral("splinePath"); +const QString strCutSpline = QStringLiteral("cutSpline"); +const QString strCutSplinePath = QStringLiteral("cutSplinePath"); +const QString strColor = QStringLiteral("color"); +const QString strMeasurements = QStringLiteral("measurements"); +const QString strIncrement = QStringLiteral("increment"); +const QString strIncrements = QStringLiteral("increments"); +const QString strModeling = QStringLiteral("modeling"); +const QString strTools = QStringLiteral("tools"); +const QString strIdTool = QStringLiteral("idTool"); +const QString strIdObject = QStringLiteral("idObject"); +const QString strChildren = QStringLiteral("children"); +const QString strChild = QStringLiteral("child"); +const QString strPointOfIntersectionCurves = QStringLiteral("pointOfIntersectionCurves"); +const QString strCurveIntersectAxis = QStringLiteral("curveIntersectAxis"); +const QString strCurve = QStringLiteral("curve"); +const QString strCurve1 = QStringLiteral("curve1"); +const QString strCurve2 = QStringLiteral("curve2"); +const QString strModelingPath = QStringLiteral("modelingPath"); +const QString strModelingSpline = QStringLiteral("modelingSpline"); +const QString strPointFromArcAndTangent = QStringLiteral("pointFromArcAndTangent"); +const QString strPointOfIntersectionArcs = QStringLiteral("pointOfIntersectionArcs"); +const QString strFirstArc = QStringLiteral("firstArc"); +const QString strSecondArc = QStringLiteral("secondArc"); + //--------------------------------------------------------------------------------------------------------------------- VPatternConverter::VPatternConverter(const QString &fileName) :VAbstractConverter(fileName) @@ -316,6 +368,9 @@ void VPatternConverter::ToV0_2_7() //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::ToV0_3_0() { + //Cutting path do not create anymore subpaths + FixCutPoint(); + FixCutPoint(); SetVersion(QStringLiteral("0.3.0")); Save(); } @@ -345,12 +400,12 @@ void VPatternConverter::ToV0_3_3() //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::TagUnitToV0_2_0() { - QDomElement unit = createElement("unit"); + QDomElement unit = createElement(strUnit); QDomText newNodeText = createTextNode(MUnitV0_1_4()); unit.appendChild(newNodeText); QDomElement patternElement = documentElement(); - patternElement.insertAfter(unit, patternElement.firstChildElement("version")); + patternElement.insertAfter(unit, patternElement.firstChildElement(strVersion)); } //--------------------------------------------------------------------------------------------------------------------- @@ -385,16 +440,16 @@ QSet VPatternConverter::FixIncrementsToV0_2_0() QDomElement domElement = domNode.toElement(); if (domElement.isNull() == false) { - if (domElement.tagName() == "increment") + if (domElement.tagName() == strIncrement) { try { - const QString name = GetParametrString(domElement, "name"); + const QString name = GetParametrString(domElement, strName); names.insert(name); - domElement.setAttribute("name", "#"+name); + domElement.setAttribute(strName, QLatin1String("#")+name); - const QString base = GetParametrString(domElement, "base"); - domElement.setAttribute("formula", base); + const QString base = GetParametrString(domElement, strBase); + domElement.setAttribute(strFormula, base); } catch (VExceptionEmptyParameter &e) { @@ -402,10 +457,10 @@ QSet VPatternConverter::FixIncrementsToV0_2_0() excep.AddMoreInformation(e.ErrorMessage()); throw excep; } - domElement.removeAttribute("id"); - domElement.removeAttribute("kgrowth"); - domElement.removeAttribute("ksize"); - domElement.removeAttribute("base"); + domElement.removeAttribute(strId); + domElement.removeAttribute(strKGrowth); + domElement.removeAttribute(strKSize); + domElement.removeAttribute(strBase); } } } @@ -418,15 +473,15 @@ QSet VPatternConverter::FixIncrementsToV0_2_0() void VPatternConverter::FixPointExpressionsToV0_2_0(const QSet &names) { QString formula; - const QDomNodeList list = elementsByTagName("point"); + const QDomNodeList list = elementsByTagName(strPoint); for (int i=0; i < list.size(); ++i) { QDomElement dom = list.at(i).toElement(); try { - formula = GetParametrString(dom, "length"); - dom.setAttribute("length", FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, strLength); + dom.setAttribute(strLength, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -435,8 +490,8 @@ void VPatternConverter::FixPointExpressionsToV0_2_0(const QSet &names) try { - formula = GetParametrString(dom, "angle"); - dom.setAttribute("angle", FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, strAngle); + dom.setAttribute(strAngle, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -444,8 +499,8 @@ void VPatternConverter::FixPointExpressionsToV0_2_0(const QSet &names) } try { - formula = GetParametrString(dom, "c1Radius"); - dom.setAttribute("c1Radius", FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, strC1Radius); + dom.setAttribute(strC1Radius, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -454,8 +509,8 @@ void VPatternConverter::FixPointExpressionsToV0_2_0(const QSet &names) try { - formula = GetParametrString(dom, "c2Radius"); - dom.setAttribute("c2Radius", FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, strC2Radius); + dom.setAttribute(strC2Radius, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -464,8 +519,8 @@ void VPatternConverter::FixPointExpressionsToV0_2_0(const QSet &names) try { - formula = GetParametrString(dom, "cRadius"); - dom.setAttribute("cRadius", FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, strCRadius); + dom.setAttribute(strCRadius, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -478,15 +533,15 @@ void VPatternConverter::FixPointExpressionsToV0_2_0(const QSet &names) void VPatternConverter::FixArcExpressionsToV0_2_0(const QSet &names) { QString formula; - const QDomNodeList list = elementsByTagName("arc"); + const QDomNodeList list = elementsByTagName(strArc); for (int i=0; i < list.size(); ++i) { QDomElement dom = list.at(i).toElement(); try { - formula = GetParametrString(dom, "angle1"); - dom.setAttribute("angle1", FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, strAngle1); + dom.setAttribute(strAngle1, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -495,8 +550,8 @@ void VPatternConverter::FixArcExpressionsToV0_2_0(const QSet &names) try { - formula = GetParametrString(dom, "angle2"); - dom.setAttribute("angle2", FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, strAngle2); + dom.setAttribute(strAngle2, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -505,8 +560,8 @@ void VPatternConverter::FixArcExpressionsToV0_2_0(const QSet &names) try { - formula = GetParametrString(dom, "radius"); - dom.setAttribute("radius", FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, strRadius); + dom.setAttribute(strRadius, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -515,8 +570,8 @@ void VPatternConverter::FixArcExpressionsToV0_2_0(const QSet &names) try { - formula = GetParametrString(dom, "length"); - dom.setAttribute("length", FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, strLength); + dom.setAttribute(strLength, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -529,15 +584,15 @@ void VPatternConverter::FixArcExpressionsToV0_2_0(const QSet &names) void VPatternConverter::FixPathPointExpressionsToV0_2_0(const QSet &names) { QString formula; - const QDomNodeList list = elementsByTagName("pathPoint"); + const QDomNodeList list = elementsByTagName(strPathPoint); for (int i=0; i < list.size(); ++i) { QDomElement dom = list.at(i).toElement(); try { - formula = GetParametrString(dom, "kAsm1"); - dom.setAttribute("kAsm1", FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, strKAsm1); + dom.setAttribute(strKAsm1, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -546,8 +601,8 @@ void VPatternConverter::FixPathPointExpressionsToV0_2_0(const QSet &nam try { - formula = GetParametrString(dom, "kAsm2"); - dom.setAttribute("kAsm2", FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, strKAsm2); + dom.setAttribute(strKAsm2, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -556,8 +611,8 @@ void VPatternConverter::FixPathPointExpressionsToV0_2_0(const QSet &nam try { - formula = GetParametrString(dom, "angle"); - dom.setAttribute("angle", FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, strAngle); + dom.setAttribute(strAngle, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -570,15 +625,15 @@ void VPatternConverter::FixPathPointExpressionsToV0_2_0(const QSet &nam void VPatternConverter::ConvertPointExpressionsToV0_2_0(const QMap &names) { QString formula; - const QDomNodeList list = elementsByTagName("point"); + const QDomNodeList list = elementsByTagName(strPoint); for (int i=0; i < list.size(); ++i) { QDomElement dom = list.at(i).toElement(); try { - formula = GetParametrString(dom, "length"); - dom.setAttribute("length", FixMeasurementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, strLength); + dom.setAttribute(strLength, FixMeasurementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -587,8 +642,8 @@ void VPatternConverter::ConvertPointExpressionsToV0_2_0(const QMap &names) { QString formula; - const QDomNodeList list = elementsByTagName("arc"); + const QDomNodeList list = elementsByTagName(strArc); for (int i=0; i < list.size(); ++i) { QDomElement dom = list.at(i).toElement(); try { - formula = GetParametrString(dom, "angle1"); - dom.setAttribute("angle1", FixMeasurementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, strAngle1); + dom.setAttribute(strAngle1, FixMeasurementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -647,8 +702,8 @@ void VPatternConverter::ConvertArcExpressionsToV0_2_0(const QMap &names) { QString formula; - const QDomNodeList list = elementsByTagName("pathPoint"); + const QDomNodeList list = elementsByTagName(strPathPoint); for (int i=0; i < list.size(); ++i) { QDomElement dom = list.at(i).toElement(); try { - formula = GetParametrString(dom, "kAsm1"); - dom.setAttribute("kAsm1", FixMeasurementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, strKAsm1); + dom.setAttribute(strKAsm1, FixMeasurementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -698,8 +753,8 @@ void VPatternConverter::ConvertPathPointExpressionsToV0_2_0(const QMap children; QDomElement childNode = node.nextSibling().toElement(); - const QString attrIdTool = QStringLiteral("idTool"); while (not childNode.isNull()) { - if (childNode.hasAttribute(attrIdTool) && childNode.attribute(attrIdTool).toUInt() == toolId) + if (childNode.hasAttribute(strIdTool) && childNode.attribute(strIdTool).toUInt() == toolId) { - children.append(childNode.attribute(QStringLiteral("idObject")).toUInt()); + children.append(childNode.attribute(strIdObject).toUInt()); } else { @@ -961,11 +1013,11 @@ void VPatternConverter::SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector< return; } - QDomElement tagChildren = createElement(QString("children")); + QDomElement tagChildren = createElement(strChildren); for (int i=0; i VPatternConverter::OldNamesToNewNames_InV0_2_1() return names; } + +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::FixCutPoint() +{ + const QStringList types = QStringList() << strCutSplinePath + << strCutSpline + << strCutArc; + + const QDomNodeList list = elementsByTagName(strPoint); + for (int i=0; i < list.size(); ++i) + { + QDomElement element = list.at(i).toElement(); + if (not element.isNull()) + { + const QString type = element.attribute(strType); + switch(types.indexOf(type)) + { + case 0: //strCutSplinePath + { + const quint32 id = element.attribute(strId).toUInt(); + quint32 curve = element.attribute(strSplinePath).toUInt(); + FixSubPaths(i, id, curve); + break; + } + case 1: //strCutSpline + { + const quint32 id = element.attribute(strId).toUInt(); + quint32 curve = element.attribute(strSpline).toUInt(); + FixSubPaths(i, id, curve); + break; + } + case 2: //strCutArc + { + const quint32 id = element.attribute(strId).toUInt(); + quint32 curve = element.attribute(strArc).toUInt(); + FixSubPaths(i, id, curve); + break; + } + default: + break; + } + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::FixSubPaths(int i, quint32 id, quint32 baseCurve) +{ + const QStringList pointTypes = QStringList() << strCutSplinePath + << strCutSpline + << strPointOfIntersectionCurves + << strCurveIntersectAxis + << strPointFromArcAndTangent + << strPointOfIntersectionArcs; + + const QDomNodeList listPoints = elementsByTagName(strPoint); + for (int j = i+1; j < listPoints.size(); ++j) + { + QDomElement element = listPoints.at(j).toElement(); + if (not element.isNull()) + { + const QString type = element.attribute(strType); + switch(pointTypes.indexOf(type)) + { + case 0: //strCutSplinePath + { + const quint32 spl = element.attribute(strSplinePath).toUInt(); + if (spl == id+1 || spl == id+2) + { + element.setAttribute(strSplinePath, baseCurve); + } + break; + } + case 1: //strCutSpline + { + const quint32 spl = element.attribute(strSpline).toUInt(); + if (spl == id+1 || spl == id+2) + { + element.setAttribute(strSpline, baseCurve); + } + break; + } + case 2: //strPointOfIntersectionCurves + { + quint32 spl = element.attribute(strCurve1).toUInt(); + if (spl == id+1 || spl == id+2) + { + element.setAttribute(strCurve1, baseCurve); + } + + spl = element.attribute(strCurve2).toUInt(); + if (spl == id+1 || spl == id+2) + { + element.setAttribute(strCurve2, baseCurve); + } + break; + } + case 3: //strCurveIntersectAxis + { + const quint32 spl = element.attribute(strCurve).toUInt(); + if (spl == id+1 || spl == id+2) + { + element.setAttribute(strCurve, baseCurve); + } + break; + } + case 4: //strPointFromArcAndTangent + { + const quint32 spl = element.attribute(strArc).toUInt(); + if (spl == id+1 || spl == id+2) + { + element.setAttribute(strArc, baseCurve); + } + break; + } + case 5: //strPointOfIntersectionArcs + { + quint32 arc = element.attribute(strFirstArc).toUInt(); + if (arc == id+1 || arc == id+2) + { + element.setAttribute(strFirstArc, baseCurve); + } + + arc = element.attribute(strSecondArc).toUInt(); + if (arc == id+1 || arc == id+2) + { + element.setAttribute(strSecondArc, baseCurve); + } + break; + } + default: + break; + } + } + } + + const QStringList splTypes = QStringList() << strModelingPath + << strModelingSpline; + + const QDomNodeList listSplines = elementsByTagName(strSpline); + for (int j = 0; j < listSplines.size(); ++j) + { + QDomElement element = listSplines.at(j).toElement(); + if (not element.isNull()) + { + const QString type = element.attribute(strType); + switch(splTypes.indexOf(type)) + { + case 0: //strModelingPath + { + const quint32 spl = element.attribute(strIdObject).toUInt(); + if (spl == id+1 || spl == id+2) + { + element.setAttribute(strIdObject, baseCurve); + } + break; + } + case 1: //strModelingSpline + { + const quint32 spl = element.attribute(strIdObject).toUInt(); + if (spl == id+1 || spl == id+2) + { + element.setAttribute(strIdObject, baseCurve); + } + break; + } + default: + break; + } + } + } + + const QDomNodeList listArcs = elementsByTagName(strArc); + for (int j = 0; j < listArcs.size(); ++j) + { + QDomElement element = listArcs.at(j).toElement(); + if (not element.isNull()) + { + const QString type = element.attribute(strType); + if (type == strModeling) + { + const quint32 arc = element.attribute(strIdObject).toUInt(); + if (arc == id+1 || arc == id+2) + { + element.setAttribute(strIdObject, baseCurve); + } + } + } + } +} diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index 243c9a39e..eab0787e1 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -118,6 +118,9 @@ private: static QMap OldNamesToNewNames_InV0_2_0(); static QMap OldNamesToNewNames_InV0_2_1(); + + void FixCutPoint(); + void FixSubPaths(int i, quint32 id, quint32 baseCurve); }; //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vgeometry/varc.cpp b/src/libs/vgeometry/varc.cpp index 56b1f18e4..dd424fe66 100644 --- a/src/libs/vgeometry/varc.cpp +++ b/src/libs/vgeometry/varc.cpp @@ -241,7 +241,11 @@ QVector VArc::GetPoints() const QVector splPoints = spl.GetPoints(); if (not splPoints.isEmpty() && i != sectionAngle.size() - 1) { +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + splPoints.remove(splPoints.size() - 1); +#else splPoints.removeLast(); +#endif } points << splPoints; diff --git a/src/libs/vgeometry/vellipticalarc.cpp b/src/libs/vgeometry/vellipticalarc.cpp index ce2dab7cf..f501a3392 100644 --- a/src/libs/vgeometry/vellipticalarc.cpp +++ b/src/libs/vgeometry/vellipticalarc.cpp @@ -366,7 +366,11 @@ QVector VEllipticalArc::GetPoints() const if (not splPoints.isEmpty() && i != sectionAngle.size() - 1) { +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + splPoints.remove(splPoints.size() - 1); +#else splPoints.removeLast(); +#endif } points << splPoints; currentAngle += sectionAngle.at(i); diff --git a/src/libs/vlayout/vabstractdetail.cpp b/src/libs/vlayout/vabstractdetail.cpp index ab84771bc..36bc71826 100644 --- a/src/libs/vlayout/vabstractdetail.cpp +++ b/src/libs/vlayout/vabstractdetail.cpp @@ -269,7 +269,6 @@ QVector VAbstractDetail::RemoveDublicates(const QVector &point */ QVector VAbstractDetail::CorrectEquidistantPoints(const QVector &points) { - QVector correctPoints; if (points.size()<4)//Better don't check if only three points. We can destroy equidistant. { qDebug()<<"Only three points."; @@ -277,20 +276,17 @@ QVector VAbstractDetail::CorrectEquidistantPoints(const QVector correctPoints = RemoveDublicates(points); if (correctPoints.size()<3) { return correctPoints; } //Remove point on line - QPointF point; for (qint32 i = 1; i Equidistant(const QVector &points, const EquidistantType &eqv, qreal width); static qreal SumTrapezoids(const QVector &points); static QVector CheckLoops(const QVector &points); + static QVector CorrectEquidistantPoints(const QVector &points); protected: static QVector RemoveDublicates(const QVector &points); - static QVector CorrectEquidistantPoints(const QVector &points); private: QSharedDataPointer d; diff --git a/src/libs/vpatterndb/vtranslatevars.cpp b/src/libs/vpatterndb/vtranslatevars.cpp index 62c66aa23..d3c0a04e4 100644 --- a/src/libs/vpatterndb/vtranslatevars.cpp +++ b/src/libs/vpatterndb/vtranslatevars.cpp @@ -403,7 +403,7 @@ void VTranslateVars::InitFunctions() functions.insert(cosh_F, translate("VTranslateVars", "cosh", "hyperbolic cosine")); functions.insert(tanh_F, translate("VTranslateVars", "tanh", "hyperbolic tangens function")); functions.insert(asinh_F, translate("VTranslateVars", "asinh", "hyperbolic arcus sine function")); - functions.insert(acosh_F, translate("VTranslateVars", "acosh", "hyperbolic arcus tangens function")); + functions.insert(acosh_F, translate("VTranslateVars", "acosh", "hyperbolic arcus cosine function")); functions.insert(atanh_F, translate("VTranslateVars", "atanh", "hyperbolic arcur tangens function")); functions.insert(log2_F, translate("VTranslateVars", "log2", "logarithm to the base 2")); functions.insert(log10_F, translate("VTranslateVars", "log10", "logarithm to the base 10")); @@ -946,3 +946,9 @@ void VTranslateVars::Retranslate() InitFunctions(); InitPostfixOperators(); } + +//--------------------------------------------------------------------------------------------------------------------- +QMap VTranslateVars::GetFunctions() const +{ + return functions; +} diff --git a/src/libs/vpatterndb/vtranslatevars.h b/src/libs/vpatterndb/vtranslatevars.h index 17ab3f718..badace6f0 100644 --- a/src/libs/vpatterndb/vtranslatevars.h +++ b/src/libs/vpatterndb/vtranslatevars.h @@ -61,6 +61,7 @@ public: QString FormulaToUser(const QString &formula, bool osSeparator) const; virtual void Retranslate() Q_DECL_OVERRIDE; + QMap GetFunctions() const; private: Q_DISABLE_COPY(VTranslateVars) diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp index 8625a6fbb..7bc6e8ab2 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp @@ -217,6 +217,11 @@ void DialogEditWrongFormula::ValChanged(int row) degreeSymbol, tr("Curve angle")); return; } + if (ui->radioButtonFunctions->isChecked()) + { + ui->labelDescription->setText(item->toolTip()); + return; + } } //--------------------------------------------------------------------------------------------------------------------- @@ -309,6 +314,16 @@ void DialogEditWrongFormula::Increments() ShowVariable(data->DataIncrements()); } +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief Functions show in list functions + */ +void DialogEditWrongFormula::Functions() +{ + ui->checkBoxHideEmpty->setEnabled(false); + ShowFunctions(); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogEditWrongFormula::CheckState() { @@ -384,6 +399,7 @@ void DialogEditWrongFormula::InitVariables() connect(ui->checkBoxHideEmpty, &QCheckBox::stateChanged, this, &DialogEditWrongFormula::Measurements); connect(ui->radioButtonRadiusesArcs, &QRadioButton::clicked, this, &DialogEditWrongFormula::RadiusArcs); connect(ui->radioButtonAnglesCurves, &QRadioButton::clicked, this, &DialogEditWrongFormula::AnglesCurves); + connect(ui->radioButtonFunctions, &QRadioButton::clicked, this, &DialogEditWrongFormula::Functions); } //--------------------------------------------------------------------------------------------------------------------- @@ -477,3 +493,31 @@ void DialogEditWrongFormula::ShowMeasurements(const QMaptableWidget->selectRow(0); ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); } + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief ShowFunctions show functions in list + */ +void DialogEditWrongFormula::ShowFunctions() +{ + ui->tableWidget->blockSignals(true); + ui->tableWidget->clearContents(); + ui->tableWidget->setRowCount(0); + ui->tableWidget->setColumnHidden(ColumnFullName, true); + ui->labelDescription->setText(""); + + QMap::const_iterator i = qApp->TrVars()->GetFunctions().constBegin(); + while (i != qApp->TrVars()->GetFunctions().constEnd()) + { + ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1); + QTableWidgetItem *item = new QTableWidgetItem(i.value().translate()); + item->setFont(QFont("Times", 12, QFont::Bold)); + ui->tableWidget->setItem(ui->tableWidget->rowCount()-1, ColumnName, item); + item->setToolTip(i.value().getMdisambiguation()); + ++i; + } + + ui->tableWidget->blockSignals(false); + ui->tableWidget->selectRow(0); + ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); +} diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.h b/src/libs/vtools/dialogs/support/dialogeditwrongformula.h index efb4fb0e9..3eed52e9c 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.h +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.h @@ -90,6 +90,7 @@ public slots: void LengthCurves(); void AngleLines(); void Increments(); + void Functions(); protected: virtual void CheckState() Q_DECL_OVERRIDE; virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; @@ -113,6 +114,7 @@ private: template void ShowVariable(const QMap &var); void ShowMeasurements(const QMap > &var); + void ShowFunctions(); void SetDescription(const QString &name, qreal value, const QString &unit, const QString &description); }; diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.ui b/src/libs/vtools/dialogs/support/dialogeditwrongformula.ui index c639d559a..9a6c353ae 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.ui +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.ui @@ -329,6 +329,19 @@ + + + + + 0 + 0 + + + + Functions + + + diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index 2fb3b036d..87c3c6dbf 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -676,45 +676,61 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d QVector children = AllChildren(doc, id); if (not children.isEmpty()) { - qint32 i = 0; - do + // This check need for backward compatibility + // Remove check and "else" part if min version is 0.3.2 + Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 2), + "Time to refactor the code."); + if (children.size() == countNodeD1 + countNodeD2-1) { - // This check need for backward compatibility - // Remove it if min version is 0.3.2 - // Instead: - // UpdatePoints(data, d1.RemoveEdge(indexD1), i, children); - Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 2), - "Time to refactor the code."); - if (children.size() != countNodeD2) + qint32 i = 0; + do { UpdatePoints(data, d1.RemoveEdge(indexD1), i, children); - } - ++i; - if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < countNodeD2-1) - { - VDetail d2REdge = d2.RemoveEdge(indexD2); - qint32 j = 0; - FindIndexJ(pointsD2, d2, indexD2, j); - do + ++i; + if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < countNodeD2-1) { - if (j >= countNodeD2) + VDetail d2REdge = d2.RemoveEdge(indexD2); + qint32 j = 0; + FindIndexJ(pointsD2, d2, indexD2, j); + do { - j=0; - } - UpdatePoints(data, d2REdge, j, children, dx, dy, det1p1.getId(), angle); - ++pointsD2; - ++j; - } while (pointsD2 < countNodeD2-1); - // This check need for backward compatibility - // Remove it if min version is 0.3.2 - Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 2), - "Time to refactor the code."); - if (children.size() == countNodeD2) + if (j >= countNodeD2) + { + j=0; + } + UpdatePoints(data, d2REdge, j, children, dx, dy, det1p1.getId(), angle); + ++pointsD2; + ++j; + } while (pointsD2 < countNodeD2-1); + } + } while (i d1.indexOfNode(det1p1.getId())) { + const int childrenCount = children.size(); + VDetail d2REdge = d2.RemoveEdge(indexD2); + qint32 j = 0; + FindIndexJ(pointsD2, d2, indexD2, j); + do + { + if (j >= countNodeD2) + { + j=0; + } + UpdatePoints(data, d2REdge, j, children, dx, dy, det1p1.getId(), angle); + ++pointsD2; + ++j; + } while (pointsD2 < childrenCount); break; } - } - } while (i>("points"); + QTest::addColumn("eqv"); + QTest::addColumn("width"); + QTest::addColumn>("ekvOrig"); + + QTest::newRow("Case1") << InputPointsCase1() + << static_cast(EquidistantType::CloseEquidistant) + << 75.5906 // seam allowance width + << OutputPointsCase1(); + + QTest::newRow("Case2") << InputPointsCase2() + << static_cast(EquidistantType::CloseEquidistant) + << 37.7953 // seam allowance width + << OutputPointsCase2(); +} + //--------------------------------------------------------------------------------------------------------------------- // cppcheck-suppress unusedFunction void TST_VAbstractDetail::EquidistantRemoveLoop() const @@ -48,8 +67,15 @@ void TST_VAbstractDetail::EquidistantRemoveLoop() const // See issue #298. Segmented Curve isn't selected in Seam Allowance tool. // https://bitbucket.org/dismine/valentina/issue/298/segmented-curve-isnt-selected-in-seam // Code should clean loops in path. - Case1(); - Case2(); + QFETCH(QVector, points); + QFETCH(int, eqv); + QFETCH(qreal, width); + QFETCH(QVector, ekvOrig); + + const QVector ekv = VAbstractDetail::Equidistant(points, static_cast(eqv), width); + + // Begin comparison + Comparison(ekv, ekvOrig); } //--------------------------------------------------------------------------------------------------------------------- @@ -77,7 +103,11 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const path << QPointF(10, 10); QTest::newRow("Correct closed a path (four unique points)") << path << path; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); +#else path.removeLast(); +#endif QTest::newRow("Correct unclosed a path (four unique points)") << path << path; path.clear(); @@ -90,7 +120,11 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const path << QPointF(0, 10); QTest::newRow("Correct closed a path (six unique points)") << path << path; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); +#else path.removeLast(); +#endif QTest::newRow("Correct unclosed a path (six unique points)") << path << path; path.clear(); @@ -107,8 +141,13 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const res << QPointF(20, 10); QTest::newRow("One loop, closed a path (four unique points)") << path << res; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); + res.remove(res.size() - 1); +#else path.removeLast(); res.removeLast(); +#endif QTest::newRow("One loop, unclosed a path (four unique points)") << path << res; path.clear(); @@ -127,8 +166,13 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const res << QPointF(20, 10); QTest::newRow("Two loops, closed a path (six unique points)") << path << res; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); + res.remove(res.size() - 1); +#else path.removeLast(); res.removeLast(); +#endif QTest::newRow("Two loops, unclosed a path (six unique points)") << path << res; path.clear(); @@ -147,8 +191,13 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const res << QPointF(20, 10); QTest::newRow("One loop, the first loop, closed a path (six unique points)") << path << res; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); + res.remove(res.size() - 1); +#else path.removeLast(); res.removeLast(); +#endif QTest::newRow("One loop, the first loop, unclosed a path (six unique points)") << path << res; path.clear(); @@ -169,8 +218,13 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const res << QPointF(20, 10); QTest::newRow("One loop, the second loop, closed a path (six unique points)") << path << res; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); + res.remove(res.size() - 1); +#else path.removeLast(); res.removeLast(); +#endif QTest::newRow("One loop, the second loop, unclosed a path (six unique points)") << path << res; path.clear(); @@ -182,7 +236,11 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const path << QPointF(20, 10); QTest::newRow("Correct closed a path, point on line (four unique points)") << path << path; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); +#else path.removeLast(); +#endif QTest::newRow("Corect unclosed a path, point on line (four unique points)") << path << path; path.clear(); @@ -197,7 +255,11 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const path << QPointF(20, 10); QTest::newRow("Correct closed a path, point on line (six unique points)") << path << path; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); +#else path.removeLast(); +#endif QTest::newRow("Corect unclosed a path, point on line (six unique points)") << path << path; path.clear(); @@ -410,11 +472,15 @@ void TST_VAbstractDetail::BrokenDetailEquidistant() const // We will test only one detail. The second require too accurate data that we cannot get from debuger. // The test check an open equdistant of correct detail. QVector points;// Input points. - points.append(QPointF(1062.36226525, 134.022845566)); - points.append(QPointF(1375.53777429, 66.4182791729)); - points.append(QPointF(1422.22769398, 510.762708661)); - points.append(QPointF(1467.89850709, 945.408377953)); - points.append(QPointF(1127.74102677, 510.762708661)); + points.append(QPointF(787.5835464566929, 1701.3138897637796)); + points.append(QPointF(938.7646488188976, 1701.3138897637796)); + points.append(QPointF(910.0209091217698, 1792.3369853889722)); + points.append(QPointF(878.5244039283091, 1905.2261617043234)); + points.append(QPointF(863.9159293830619, 1968.2534932384856)); + points.append(QPointF(852.8936778444679, 1919.6965437838999)); + points.append(QPointF(819.0677656132684, 1798.6758641921479)); + points.append(QPointF(787.5835464566929, 1701.3138897637796)); + points.append(QPointF(797.0323653543306, 2608.4005039370077)); const EquidistantType eqv = EquidistantType::OpenEquidistant; // Open path const qreal width = 37.795275590551185; // seam allowance width @@ -422,43 +488,55 @@ void TST_VAbstractDetail::BrokenDetailEquidistant() const const QVector ekv = VAbstractDetail::Equidistant(points, eqv, width);// Take result QVector ekvOrig; - ekvOrig.append(QPointF(1055.89455044, 96.7531583682)); - ekvOrig.append(QPointF(1408.72549102, 20.5882538362)); - ekvOrig.append(QPointF(1459.81603355, 506.813077611)); - ekvOrig.append(QPointF(1508.46179299, 969.771085841)); - ekvOrig.append(QPointF(1455.67973006, 991.120774377)); - ekvOrig.append(QPointF(1141.4155362, 589.560971108)); + ekvOrig.append(QPointF(787.1898456692913, 1663.5186141732283)); + ekvOrig.append(QPointF(989.3402780205395, 1663.5186141732283)); + ekvOrig.append(QPointF(915.0896841461371, 1914.8556948468406)); + ekvOrig.append(QPointF(894.0594908835558, 2005.5891221381557)); + ekvOrig.append(QPointF(834.9361130712198, 2006.4994568398874)); + ekvOrig.append(QPointF(788.9513624221928, 1832.6242224517807)); // Begin comparison Comparison(ekv, ekvOrig); } //--------------------------------------------------------------------------------------------------------------------- -void TST_VAbstractDetail::Case1() const +void TST_VAbstractDetail::TestCorrectEquidistantPoints_data() { - const QVector points = InputPointsCase1(); // Input points. - const EquidistantType eqv = EquidistantType::CloseEquidistant; // Closed path - const qreal width = 75.5906; // seam allowance width + QTest::addColumn>("before"); + QTest::addColumn>("expect"); - const QVector ekv = VAbstractDetail::Equidistant(points, eqv, width);// Take result - const QVector ekvOrig = OutputPointsCase1(); // Expected result + QVector before; + before << QPointF(30.0, 39.999874015748034); + before << QPointF(785.9055118110236, 39.999874015748034); + before << QPointF(785.9055118110236, 3819.527433070866); + before << QPointF(483.54330708661416, 3819.527433070866); + before << QPointF(483.54330708661416, 1929.763653543307); + before << QPointF(407.9527559055629, 984.8817637795973); + before << QPointF(407.9527559055118, 1929.763653543307); + before << QPointF(407.9527559055118, 3819.527433070866); + before << QPointF(30.0, 3819.527433070866); - // Begin comparison - Comparison(ekv, ekvOrig); + QVector expect; + expect << QPointF(30.0, 39.999874015748034); + expect << QPointF(785.9055118110236, 39.999874015748034); + expect << QPointF(785.9055118110236, 3819.527433070866); + expect << QPointF(483.54330708661416, 3819.527433070866); + expect << QPointF(483.54330708661416, 1929.763653543307); + expect << QPointF(407.9527559055629, 984.8817637795973); + expect << QPointF(407.9527559055118, 3819.527433070866); + expect << QPointF(30.0, 3819.527433070866); + + QTest::newRow("Test case issue #548") << before << expect; } //--------------------------------------------------------------------------------------------------------------------- -void TST_VAbstractDetail::Case2() const +void TST_VAbstractDetail::TestCorrectEquidistantPoints() const { - const QVector points = InputPointsCase2(); // Input points. - const EquidistantType eqv = EquidistantType::CloseEquidistant; // Closed path - const qreal width = 37.7953; // seam allowance width + QFETCH(QVector, before); + QFETCH(QVector, expect); - const QVector ekv = VAbstractDetail::Equidistant(points, eqv, width);// Take result - const QVector ekvOrig = OutputPointsCase2(); // Expected result - - // Begin comparison - Comparison(ekv, ekvOrig); + QVector after = VAbstractDetail::CorrectEquidistantPoints(before); + Comparison(after, expect); } //--------------------------------------------------------------------------------------------------------------------- @@ -567,41 +645,27 @@ QVector TST_VAbstractDetail::OutputPointsCase1() const { QVector points; - points += QPointF(-52.3725, -35.5907); - points += QPointF(487.711, -35.5907); - points += QPointF(493.343, 473.326); - points += QPointF(385.981, 506.845); - points += QPointF(345.647, 447.143); - points += QPointF(326.825, 417.766); - points += QPointF(297.492, 369.749); - points += QPointF(280.344, 340.638); - points += QPointF(268.238, 345.564); - points += QPointF(254.389, 348.788); - points += QPointF(240.894, 350.022); - points += QPointF(224.296, 349.294); - points += QPointF(205.506, 345.316); - points += QPointF(188.726, 339.383); - points += QPointF(173.487, 332.257); - points += QPointF(159.093, 324.152); - points += QPointF(145.156, 315.146); - points += QPointF(131.469, 305.281); - points += QPointF(117.936, 294.59); - points += QPointF(104.527, 283.112); - points += QPointF(91.2504, 270.888); - points += QPointF(78.1433, 257.963); - points += QPointF(65.2575, 244.383); - points += QPointF(52.6567, 230.194); - points += QPointF(40.4121, 215.44); - points += QPointF(28.6008, 200.16); - points += QPointF(17.3047, 184.387); - points += QPointF(6.61028, 168.141); - points += QPointF(-3.38943, 151.431); - points += QPointF(-12.5922, 134.245); - points += QPointF(-20.8806, 116.548); - points += QPointF(-28.1111, 98.2771); - points += QPointF(-34.0981, 79.3367); - points += QPointF(-38.4416, 60.2487); - points += QPointF(-52.3725, -35.5907); + points += QPointF(-52.3724798442221, -35.5907); + points += QPointF(487.7117748779425, -35.5907); + points += QPointF(493.3486932130227, 473.81998224542247); + points += QPointF(384.7625023736152, 506.7228642416019); + points += QPointF(326.77984549201204, 417.71265429523794); + points += QPointF(280.4343843787976, 340.220616520921); + points += QPointF(269.00223298277206, 346.06212334710335); + points += QPointF(239.6571136552229, 350.73379418002804); + points += QPointF(205.89523544191223, 345.8623563310819); + points += QPointF(173.89027296099863, 332.6512960877336); + points += QPointF(145.31523414712046, 315.34576260355936); + points += QPointF(117.9921341644787, 294.6948297428524); + points += QPointF(91.25349438209683, 270.93768759082707); + points += QPointF(65.22541125346564, 244.39379519957222); + points += QPointF(40.34791988062461, 215.4153238967542); + points += QPointF(17.205314383747528, 184.31949780808853); + points += QPointF(-3.534416178847685, 151.30687894362717); + points += QPointF(-21.090087790322336, 116.33389217738734); + points += QPointF(-33.795079640648055, 80.66898804409438); + points += QPointF(-38.441724866417594, 60.24852451858777); + points += QPointF(-52.3724798442221, -35.5907); return points; } @@ -685,52 +749,32 @@ QVector TST_VAbstractDetail::OutputPointsCase2() const { QVector points; - points += QPointF(-2.79526, 4.83848); - points += QPointF(67.3445, -0.232496); - points += QPointF(73.1172, 39.482); - points += QPointF(75.4242, 49.6203); - points += QPointF(78.7941, 60.2814); - points += QPointF(83.273, 71.5993); - points += QPointF(88.7999, 83.3999); - points += QPointF(95.2925, 95.5245); - points += QPointF(102.656, 107.829); - points += QPointF(110.787, 120.18); - points += QPointF(119.578, 132.456); - points += QPointF(128.919, 144.54); - points += QPointF(138.697, 156.322); - points += QPointF(148.796, 167.694); - points += QPointF(159.098, 178.552); - points += QPointF(169.482, 188.791); - points += QPointF(179.818, 198.308); - points += QPointF(189.972, 207); - points += QPointF(199.794, 214.759); - points += QPointF(209.115, 221.477); - points += QPointF(216.034, 225.948); - points += QPointF(215.311, 223.266); - points += QPointF(212.945, 216.109); - points += QPointF(205.759, 194.78); - points += QPointF(197.889, 169.298); - points += QPointF(193.975, 155.081); - points += QPointF(191.164, 142.904); - points += QPointF(189.364, 131.496); - points += QPointF(189.144, 117.752); - points += QPointF(194.429, 100.985); - points += QPointF(210.02, 85.4196); - points += QPointF(231.367, 81.4782); - points += QPointF(246.493, 85.8976); - points += QPointF(256.602, 92.4352); - points += QPointF(264.477, 100.216); - points += QPointF(270.989, 108.11); - points += QPointF(280.35, 121.002); - points += QPointF(294.425, 142.543); - points += QPointF(318.564, 182.007); - points += QPointF(355.648, 245.077); - points += QPointF(394.726, 311.416); - points += QPointF(422.951, 357.621); - points += QPointF(440.373, 384.812); - points += QPointF(488.279, 455.72); - points += QPointF(-2.79526, 455.75); - points += QPointF(-2.79526, 4.83848); + points += QPointF(-2.7952999999999975, 5.7719918429762656); + points += QPointF(65.32544836315374, -0.992801551243895); + points += QPointF(75.43676015393824, 49.41505784459415); + points += QPointF(83.37769389516122, 71.70650391130641); + points += QPointF(95.36495808942361, 95.58656052818594); + points += QPointF(110.83634280812595, 120.21325109595534); + points += QPointF(128.9510900596877, 144.55333805162292); + points += QPointF(148.8122943732712, 167.68860240021857); + points += QPointF(169.48075280895182, 188.76665620458672); + points += QPointF(189.9439329177606, 206.94808512857375); + points += QPointF(209.03488292644147, 221.3771186982216); + points += QPointF(215.73126220022726, 225.4325608097815); + points += QPointF(215.09342206269645, 222.63086681417994); + points += QPointF(205.6867557893074, 194.5606373284329); + points += QPointF(193.90240551299544, 154.91725528228594); + points += QPointF(189.00923093023508, 130.4332749760628); + points += QPointF(191.70730467606634, 97.53824783614445); + points += QPointF(229.19819583315143, 77.54897644999551); + points += QPointF(256.3345313737502, 91.70119126633715); + points += QPointF(270.9082046450185, 107.89162042078927); + points += QPointF(294.3626891097502, 142.42241251279827); + points += QPointF(355.51936324849004, 244.86019492195868); + points += QPointF(422.97357725399365, 357.6471728523805); + points += QPointF(486.8597146913536, 455.7199210117685); + points += QPointF(-2.795300000000013, 455.7506738094777); + points += QPointF(-2.7952999999999975, 5.7719918429762656); return points; } diff --git a/src/test/ValentinaTest/tst_vabstractdetail.h b/src/test/ValentinaTest/tst_vabstractdetail.h index f31ceb633..687443f42 100644 --- a/src/test/ValentinaTest/tst_vabstractdetail.h +++ b/src/test/ValentinaTest/tst_vabstractdetail.h @@ -40,15 +40,16 @@ public: signals: private slots: + void EquidistantRemoveLoop_data(); void EquidistantRemoveLoop() const; void SumTrapezoids() const; void PathRemoveLoop_data() const; void PathRemoveLoop() const; void BrokenDetailEquidistant() const; + void TestCorrectEquidistantPoints_data(); + void TestCorrectEquidistantPoints() const; private: - void Case1() const; - void Case2() const; void Case3() const; void Case4() const; void Case5() const; diff --git a/src/test/ValentinaTest/tst_vdetail.cpp b/src/test/ValentinaTest/tst_vdetail.cpp index 15bb16b6a..db332b164 100644 --- a/src/test/ValentinaTest/tst_vdetail.cpp +++ b/src/test/ValentinaTest/tst_vdetail.cpp @@ -99,40 +99,17 @@ void TST_VDetail::ClearLoop() const QVector pointsEkv = detail.SeamAllowancePoints(data); QVector origPoints; - origPoints.append(QPointF(42.464056596, 415.284547056)); - origPoints.append(QPointF(669.471111282, 560.191213853)); - origPoints.append(QPointF(669.386058691, 594.870268822)); - origPoints.append(QPointF(669.853724171, 619.849997563)); - origPoints.append(QPointF(670.904422406, 642.3178846)); - origPoints.append(QPointF(672.476094621, 662.479332552)); - origPoints.append(QPointF(674.504307528, 680.4882883)); - origPoints.append(QPointF(676.923618554, 696.502389941)); - origPoints.append(QPointF(679.668504965, 710.685043438)); - origPoints.append(QPointF(682.675134578, 723.207854677)); - origPoints.append(QPointF(685.884182534, 734.253021932)); - origPoints.append(QPointF(689.244614632, 744.014989124)); - origPoints.append(QPointF(692.717799245, 752.700488615)); - origPoints.append(QPointF(696.244854868, 760.447827851)); - origPoints.append(QPointF(701.80053872, 771.230129596)); - origPoints.append(QPointF(709.490850269, 784.462136001)); - origPoints.append(QPointF(713.209035073, 790.761640932)); - origPoints.append(QPointF(715.012191536, 793.76372792)); - origPoints.append(QPointF(718.780883478, 799.17428152)); - origPoints.append(QPointF(722.57235226, 803.731752263)); - origPoints.append(QPointF(726.490081061, 807.667595608)); - origPoints.append(QPointF(730.558043385, 811.069205493)); - origPoints.append(QPointF(734.817246318, 814.013788881)); - origPoints.append(QPointF(739.318992666, 816.561622842)); - origPoints.append(QPointF(744.115969332, 818.753220198)); - origPoints.append(QPointF(749.253944798, 820.61090345)); - origPoints.append(QPointF(754.766262359, 822.143554621)); - origPoints.append(QPointF(760.671847372, 823.352504448)); - origPoints.append(QPointF(766.976111339, 824.236813134)); - origPoints.append(QPointF(773.673526571, 824.797038187)); - origPoints.append(QPointF(780.661572758, 825.034345703)); - origPoints.append(QPointF(791.720374143, 824.854420471)); - origPoints.append(QPointF(825.821175407, 821.455180638)); - origPoints.append(QPointF(828.685875399, 1697.30583347)); + origPoints.append(QPointF(42.46405659601934, 415.2845470563871)); + origPoints.append(QPointF(668.6348763356573, 559.9979528395143)); + origPoints.append(QPointF(672.5077340045727, 662.2773194632347)); + origPoints.append(QPointF(682.7797640244206, 723.1972585208631)); + origPoints.append(QPointF(696.5440854182214, 760.8937002484754)); + origPoints.append(QPointF(714.3917818918, 792.5896577365422)); + origPoints.append(QPointF(730.8871996023822, 810.8059842268941)); + origPoints.append(QPointF(749.7001857069857, 820.4573142312262)); + origPoints.append(QPointF(774.1450140007969, 824.7139100366174)); + origPoints.append(QPointF(825.8284608555382, 823.6826266774736)); + origPoints.append(QPointF(828.6858753986579, 1697.305833468011)); // Begin comparison Comparison(pointsEkv, origPoints);