2014-12-11 16:12:16 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vpatternconverter.cpp
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 11 12, 2014
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2014-12-11 16:12:16 +01:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2014-12-11 16:12:16 +01:00
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
|
|
**
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "vpatternconverter.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
|
|
|
|
#include <QDir>
|
|
|
|
#include <QDomNode>
|
|
|
|
#include <QDomNodeList>
|
|
|
|
#include <QDomText>
|
|
|
|
#include <QFile>
|
|
|
|
#include <QFileInfo>
|
|
|
|
#include <QLatin1String>
|
|
|
|
#include <QList>
|
|
|
|
#include <QStaticStringData>
|
|
|
|
#include <QStringData>
|
|
|
|
#include <QStringDataPtr>
|
|
|
|
#include <algorithm>
|
|
|
|
|
2016-08-05 12:41:02 +02:00
|
|
|
#include "../exception/vexception.h"
|
|
|
|
#include "../exception/vexceptionemptyparameter.h"
|
2015-08-27 10:25:11 +02:00
|
|
|
#include "../qmuparser/qmutokenparser.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "../vmisc/def.h"
|
2016-08-09 15:55:46 +02:00
|
|
|
#include "vabstractconverter.h"
|
2014-12-11 16:12:16 +01:00
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
class QDomElement;
|
2014-12-11 21:54:33 +01:00
|
|
|
|
2014-12-12 10:47:12 +01:00
|
|
|
/*
|
|
|
|
* Version rules:
|
|
|
|
* 1. Version have three parts "major.minor.patch";
|
|
|
|
* 2. major part only for stable releases;
|
|
|
|
* 3. minor - 10 or more patch changes, or one big change;
|
|
|
|
* 4. patch - little change.
|
|
|
|
*/
|
|
|
|
|
2014-12-27 12:15:34 +01:00
|
|
|
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
|
2018-03-05 11:05:59 +01:00
|
|
|
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.7.7");
|
|
|
|
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.7.7.xsd");
|
2014-12-11 20:44:48 +01:00
|
|
|
|
2016-08-05 12:17:05 +02:00
|
|
|
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
|
|
|
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
2016-07-07 17:04:26 +02:00
|
|
|
|
2016-08-20 11:14:53 +02:00
|
|
|
// The list of all string we use for conversion
|
|
|
|
// Better to use global variables because repeating QStringLiteral blows up code size
|
2017-01-25 14:47:55 +01:00
|
|
|
static const QString strUnit = QStringLiteral("unit");
|
|
|
|
static const QString strVersion = QStringLiteral("version");
|
|
|
|
static const QString strName = QStringLiteral("name");
|
|
|
|
static const QString strBase = QStringLiteral("base");
|
|
|
|
static const QString strFormula = QStringLiteral("formula");
|
|
|
|
static const QString strId = QStringLiteral("id");
|
|
|
|
static const QString strKGrowth = QStringLiteral("kgrowth");
|
|
|
|
static const QString strKSize = QStringLiteral("ksize");
|
|
|
|
static const QString strPoint = QStringLiteral("point");
|
|
|
|
static const QString strLength = QStringLiteral("length");
|
|
|
|
static const QString strAngle = QStringLiteral("angle");
|
|
|
|
static const QString strC1Radius = QStringLiteral("c1Radius");
|
|
|
|
static const QString strC2Radius = QStringLiteral("c2Radius");
|
|
|
|
static const QString strCRadius = QStringLiteral("cRadius");
|
|
|
|
static const QString strArc = QStringLiteral("arc");
|
|
|
|
static const QString strAngle1 = QStringLiteral("angle1");
|
|
|
|
static const QString strAngle2 = QStringLiteral("angle2");
|
|
|
|
static const QString strRadius = QStringLiteral("radius");
|
|
|
|
static const QString strPathPoint = QStringLiteral("pathPoint");
|
|
|
|
static const QString strKAsm1 = QStringLiteral("kAsm1");
|
|
|
|
static const QString strKAsm2 = QStringLiteral("kAsm2");
|
|
|
|
static const QString strPath = QStringLiteral("path");
|
|
|
|
static const QString strType = QStringLiteral("type");
|
|
|
|
static const QString strCutArc = QStringLiteral("cutArc");
|
|
|
|
static const QString strSpline = QStringLiteral("spline");
|
|
|
|
static const QString strSplinePath = QStringLiteral("splinePath");
|
|
|
|
static const QString strCutSpline = QStringLiteral("cutSpline");
|
|
|
|
static const QString strCutSplinePath = QStringLiteral("cutSplinePath");
|
|
|
|
static const QString strColor = QStringLiteral("color");
|
|
|
|
static const QString strMeasurements = QStringLiteral("measurements");
|
|
|
|
static const QString strIncrement = QStringLiteral("increment");
|
|
|
|
static const QString strIncrements = QStringLiteral("increments");
|
2017-09-02 13:47:44 +02:00
|
|
|
static const QString strPreviewCalculations = QStringLiteral("previewCalculations");
|
2017-01-25 14:47:55 +01:00
|
|
|
static const QString strModeling = QStringLiteral("modeling");
|
|
|
|
static const QString strTools = QStringLiteral("tools");
|
|
|
|
static const QString strIdTool = QStringLiteral("idTool");
|
|
|
|
static const QString strIdObject = QStringLiteral("idObject");
|
|
|
|
static const QString strChildren = QStringLiteral("children");
|
|
|
|
static const QString strChild = QStringLiteral("child");
|
|
|
|
static const QString strPointOfIntersectionCurves = QStringLiteral("pointOfIntersectionCurves");
|
|
|
|
static const QString strCurveIntersectAxis = QStringLiteral("curveIntersectAxis");
|
|
|
|
static const QString strCurve = QStringLiteral("curve");
|
|
|
|
static const QString strCurve1 = QStringLiteral("curve1");
|
|
|
|
static const QString strCurve2 = QStringLiteral("curve2");
|
|
|
|
static const QString strModelingPath = QStringLiteral("modelingPath");
|
|
|
|
static const QString strModelingSpline = QStringLiteral("modelingSpline");
|
|
|
|
static const QString strPointFromArcAndTangent = QStringLiteral("pointFromArcAndTangent");
|
|
|
|
static const QString strPointOfIntersectionArcs = QStringLiteral("pointOfIntersectionArcs");
|
|
|
|
static const QString strFirstArc = QStringLiteral("firstArc");
|
|
|
|
static const QString strSecondArc = QStringLiteral("secondArc");
|
|
|
|
static const QString strDetail = QStringLiteral("detail");
|
|
|
|
static const QString strSupplement = QStringLiteral("supplement");
|
|
|
|
static const QString strClosed = QStringLiteral("closed");
|
|
|
|
static const QString strWidth = QStringLiteral("width");
|
2017-03-14 12:54:15 +01:00
|
|
|
static const QString strHeight = QStringLiteral("height");
|
2017-01-25 14:47:55 +01:00
|
|
|
static const QString strNode = QStringLiteral("node");
|
|
|
|
static const QString strNodes = QStringLiteral("nodes");
|
|
|
|
static const QString strData = QStringLiteral("data");
|
|
|
|
static const QString strPatternInfo = QStringLiteral("patternInfo");
|
|
|
|
static const QString strGrainline = QStringLiteral("grainline");
|
|
|
|
static const QString strReverse = QStringLiteral("reverse");
|
|
|
|
static const QString strMx = QStringLiteral("mx");
|
|
|
|
static const QString strMy = QStringLiteral("my");
|
|
|
|
static const QString strForbidFlipping = QStringLiteral("forbidFlipping");
|
|
|
|
static const QString strInLayout = QStringLiteral("inLayout");
|
|
|
|
static const QString strSeamAllowance = QStringLiteral("seamAllowance");
|
|
|
|
static const QString strNodeType = QStringLiteral("nodeType");
|
|
|
|
static const QString strDet = QStringLiteral("det");
|
|
|
|
static const QString strTypeObject = QStringLiteral("typeObject");
|
2017-02-04 12:28:47 +01:00
|
|
|
static const QString strReadOnly = QStringLiteral("readOnly");
|
2017-08-16 15:39:16 +02:00
|
|
|
static const QString strPatternLabel = QStringLiteral("patternLabel");
|
|
|
|
static const QString strImage = QStringLiteral("image");
|
|
|
|
static const QString strAuthor = QStringLiteral("author");
|
|
|
|
static const QString strDescription = QStringLiteral("description");
|
|
|
|
static const QString strNotes = QStringLiteral("notes");
|
|
|
|
static const QString strGradation = QStringLiteral("gradation");
|
|
|
|
static const QString strPatternName = QStringLiteral("patternName");
|
|
|
|
static const QString strPatternNum = QStringLiteral("patternNumber");
|
|
|
|
static const QString strCompanyName = QStringLiteral("company");
|
|
|
|
static const QString strCustomerName = QStringLiteral("customer");
|
|
|
|
static const QString strLine = QStringLiteral("line");
|
|
|
|
static const QString strText = QStringLiteral("text");
|
|
|
|
static const QString strBold = QStringLiteral("bold");
|
|
|
|
static const QString strItalic = QStringLiteral("italic");
|
|
|
|
static const QString strAlignment = QStringLiteral("alignment");
|
|
|
|
static const QString strFSIncrement = QStringLiteral("sfIncrement");
|
|
|
|
static const QString strShowDate = QStringLiteral("showDate");
|
|
|
|
static const QString strShowMeasurements = QStringLiteral("showMeasurements");
|
|
|
|
static const QString strSize = QStringLiteral("size");
|
2017-08-18 08:02:03 +02:00
|
|
|
static const QString strMCP = QStringLiteral("mcp");
|
|
|
|
static const QString strLetter = QStringLiteral("letter");
|
|
|
|
static const QString strMaterial = QStringLiteral("material");
|
|
|
|
static const QString strUserDefined = QStringLiteral("userDef");
|
|
|
|
static const QString strPlacement = QStringLiteral("placement");
|
2017-09-18 08:11:39 +02:00
|
|
|
static const QString strCutNumber = QStringLiteral("cutNumber");
|
|
|
|
static const QString strQuantity = QStringLiteral("quantity");
|
2016-08-20 11:14:53 +02:00
|
|
|
|
2014-12-11 16:12:16 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-12-11 16:51:24 +01:00
|
|
|
VPatternConverter::VPatternConverter(const QString &fileName)
|
2017-02-04 12:28:47 +01:00
|
|
|
: VAbstractConverter(fileName)
|
2014-12-11 16:12:16 +01:00
|
|
|
{
|
2016-01-19 16:25:46 +01:00
|
|
|
ValidateInputFile(CurrentSchema);
|
2014-12-11 16:12:16 +01:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:16:03 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VPatternConverter::XSDSchema(int ver) const
|
|
|
|
{
|
2017-11-17 11:28:57 +01:00
|
|
|
QHash <int, QString> schemas =
|
2014-12-11 21:16:03 +01:00
|
|
|
{
|
2017-11-17 11:28:57 +01:00
|
|
|
std::make_pair(0x000100, QStringLiteral("://schema/pattern/v0.1.0.xsd")),
|
|
|
|
std::make_pair(0x000101, QStringLiteral("://schema/pattern/v0.1.1.xsd")),
|
|
|
|
std::make_pair(0x000102, QStringLiteral("://schema/pattern/v0.1.2.xsd")),
|
|
|
|
std::make_pair(0x000103, QStringLiteral("://schema/pattern/v0.1.3.xsd")),
|
|
|
|
std::make_pair(0x000104, QStringLiteral("://schema/pattern/v0.1.4.xsd")),
|
|
|
|
std::make_pair(0x000200, QStringLiteral("://schema/pattern/v0.2.0.xsd")),
|
|
|
|
std::make_pair(0x000201, QStringLiteral("://schema/pattern/v0.2.1.xsd")),
|
|
|
|
std::make_pair(0x000202, QStringLiteral("://schema/pattern/v0.2.2.xsd")),
|
|
|
|
std::make_pair(0x000203, QStringLiteral("://schema/pattern/v0.2.3.xsd")),
|
|
|
|
std::make_pair(0x000204, QStringLiteral("://schema/pattern/v0.2.4.xsd")),
|
|
|
|
std::make_pair(0x000205, QStringLiteral("://schema/pattern/v0.2.5.xsd")),
|
|
|
|
std::make_pair(0x000206, QStringLiteral("://schema/pattern/v0.2.6.xsd")),
|
|
|
|
std::make_pair(0x000207, QStringLiteral("://schema/pattern/v0.2.7.xsd")),
|
|
|
|
std::make_pair(0x000300, QStringLiteral("://schema/pattern/v0.3.0.xsd")),
|
|
|
|
std::make_pair(0x000301, QStringLiteral("://schema/pattern/v0.3.1.xsd")),
|
|
|
|
std::make_pair(0x000302, QStringLiteral("://schema/pattern/v0.3.2.xsd")),
|
|
|
|
std::make_pair(0x000303, QStringLiteral("://schema/pattern/v0.3.3.xsd")),
|
|
|
|
std::make_pair(0x000304, QStringLiteral("://schema/pattern/v0.3.4.xsd")),
|
|
|
|
std::make_pair(0x000305, QStringLiteral("://schema/pattern/v0.3.5.xsd")),
|
|
|
|
std::make_pair(0x000306, QStringLiteral("://schema/pattern/v0.3.6.xsd")),
|
|
|
|
std::make_pair(0x000307, QStringLiteral("://schema/pattern/v0.3.7.xsd")),
|
|
|
|
std::make_pair(0x000308, QStringLiteral("://schema/pattern/v0.3.8.xsd")),
|
|
|
|
std::make_pair(0x000309, QStringLiteral("://schema/pattern/v0.3.9.xsd")),
|
|
|
|
std::make_pair(0x000400, QStringLiteral("://schema/pattern/v0.4.0.xsd")),
|
|
|
|
std::make_pair(0x000401, QStringLiteral("://schema/pattern/v0.4.1.xsd")),
|
|
|
|
std::make_pair(0x000402, QStringLiteral("://schema/pattern/v0.4.2.xsd")),
|
|
|
|
std::make_pair(0x000403, QStringLiteral("://schema/pattern/v0.4.3.xsd")),
|
|
|
|
std::make_pair(0x000404, QStringLiteral("://schema/pattern/v0.4.4.xsd")),
|
|
|
|
std::make_pair(0x000405, QStringLiteral("://schema/pattern/v0.4.5.xsd")),
|
|
|
|
std::make_pair(0x000406, QStringLiteral("://schema/pattern/v0.4.6.xsd")),
|
|
|
|
std::make_pair(0x000407, QStringLiteral("://schema/pattern/v0.4.7.xsd")),
|
|
|
|
std::make_pair(0x000408, QStringLiteral("://schema/pattern/v0.4.8.xsd")),
|
|
|
|
std::make_pair(0x000500, QStringLiteral("://schema/pattern/v0.5.0.xsd")),
|
|
|
|
std::make_pair(0x000501, QStringLiteral("://schema/pattern/v0.5.1.xsd")),
|
|
|
|
std::make_pair(0x000600, QStringLiteral("://schema/pattern/v0.6.0.xsd")),
|
|
|
|
std::make_pair(0x000601, QStringLiteral("://schema/pattern/v0.6.1.xsd")),
|
|
|
|
std::make_pair(0x000602, QStringLiteral("://schema/pattern/v0.6.2.xsd")),
|
|
|
|
std::make_pair(0x000603, QStringLiteral("://schema/pattern/v0.6.3.xsd")),
|
|
|
|
std::make_pair(0x000604, QStringLiteral("://schema/pattern/v0.6.4.xsd")),
|
|
|
|
std::make_pair(0x000605, QStringLiteral("://schema/pattern/v0.6.5.xsd")),
|
|
|
|
std::make_pair(0x000606, QStringLiteral("://schema/pattern/v0.6.6.xsd")),
|
|
|
|
std::make_pair(0x000700, QStringLiteral("://schema/pattern/v0.7.0.xsd")),
|
|
|
|
std::make_pair(0x000701, QStringLiteral("://schema/pattern/v0.7.1.xsd")),
|
|
|
|
std::make_pair(0x000702, QStringLiteral("://schema/pattern/v0.7.2.xsd")),
|
2017-12-17 14:06:46 +01:00
|
|
|
std::make_pair(0x000703, QStringLiteral("://schema/pattern/v0.7.3.xsd")),
|
2018-01-03 18:31:50 +01:00
|
|
|
std::make_pair(0x000704, QStringLiteral("://schema/pattern/v0.7.4.xsd")),
|
2018-02-04 11:35:27 +01:00
|
|
|
std::make_pair(0x000705, QStringLiteral("://schema/pattern/v0.7.5.xsd")),
|
2018-03-05 11:05:59 +01:00
|
|
|
std::make_pair(0x000706, QStringLiteral("://schema/pattern/v0.7.6.xsd")),
|
|
|
|
std::make_pair(0x000707, CurrentSchema)
|
2017-11-17 11:28:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
if (schemas.contains(ver))
|
|
|
|
{
|
|
|
|
return schemas.value(ver);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
InvalidVersion(ver);
|
2014-12-11 21:16:03 +01:00
|
|
|
}
|
|
|
|
}
|
2014-12-11 21:54:33 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-12-16 08:42:24 +01:00
|
|
|
void VPatternConverter::ApplyPatches()
|
2014-12-11 21:54:33 +01:00
|
|
|
{
|
2017-02-04 12:28:47 +01:00
|
|
|
switch (m_ver)
|
2014-12-11 21:54:33 +01:00
|
|
|
{
|
2017-02-04 12:28:47 +01:00
|
|
|
case (0x000100):
|
|
|
|
ToV0_1_1();
|
|
|
|
ValidateXML(XSDSchema(0x000101), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000101):
|
|
|
|
ToV0_1_2();
|
|
|
|
ValidateXML(XSDSchema(0x000102), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000102):
|
|
|
|
ToV0_1_3();
|
|
|
|
ValidateXML(XSDSchema(0x000103), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000103):
|
|
|
|
ToV0_1_4();
|
|
|
|
ValidateXML(XSDSchema(0x000104), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000104):
|
|
|
|
ToV0_2_0();
|
|
|
|
ValidateXML(XSDSchema(0x000200), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000200):
|
|
|
|
ToV0_2_1();
|
|
|
|
ValidateXML(XSDSchema(0x000201), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000201):
|
|
|
|
ToV0_2_2();
|
|
|
|
ValidateXML(XSDSchema(0x000202), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000202):
|
|
|
|
ToV0_2_3();
|
|
|
|
ValidateXML(XSDSchema(0x000203), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000203):
|
|
|
|
ToV0_2_4();
|
|
|
|
ValidateXML(XSDSchema(0x000204), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000204):
|
|
|
|
ToV0_2_5();
|
|
|
|
ValidateXML(XSDSchema(0x000205), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000205):
|
|
|
|
ToV0_2_6();
|
|
|
|
ValidateXML(XSDSchema(0x000206), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000206):
|
|
|
|
ToV0_2_7();
|
|
|
|
ValidateXML(XSDSchema(0x000207), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000207):
|
|
|
|
ToV0_3_0();
|
|
|
|
ValidateXML(XSDSchema(0x000300), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000300):
|
|
|
|
ToV0_3_1();
|
|
|
|
ValidateXML(XSDSchema(0x000301), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000301):
|
|
|
|
ToV0_3_2();
|
|
|
|
ValidateXML(XSDSchema(0x000302), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000302):
|
|
|
|
ToV0_3_3();
|
|
|
|
ValidateXML(XSDSchema(0x000303), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000303):
|
|
|
|
ToV0_3_4();
|
|
|
|
ValidateXML(XSDSchema(0x000304), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000304):
|
|
|
|
ToV0_3_5();
|
|
|
|
ValidateXML(XSDSchema(0x000305), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000305):
|
|
|
|
ToV0_3_6();
|
|
|
|
ValidateXML(XSDSchema(0x000306), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000306):
|
|
|
|
ToV0_3_7();
|
|
|
|
ValidateXML(XSDSchema(0x000307), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000307):
|
|
|
|
ToV0_3_8();
|
|
|
|
ValidateXML(XSDSchema(0x000308), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000308):
|
|
|
|
ToV0_3_9();
|
|
|
|
ValidateXML(XSDSchema(0x000309), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000309):
|
|
|
|
ToV0_4_0();
|
|
|
|
ValidateXML(XSDSchema(0x000400), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000400):
|
2017-02-13 14:29:37 +01:00
|
|
|
ToV0_4_1();
|
|
|
|
ValidateXML(XSDSchema(0x000401), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000401):
|
2017-02-22 13:48:48 +01:00
|
|
|
ToV0_4_2();
|
|
|
|
ValidateXML(XSDSchema(0x000402), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000402):
|
2017-03-09 12:10:46 +01:00
|
|
|
ToV0_4_3();
|
|
|
|
ValidateXML(XSDSchema(0x000403), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000403):
|
2017-03-10 18:14:14 +01:00
|
|
|
ToV0_4_4();
|
|
|
|
ValidateXML(XSDSchema(0x000404), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000404):
|
2017-03-21 16:18:48 +01:00
|
|
|
ToV0_4_5();
|
|
|
|
ValidateXML(XSDSchema(0x000405), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000405):
|
2017-03-24 13:48:07 +01:00
|
|
|
ToV0_4_6();
|
|
|
|
ValidateXML(XSDSchema(0x000406), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000406):
|
2017-04-05 12:22:33 +02:00
|
|
|
ToV0_4_7();
|
|
|
|
ValidateXML(XSDSchema(0x000407), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000407):
|
2017-04-25 10:42:08 +02:00
|
|
|
ToV0_4_8();
|
|
|
|
ValidateXML(XSDSchema(0x000408), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000408):
|
2017-05-16 12:07:53 +02:00
|
|
|
ToV0_5_0();
|
|
|
|
ValidateXML(XSDSchema(0x000500), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000500):
|
2017-07-20 16:38:56 +02:00
|
|
|
ToV0_5_1();
|
|
|
|
ValidateXML(XSDSchema(0x000501), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000501):
|
2017-08-15 10:17:54 +02:00
|
|
|
ToV0_6_0();
|
|
|
|
ValidateXML(XSDSchema(0x000600), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000600):
|
2017-08-30 07:55:07 +02:00
|
|
|
ToV0_6_1();
|
|
|
|
ValidateXML(XSDSchema(0x000601), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000601):
|
2017-09-02 13:47:44 +02:00
|
|
|
ToV0_6_2();
|
|
|
|
ValidateXML(XSDSchema(0x000602), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000602):
|
2017-09-17 18:52:18 +02:00
|
|
|
ToV0_6_3();
|
|
|
|
ValidateXML(XSDSchema(0x000603), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000603):
|
2017-09-26 11:54:52 +02:00
|
|
|
ToV0_6_4();
|
|
|
|
ValidateXML(XSDSchema(0x000604), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000604):
|
2017-09-28 20:18:13 +02:00
|
|
|
ToV0_6_5();
|
|
|
|
ValidateXML(XSDSchema(0x000605), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000605):
|
2017-10-11 12:51:06 +02:00
|
|
|
ToV0_6_6();
|
|
|
|
ValidateXML(XSDSchema(0x000606), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000606):
|
2017-10-15 11:25:20 +02:00
|
|
|
ToV0_7_0();
|
|
|
|
ValidateXML(XSDSchema(0x000700), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000700):
|
2017-10-27 10:53:35 +02:00
|
|
|
ToV0_7_1();
|
|
|
|
ValidateXML(XSDSchema(0x000701), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000701):
|
2017-11-13 18:39:11 +01:00
|
|
|
ToV0_7_2();
|
|
|
|
ValidateXML(XSDSchema(0x000702), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000702):
|
2017-11-17 11:28:57 +01:00
|
|
|
ToV0_7_3();
|
|
|
|
ValidateXML(XSDSchema(0x000703), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000703):
|
2017-12-17 14:06:46 +01:00
|
|
|
ToV0_7_4();
|
|
|
|
ValidateXML(XSDSchema(0x000704), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000704):
|
2018-01-03 18:31:50 +01:00
|
|
|
ToV0_7_5();
|
|
|
|
ValidateXML(XSDSchema(0x000705), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000705):
|
2018-02-04 11:35:27 +01:00
|
|
|
ToV0_7_6();
|
|
|
|
ValidateXML(XSDSchema(0x000706), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000706):
|
2018-03-05 11:05:59 +01:00
|
|
|
ToV0_7_7();
|
|
|
|
ValidateXML(XSDSchema(0x000707), m_convertedFileName);
|
|
|
|
V_FALLTHROUGH
|
|
|
|
case (0x000707):
|
2017-02-04 12:28:47 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
InvalidVersion(m_ver);
|
2014-12-11 21:54:33 +01:00
|
|
|
}
|
|
|
|
}
|
2014-12-16 08:42:24 +01:00
|
|
|
|
2016-01-19 16:25:46 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::DowngradeToCurrentMaxVersion()
|
|
|
|
{
|
|
|
|
SetVersion(PatternMaxVerStr);
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-02-04 12:28:47 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VPatternConverter::IsReadOnly() const
|
|
|
|
{
|
|
|
|
// Check if attribute readOnly was not changed in file format
|
2018-03-05 11:05:59 +01:00
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 7, 7),
|
2017-02-04 12:28:47 +01:00
|
|
|
"Check attribute readOnly.");
|
|
|
|
|
|
|
|
// Possibly in future attribute readOnly will change position etc.
|
|
|
|
// For now position is the same for all supported format versions.
|
|
|
|
// But don't forget to keep all versions of attribute until we support that format versions
|
|
|
|
|
|
|
|
const QDomElement pattern = documentElement();
|
|
|
|
|
|
|
|
if (pattern.isNull())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GetParametrBool(pattern, strReadOnly, falseStr);
|
|
|
|
}
|
|
|
|
|
2014-12-27 12:15:34 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_1_1()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.1.1
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 1, 1),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2014-12-27 12:15:34 +01:00
|
|
|
SetVersion(QStringLiteral("0.1.1"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2014-12-16 08:42:24 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-12-17 13:56:14 +01:00
|
|
|
void VPatternConverter::ToV0_1_2()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.1.2
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 1, 2),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2014-12-27 12:15:34 +01:00
|
|
|
SetVersion(QStringLiteral("0.1.2"));
|
2014-12-17 13:56:14 +01:00
|
|
|
Save();
|
|
|
|
}
|
2015-02-03 12:15:52 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_1_3()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.1.3
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 1, 3),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-02-03 12:15:52 +01:00
|
|
|
SetVersion(QStringLiteral("0.1.3"));
|
|
|
|
Save();
|
|
|
|
}
|
2015-05-28 11:07:52 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_1_4()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.1.4
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 1, 4),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-05-28 11:07:52 +02:00
|
|
|
SetVersion(QStringLiteral("0.1.4"));
|
|
|
|
Save();
|
|
|
|
}
|
2015-08-26 16:20:23 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_2_0()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-08-26 16:20:23 +02:00
|
|
|
SetVersion(QStringLiteral("0.2.0"));
|
2015-08-27 10:25:11 +02:00
|
|
|
TagUnitToV0_2_0();
|
|
|
|
TagIncrementToV0_2_0();
|
2015-09-07 15:51:13 +02:00
|
|
|
ConvertMeasurementsToV0_2_0();
|
2015-08-27 10:25:11 +02:00
|
|
|
TagMeasurementsToV0_2_0();//Alwayse last!!!
|
2015-08-26 16:20:23 +02:00
|
|
|
Save();
|
|
|
|
}
|
2015-08-27 10:25:11 +02:00
|
|
|
|
2015-11-11 15:26:48 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_2_1()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.1
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 1),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-11-11 15:26:48 +01:00
|
|
|
SetVersion(QStringLiteral("0.2.1"));
|
|
|
|
ConvertMeasurementsToV0_2_1();
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2015-12-11 15:19:11 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_2_2()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.2
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 2),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-12-11 15:19:11 +01:00
|
|
|
SetVersion(QStringLiteral("0.2.2"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2015-12-26 14:08:41 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_2_3()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.3
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 3),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-12-26 14:08:41 +01:00
|
|
|
SetVersion(QStringLiteral("0.2.3"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2016-01-07 17:43:08 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_2_4()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.4
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 4),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-01-07 17:43:08 +01:00
|
|
|
FixToolUnionToV0_2_4();
|
|
|
|
SetVersion(QStringLiteral("0.2.4"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2016-01-22 11:45:18 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_2_5()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.5
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 5),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-01-22 11:45:18 +01:00
|
|
|
SetVersion(QStringLiteral("0.2.5"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2016-02-16 14:38:08 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_2_6()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.6
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 6),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-02-16 14:38:08 +01:00
|
|
|
SetVersion(QStringLiteral("0.2.6"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2016-02-26 15:38:42 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_2_7()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.7
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 7),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-02-26 15:38:42 +01:00
|
|
|
SetVersion(QStringLiteral("0.2.7"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2016-04-07 18:56:41 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_3_0()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.3.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-08-20 16:32:45 +02:00
|
|
|
//Cutting path do not create anymore subpaths
|
|
|
|
FixCutPoint();
|
|
|
|
FixCutPoint();
|
2016-04-07 18:56:41 +02:00
|
|
|
SetVersion(QStringLiteral("0.3.0"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2016-05-13 19:33:52 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_3_1()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.3.1
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 1),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-05-13 19:33:52 +02:00
|
|
|
SetVersion(QStringLiteral("0.3.1"));
|
2016-05-19 14:40:55 +02:00
|
|
|
RemoveColorToolCutV0_3_1();
|
2016-05-13 19:33:52 +02:00
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2015-08-27 10:25:11 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-06-26 13:45:39 +02:00
|
|
|
void VPatternConverter::ToV0_3_2()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.3.2
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 2),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-06-26 13:45:39 +02:00
|
|
|
SetVersion(QStringLiteral("0.3.2"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-07-24 19:48:31 +02:00
|
|
|
void VPatternConverter::ToV0_3_3()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.3.3
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 3),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-07-24 19:48:31 +02:00
|
|
|
SetVersion(QStringLiteral("0.3.3"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2016-09-06 12:24:52 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_3_4()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.3.4
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 4),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-09-06 12:24:52 +02:00
|
|
|
SetVersion(QStringLiteral("0.3.4"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2016-09-13 10:27:44 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_3_5()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.3.5
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 5),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-09-13 10:27:44 +02:00
|
|
|
SetVersion(QStringLiteral("0.3.5"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2016-10-04 16:34:37 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_3_6()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.3.6
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 6),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-10-04 16:34:37 +02:00
|
|
|
SetVersion(QStringLiteral("0.3.6"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2016-10-16 20:38:29 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_3_7()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.3.7
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 7),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-10-16 20:38:29 +02:00
|
|
|
SetVersion(QStringLiteral("0.3.7"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2016-10-25 00:53:01 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_3_8()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.3.8
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 8),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-10-25 00:53:01 +02:00
|
|
|
SetVersion(QStringLiteral("0.3.8"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2016-12-19 14:14:13 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_3_9()
|
|
|
|
{
|
2017-02-22 06:54:42 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.3.9
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 9),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-12-19 14:14:13 +01:00
|
|
|
SetVersion(QStringLiteral("0.3.9"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2016-11-08 15:32:18 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_4_0()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.4.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-11-08 15:32:18 +01:00
|
|
|
SetVersion(QStringLiteral("0.4.0"));
|
2016-11-25 12:19:38 +01:00
|
|
|
TagRemoveAttributeTypeObjectInV0_4_0();
|
2016-11-08 15:32:18 +01:00
|
|
|
TagDetailToV0_4_0();
|
2017-01-18 14:17:16 +01:00
|
|
|
TagUnionDetailsToV0_4_0();
|
2016-11-08 15:32:18 +01:00
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-02-01 13:18:45 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_4_1()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.4.1
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 1),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
|
|
|
SetVersion(QStringLiteral("0.4.1"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-02-22 13:48:48 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_4_2()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.4.2
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 2),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
|
|
|
SetVersion(QStringLiteral("0.4.2"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-03-09 12:10:46 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_4_3()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.4.3
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 3),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
|
|
|
SetVersion(QStringLiteral("0.4.3"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-03-10 18:14:14 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_4_4()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.4.4
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 4),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
|
|
|
SetVersion(QStringLiteral("0.4.4"));
|
2017-03-14 12:54:15 +01:00
|
|
|
LabelTagToV0_4_4(strData);
|
|
|
|
LabelTagToV0_4_4(strPatternInfo);
|
2017-03-10 18:14:14 +01:00
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-03-21 16:18:48 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_4_5()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.4.5
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 5),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.4.5"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-03-24 13:48:07 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_4_6()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.4.6
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 6),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.4.6"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-04-05 12:22:33 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_4_7()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.4.7
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 7),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.4.7"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-04-25 10:42:08 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_4_8()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.4.8
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 8),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.4.8"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-05-16 12:07:53 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_5_0()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.5.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 5, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.5.0"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-07-20 16:38:56 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_5_1()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.5.1
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 5, 1),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.5.1"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-08-15 10:17:54 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_6_0()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.6.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.6.0"));
|
2017-08-16 15:39:16 +02:00
|
|
|
QDomElement label = AddTagPatternLabelV0_5_1();
|
2017-08-18 08:02:03 +02:00
|
|
|
PortPatternLabeltoV0_6_0(label);
|
|
|
|
PortPieceLabelstoV0_6_0();
|
2017-08-16 15:39:16 +02:00
|
|
|
RemoveUnusedTagsV0_6_0();
|
2017-08-15 10:17:54 +02:00
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-08-30 07:55:07 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_6_1()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.6.1
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 1),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.6.1"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-09-02 13:47:44 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_6_2()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.6.2
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 2),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.6.2"));
|
|
|
|
AddTagPreviewCalculationsV0_6_2();
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-09-17 18:52:18 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_6_3()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.6.3
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 3),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.6.3"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-09-26 11:54:52 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_6_4()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.6.4
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 4),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.6.4"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-09-28 20:18:13 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_6_5()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.6.5
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 5),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.6.5"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-10-11 12:51:06 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_6_6()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.6.6
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 6),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.6.6"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-10-15 11:25:20 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_7_0()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.7.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 7, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.7.0"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-10-27 10:53:35 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_7_1()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.7.1
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 7, 1),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.7.1"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-11-13 18:39:11 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_7_2()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.7.2
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 7, 2),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.7.2"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-11-17 11:28:57 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_7_3()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.7.3
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 7, 3),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.7.3"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2017-12-17 14:06:46 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_7_4()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.7.4
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 7, 4),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.7.4"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2018-01-03 18:31:50 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_7_5()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.7.5
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 7, 5),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.7.5"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2018-02-04 11:35:27 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_7_6()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.7.6
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 7, 6),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.7.6"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2018-03-05 11:05:59 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ToV0_7_7()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.7.7
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 7, 7),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
SetVersion(QStringLiteral("0.7.7"));
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2016-07-24 19:48:31 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-08-27 10:25:11 +02:00
|
|
|
void VPatternConverter::TagUnitToV0_2_0()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-08-20 11:14:53 +02:00
|
|
|
QDomElement unit = createElement(strUnit);
|
2015-08-27 10:25:11 +02:00
|
|
|
QDomText newNodeText = createTextNode(MUnitV0_1_4());
|
|
|
|
unit.appendChild(newNodeText);
|
|
|
|
|
|
|
|
QDomElement patternElement = documentElement();
|
2016-08-20 11:14:53 +02:00
|
|
|
patternElement.insertAfter(unit, patternElement.firstChildElement(strVersion));
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::TagIncrementToV0_2_0()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-08-27 10:25:11 +02:00
|
|
|
const QSet<QString> names = FixIncrementsToV0_2_0();
|
|
|
|
|
|
|
|
FixPointExpressionsToV0_2_0(names);
|
|
|
|
FixArcExpressionsToV0_2_0(names);
|
|
|
|
FixPathPointExpressionsToV0_2_0(names);
|
|
|
|
}
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ConvertMeasurementsToV0_2_0()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
const QMap<QString, QString> names = OldNamesToNewNames_InV0_2_0();
|
|
|
|
ConvertPointExpressionsToV0_2_0(names);
|
|
|
|
ConvertArcExpressionsToV0_2_0(names);
|
|
|
|
ConvertPathPointExpressionsToV0_2_0(names);
|
|
|
|
}
|
|
|
|
|
2015-08-27 10:25:11 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QSet<QString> VPatternConverter::FixIncrementsToV0_2_0()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-08-27 10:25:11 +02:00
|
|
|
QSet<QString> names;
|
2015-08-27 13:00:20 +02:00
|
|
|
const QDomElement incr = TagIncrementsV0_1_4();
|
|
|
|
QDomNode domNode = incr.firstChild();
|
2015-08-27 10:25:11 +02:00
|
|
|
while (domNode.isNull() == false)
|
|
|
|
{
|
|
|
|
if (domNode.isElement())
|
|
|
|
{
|
|
|
|
QDomElement domElement = domNode.toElement();
|
|
|
|
if (domElement.isNull() == false)
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
if (domElement.tagName() == strIncrement)
|
2015-08-27 10:25:11 +02:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
const QString name = GetParametrString(domElement, strName);
|
2015-08-27 10:25:11 +02:00
|
|
|
names.insert(name);
|
2016-08-20 11:14:53 +02:00
|
|
|
domElement.setAttribute(strName, QLatin1String("#")+name);
|
2015-08-27 10:25:11 +02:00
|
|
|
|
2016-08-20 11:14:53 +02:00
|
|
|
const QString base = GetParametrString(domElement, strBase);
|
|
|
|
domElement.setAttribute(strFormula, base);
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
VException excep("Can't get increment.");
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
|
|
|
}
|
2016-08-20 11:14:53 +02:00
|
|
|
domElement.removeAttribute(strId);
|
|
|
|
domElement.removeAttribute(strKGrowth);
|
|
|
|
domElement.removeAttribute(strKSize);
|
|
|
|
domElement.removeAttribute(strBase);
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
domNode = domNode.nextSibling();
|
|
|
|
}
|
|
|
|
return names;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::FixPointExpressionsToV0_2_0(const QSet<QString> &names)
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-08-27 10:25:11 +02:00
|
|
|
QString formula;
|
2016-08-20 11:14:53 +02:00
|
|
|
const QDomNodeList list = elementsByTagName(strPoint);
|
2015-08-27 10:25:11 +02:00
|
|
|
for (int i=0; i < list.size(); ++i)
|
|
|
|
{
|
|
|
|
QDomElement dom = list.at(i).toElement();
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strLength);
|
|
|
|
dom.setAttribute(strLength, FixIncrementInFormulaToV0_2_0(formula, names));
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strAngle);
|
|
|
|
dom.setAttribute(strAngle, FixIncrementInFormulaToV0_2_0(formula, names));
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strC1Radius);
|
|
|
|
dom.setAttribute(strC1Radius, FixIncrementInFormulaToV0_2_0(formula, names));
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strC2Radius);
|
|
|
|
dom.setAttribute(strC2Radius, FixIncrementInFormulaToV0_2_0(formula, names));
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strCRadius);
|
|
|
|
dom.setAttribute(strCRadius, FixIncrementInFormulaToV0_2_0(formula, names));
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::FixArcExpressionsToV0_2_0(const QSet<QString> &names)
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-08-27 10:25:11 +02:00
|
|
|
QString formula;
|
2016-08-20 11:14:53 +02:00
|
|
|
const QDomNodeList list = elementsByTagName(strArc);
|
2015-08-27 10:25:11 +02:00
|
|
|
for (int i=0; i < list.size(); ++i)
|
|
|
|
{
|
|
|
|
QDomElement dom = list.at(i).toElement();
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strAngle1);
|
|
|
|
dom.setAttribute(strAngle1, FixIncrementInFormulaToV0_2_0(formula, names));
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strAngle2);
|
|
|
|
dom.setAttribute(strAngle2, FixIncrementInFormulaToV0_2_0(formula, names));
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strRadius);
|
|
|
|
dom.setAttribute(strRadius, FixIncrementInFormulaToV0_2_0(formula, names));
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strLength);
|
|
|
|
dom.setAttribute(strLength, FixIncrementInFormulaToV0_2_0(formula, names));
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::FixPathPointExpressionsToV0_2_0(const QSet<QString> &names)
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-08-27 10:25:11 +02:00
|
|
|
QString formula;
|
2016-08-20 11:14:53 +02:00
|
|
|
const QDomNodeList list = elementsByTagName(strPathPoint);
|
2015-08-27 10:25:11 +02:00
|
|
|
for (int i=0; i < list.size(); ++i)
|
|
|
|
{
|
|
|
|
QDomElement dom = list.at(i).toElement();
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strKAsm1);
|
|
|
|
dom.setAttribute(strKAsm1, FixIncrementInFormulaToV0_2_0(formula, names));
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strKAsm2);
|
|
|
|
dom.setAttribute(strKAsm2, FixIncrementInFormulaToV0_2_0(formula, names));
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strAngle);
|
|
|
|
dom.setAttribute(strAngle, FixIncrementInFormulaToV0_2_0(formula, names));
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ConvertPointExpressionsToV0_2_0(const QMap<QString, QString> &names)
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
QString formula;
|
2016-08-20 11:14:53 +02:00
|
|
|
const QDomNodeList list = elementsByTagName(strPoint);
|
2015-09-07 15:51:13 +02:00
|
|
|
for (int i=0; i < list.size(); ++i)
|
|
|
|
{
|
|
|
|
QDomElement dom = list.at(i).toElement();
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strLength);
|
|
|
|
dom.setAttribute(strLength, FixMeasurementInFormulaToV0_2_0(formula, names));
|
2015-09-07 15:51:13 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strAngle);
|
|
|
|
dom.setAttribute(strAngle, FixMeasurementInFormulaToV0_2_0(formula, names));
|
2015-09-07 15:51:13 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strC1Radius);
|
|
|
|
dom.setAttribute(strC1Radius, FixMeasurementInFormulaToV0_2_0(formula, names));
|
2015-09-07 15:51:13 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strC2Radius);
|
|
|
|
dom.setAttribute(strC2Radius, FixMeasurementInFormulaToV0_2_0(formula, names));
|
2015-09-07 15:51:13 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strCRadius);
|
|
|
|
dom.setAttribute(strCRadius, FixMeasurementInFormulaToV0_2_0(formula, names));
|
2015-09-07 15:51:13 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ConvertArcExpressionsToV0_2_0(const QMap<QString, QString> &names)
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
QString formula;
|
2016-08-20 11:14:53 +02:00
|
|
|
const QDomNodeList list = elementsByTagName(strArc);
|
2015-09-07 15:51:13 +02:00
|
|
|
for (int i=0; i < list.size(); ++i)
|
|
|
|
{
|
|
|
|
QDomElement dom = list.at(i).toElement();
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strAngle1);
|
|
|
|
dom.setAttribute(strAngle1, FixMeasurementInFormulaToV0_2_0(formula, names));
|
2015-09-07 15:51:13 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strAngle2);
|
|
|
|
dom.setAttribute(strAngle2, FixMeasurementInFormulaToV0_2_0(formula, names));
|
2015-09-07 15:51:13 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strRadius);
|
|
|
|
dom.setAttribute(strRadius, FixMeasurementInFormulaToV0_2_0(formula, names));
|
2015-09-07 15:51:13 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strLength);
|
|
|
|
dom.setAttribute(strLength, FixMeasurementInFormulaToV0_2_0(formula, names));
|
2015-09-07 15:51:13 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ConvertPathPointExpressionsToV0_2_0(const QMap<QString, QString> &names)
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
QString formula;
|
2016-08-20 11:14:53 +02:00
|
|
|
const QDomNodeList list = elementsByTagName(strPathPoint);
|
2015-09-07 15:51:13 +02:00
|
|
|
for (int i=0; i < list.size(); ++i)
|
|
|
|
{
|
|
|
|
QDomElement dom = list.at(i).toElement();
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strKAsm1);
|
|
|
|
dom.setAttribute(strKAsm1, FixMeasurementInFormulaToV0_2_0(formula, names));
|
2015-09-07 15:51:13 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strKAsm2);
|
|
|
|
dom.setAttribute(strKAsm2, FixMeasurementInFormulaToV0_2_0(formula, names));
|
2015-09-07 15:51:13 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
formula = GetParametrString(dom, strAngle);
|
|
|
|
dom.setAttribute(strAngle, FixMeasurementInFormulaToV0_2_0(formula, names));
|
2015-09-07 15:51:13 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VPatternConverter::FixMeasurementInFormulaToV0_2_0(const QString &formula, const QMap<QString, QString> &names)
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2017-01-03 09:58:52 +01:00
|
|
|
QScopedPointer<qmu::QmuTokenParser> cal(new qmu::QmuTokenParser(formula, false, false));// Eval formula
|
2015-09-07 15:51:13 +02:00
|
|
|
QMap<int, QString> tokens = cal->GetTokens();// Tokens (variables, measurements)
|
2017-01-03 09:58:52 +01:00
|
|
|
delete cal.take();
|
2015-09-07 15:51:13 +02:00
|
|
|
|
|
|
|
QList<int> tKeys = tokens.keys();// Take all tokens positions
|
|
|
|
QList<QString> tValues = tokens.values();
|
|
|
|
|
|
|
|
QString newFormula = formula;// Local copy for making changes
|
|
|
|
for (int i = 0; i < tValues.size(); ++i)
|
|
|
|
{
|
|
|
|
if (not names.contains(tValues.at(i)))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
int bias = 0;
|
|
|
|
Replace(newFormula, names.value(tValues.at(i)), tKeys.at(i), tValues.at(i), bias);
|
|
|
|
if (bias != 0)
|
|
|
|
{// Translated token has different length than original. Position next tokens need to be corrected.
|
|
|
|
CorrectionsPositions(tKeys.at(i), bias, tokens);
|
|
|
|
tKeys = tokens.keys();
|
|
|
|
tValues = tokens.values();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return newFormula;
|
|
|
|
}
|
|
|
|
|
2015-08-27 10:25:11 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VPatternConverter::FixIncrementInFormulaToV0_2_0(const QString &formula, const QSet<QString> &names)
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-08-27 10:25:11 +02:00
|
|
|
qmu::QmuTokenParser *cal = new qmu::QmuTokenParser(formula, false, false);// Eval formula
|
|
|
|
QMap<int, QString> tokens = cal->GetTokens();// Tokens (variables, measurements)
|
|
|
|
delete cal;
|
|
|
|
|
|
|
|
QList<int> tKeys = tokens.keys();// Take all tokens positions
|
|
|
|
QList<QString> tValues = tokens.values();
|
|
|
|
|
|
|
|
QString newFormula = formula;// Local copy for making changes
|
|
|
|
for (int i = 0; i < tValues.size(); ++i)
|
|
|
|
{
|
|
|
|
if (not names.contains(tValues.at(i)))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
int bias = 0;
|
|
|
|
Replace(newFormula, "#"+tValues.at(i), tKeys.at(i), tValues.at(i), bias);
|
|
|
|
if (bias != 0)
|
|
|
|
{// Translated token has different length than original. Position next tokens need to be corrected.
|
|
|
|
CorrectionsPositions(tKeys.at(i), bias, tokens);
|
|
|
|
tKeys = tokens.keys();
|
|
|
|
tValues = tokens.values();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return newFormula;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::TagMeasurementsToV0_2_0()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-08-27 10:25:11 +02:00
|
|
|
QDomElement ms = TagMeasurementsV0_1_4();
|
2016-08-20 11:14:53 +02:00
|
|
|
const QString path = GetParametrString(ms, strPath);
|
2015-08-27 10:25:11 +02:00
|
|
|
|
2016-08-20 11:14:53 +02:00
|
|
|
ms.removeAttribute(strUnit);
|
|
|
|
ms.removeAttribute(strType);
|
|
|
|
ms.removeAttribute(strPath);
|
2015-08-27 10:25:11 +02:00
|
|
|
|
2017-02-04 12:28:47 +01:00
|
|
|
QDomText newNodeText = createTextNode(QFileInfo(m_convertedFileName).absoluteDir().relativeFilePath(path));
|
2015-08-27 10:25:11 +02:00
|
|
|
ms.appendChild(newNodeText);
|
|
|
|
}
|
|
|
|
|
2015-11-11 15:26:48 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ConvertMeasurementsToV0_2_1()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.1
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 1),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-11-11 15:26:48 +01:00
|
|
|
const QMap<QString, QString> names = OldNamesToNewNames_InV0_2_1();
|
|
|
|
|
|
|
|
// Structure did not change. We can use the same code.
|
|
|
|
ConvertPointExpressionsToV0_2_0(names);
|
|
|
|
ConvertArcExpressionsToV0_2_0(names);
|
|
|
|
ConvertPathPointExpressionsToV0_2_0(names);
|
|
|
|
}
|
|
|
|
|
2016-05-19 14:40:55 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::RemoveColorToolCutV0_3_1()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.3.1
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 1),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-08-20 11:14:53 +02:00
|
|
|
const QDomNodeList list = elementsByTagName(strPoint);
|
2016-05-19 14:40:55 +02:00
|
|
|
for (int i=0; i < list.size(); ++i)
|
|
|
|
{
|
|
|
|
QDomElement element = list.at(i).toElement();
|
|
|
|
if (not element.isNull())
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
const QString type = element.attribute(strType);
|
|
|
|
if (type == strCutArc || type == strCutSpline || type == strCutSplinePath)
|
2016-05-19 14:40:55 +02:00
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
element.removeAttribute(strColor);
|
2016-05-19 14:40:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-27 10:25:11 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VPatternConverter::MUnitV0_1_4() const
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.1.4
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 1, 4),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-08-27 10:25:11 +02:00
|
|
|
const QDomElement element = TagMeasurementsV0_1_4();
|
|
|
|
try
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
return GetParametrString(element, strUnit);
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
catch (VExceptionEmptyParameter &e)
|
|
|
|
{
|
|
|
|
VException excep("Can't get unit.");
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QDomElement VPatternConverter::TagMeasurementsV0_1_4() const
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.1.4
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 1, 4),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-08-20 11:14:53 +02:00
|
|
|
const QDomNodeList list = elementsByTagName(strMeasurements);
|
2015-08-27 10:25:11 +02:00
|
|
|
const QDomElement element = list.at(0).toElement();
|
|
|
|
if (not element.isElement())
|
|
|
|
{
|
|
|
|
VException excep("Can't get tag measurements.");
|
|
|
|
throw excep;
|
2015-08-27 13:00:20 +02:00
|
|
|
}
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QDomElement VPatternConverter::TagIncrementsV0_1_4() const
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.1.4
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 1, 4),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-08-20 11:14:53 +02:00
|
|
|
const QDomNodeList list = elementsByTagName(strIncrements);
|
2015-08-27 13:00:20 +02:00
|
|
|
const QDomElement element = list.at(0).toElement();
|
|
|
|
if (not element.isElement())
|
|
|
|
{
|
|
|
|
VException excep("Can't get tag measurements.");
|
|
|
|
throw excep;
|
2015-08-27 10:25:11 +02:00
|
|
|
}
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
|
2016-01-07 17:43:08 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::FixToolUnionToV0_2_4()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.4
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 4),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-01-07 17:43:08 +01:00
|
|
|
QDomElement root = documentElement();
|
2016-08-20 11:14:53 +02:00
|
|
|
const QDomNodeList modelings = root.elementsByTagName(strModeling);
|
2016-01-07 17:43:08 +01:00
|
|
|
for (int i=0; i<modelings.size(); ++i)
|
|
|
|
{
|
|
|
|
ParseModelingToV0_2_4(modelings.at(i).toElement());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::ParseModelingToV0_2_4(const QDomElement &modeling)
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.4
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 4),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-01-07 17:43:08 +01:00
|
|
|
QDomElement node = modeling.firstChild().toElement();
|
|
|
|
while (not node.isNull())
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
if (node.tagName() == strTools)
|
2016-01-07 17:43:08 +01:00
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
const quint32 toolId = node.attribute(strId).toUInt();
|
2016-01-07 17:43:08 +01:00
|
|
|
QVector<quint32> children;
|
|
|
|
QDomElement childNode = node.nextSibling().toElement();
|
|
|
|
while (not childNode.isNull())
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
if (childNode.hasAttribute(strIdTool) && childNode.attribute(strIdTool).toUInt() == toolId)
|
2016-01-07 17:43:08 +01:00
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
children.append(childNode.attribute(strIdObject).toUInt());
|
2016-01-07 17:43:08 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
childNode = childNode.nextSibling().toElement();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (not children.isEmpty())
|
|
|
|
{
|
|
|
|
SaveChildrenToolUnionToV0_2_4(toolId, children);
|
|
|
|
}
|
|
|
|
node = childNode;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
node = node.nextSibling().toElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector<quint32> &children)
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.4
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 4),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-01-07 17:43:08 +01:00
|
|
|
QDomElement toolUnion = elementById(id);
|
|
|
|
if (toolUnion.isNull())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-08-20 11:14:53 +02:00
|
|
|
QDomElement tagChildren = createElement(strChildren);
|
2016-01-07 17:43:08 +01:00
|
|
|
|
|
|
|
for (int i=0; i<children.size(); ++i)
|
|
|
|
{
|
2016-08-20 11:14:53 +02:00
|
|
|
QDomElement tagChild = createElement(strChild);
|
2016-01-07 17:43:08 +01:00
|
|
|
tagChild.appendChild(createTextNode(QString().setNum(children.at(i))));
|
|
|
|
tagChildren.appendChild(tagChild);
|
|
|
|
}
|
|
|
|
|
|
|
|
toolUnion.appendChild(tagChildren);
|
|
|
|
}
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QMap<QString, QString> VPatternConverter::OldNamesToNewNames_InV0_2_0()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-10-27 07:11:41 +01:00
|
|
|
// old name, new name
|
2015-09-07 15:51:13 +02:00
|
|
|
QMap<QString, QString> names;
|
|
|
|
|
|
|
|
names.insert(QStringLiteral("cervicale_height"), QStringLiteral("height_neck_back"));
|
|
|
|
names.insert(QStringLiteral("height_scapular_point"), QStringLiteral("height_scapula"));
|
|
|
|
names.insert(QStringLiteral("height_back_angle_axilla"), QStringLiteral("height_armpit"));
|
|
|
|
names.insert(QStringLiteral("waist_height"), QStringLiteral("height_waist_side"));
|
|
|
|
names.insert(QStringLiteral("hip_height"), QStringLiteral("height_hip"));
|
|
|
|
names.insert(QStringLiteral("knee_height"), QStringLiteral("height_knee"));
|
|
|
|
names.insert(QStringLiteral("ankle_height"), QStringLiteral("height_ankle"));
|
|
|
|
names.insert(QStringLiteral("high_hip_height"), QStringLiteral("height_highhip"));
|
|
|
|
names.insert(QStringLiteral("front_waist_to_floor"), QStringLiteral("height_waist_front"));
|
|
|
|
names.insert(QStringLiteral("height_nipple_point"), QStringLiteral("height_bustpoint"));
|
2015-10-27 07:32:34 +01:00
|
|
|
|
|
|
|
QString name = QStringLiteral("height_shoulder_tip");
|
|
|
|
names.insert(QStringLiteral("shoulder_height"), name);
|
|
|
|
names.insert(QStringLiteral("height_shoulder_point"), name);
|
|
|
|
|
|
|
|
name = QStringLiteral("height_neck_front");
|
|
|
|
names.insert(QStringLiteral("height_clavicular_point"), name);
|
|
|
|
names.insert(QStringLiteral("height_front_neck_base_point"), name);
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
names.insert(QStringLiteral("height_base_neck_side_point"), QStringLiteral("height_neck_side"));
|
2015-10-27 07:32:34 +01:00
|
|
|
|
|
|
|
name = QStringLiteral("height_neck_back_to_knee");
|
|
|
|
names.insert(QStringLiteral("neck_to_knee_point"), name);
|
|
|
|
names.insert(QStringLiteral("cervicale_to_knee_height"), name);
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
names.insert(QStringLiteral("waist_to_knee_height"), QStringLiteral("height_waist_side_to_knee"));
|
|
|
|
names.insert(QStringLiteral("waist_to_hip_height"), QStringLiteral("height_waist_side_to_hip"));
|
|
|
|
names.insert(QStringLiteral("body_position"), QStringLiteral("indent_neck_back"));
|
2015-10-27 07:32:34 +01:00
|
|
|
|
|
|
|
name = QStringLiteral("neck_mid_circ");
|
|
|
|
names.insert(QStringLiteral("half_girth_neck_for_shirts"), name);
|
|
|
|
names.insert(QStringLiteral("mid_neck_girth"), name);
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
names.insert(QStringLiteral("neck_base_girth"), QStringLiteral("neck_circ"));
|
|
|
|
names.insert(QStringLiteral("upper_chest_girth"), QStringLiteral("highbust_circ"));
|
|
|
|
names.insert(QStringLiteral("bust_girth"), QStringLiteral("bust_circ"));
|
|
|
|
names.insert(QStringLiteral("under_bust_girth"), QStringLiteral("lowbust_circ"));
|
|
|
|
names.insert(QStringLiteral("waist_girth"), QStringLiteral("waist_circ"));
|
|
|
|
names.insert(QStringLiteral("high_hip_girth"), QStringLiteral("highhip_circ"));
|
2015-11-11 11:15:42 +01:00
|
|
|
names.insert(QStringLiteral("hips_excluding_protruding_abdomen"), QStringLiteral("hip_circ"));
|
|
|
|
names.insert(QStringLiteral("hip_girth"), QStringLiteral("hip_circ_with_abdomen"));
|
2015-10-27 07:32:34 +01:00
|
|
|
|
|
|
|
name = QStringLiteral("neck_arc_f");
|
|
|
|
names.insert(QStringLiteral("half_girth_neck"), name);
|
|
|
|
names.insert(QStringLiteral("front_neck_arc"), name);
|
|
|
|
|
|
|
|
name = QStringLiteral("highbust_arc_f");
|
|
|
|
names.insert(QStringLiteral("half_girth_chest_first"), name);
|
|
|
|
names.insert(QStringLiteral("front_upper_chest_arc"), name);
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
names.insert(QStringLiteral("half_girth_chest_second"), QStringLiteral("bust_arc_f"));
|
|
|
|
names.insert(QStringLiteral("half_girth_chest_third"), QStringLiteral("lowbust_arc_f"));
|
2015-10-27 07:32:34 +01:00
|
|
|
|
|
|
|
name = QStringLiteral("waist_arc_f");
|
|
|
|
names.insert(QStringLiteral("half_girth_waist"), name);
|
|
|
|
names.insert(QStringLiteral("front_waist_arc"), name);
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
names.insert(QStringLiteral("front_upper_hip_arc"), QStringLiteral("highhip_arc_f"));
|
2015-10-27 07:32:34 +01:00
|
|
|
|
|
|
|
name = QStringLiteral("hip_arc_f");
|
|
|
|
names.insert(QStringLiteral("half_girth_hips_excluding_protruding_abdomen"), name);
|
|
|
|
names.insert(QStringLiteral("front_hip_arc"), name);
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
names.insert(QStringLiteral("back_neck_arc"), QStringLiteral("neck_arc_b"));
|
|
|
|
names.insert(QStringLiteral("back_upper_chest_arc"), QStringLiteral("highbust_arc_b"));
|
|
|
|
names.insert(QStringLiteral("back_waist_arc"), QStringLiteral("waist_arc_b"));
|
|
|
|
names.insert(QStringLiteral("back_upper_hip_arc"), QStringLiteral("highhip_arc_b"));
|
|
|
|
names.insert(QStringLiteral("back_hip_arc"), QStringLiteral("hip_arc_b"));
|
|
|
|
names.insert(QStringLiteral("half_girth_hips_considering_protruding_abdomen"),
|
|
|
|
QStringLiteral("hip_with_abdomen_arc_f"));
|
|
|
|
names.insert(QStringLiteral("shoulder_girth"), QStringLiteral("body_armfold_circ"));
|
|
|
|
names.insert(QStringLiteral("trunk_length"), QStringLiteral("body_torso_circ"));
|
2015-11-11 11:15:42 +01:00
|
|
|
names.insert(QStringLiteral("front_waist_length"), QStringLiteral("neck_front_to_waist_f"));
|
2015-11-11 15:26:48 +01:00
|
|
|
names.insert(QStringLiteral("center_front_waist_length"), QStringLiteral("neck_front_to_waist_flat_f"));
|
2015-09-07 15:51:13 +02:00
|
|
|
names.insert(QStringLiteral("side_waist_length"), QStringLiteral("armpit_to_waist_side"));
|
2015-11-11 11:15:42 +01:00
|
|
|
names.insert(QStringLiteral("waist_to_neck_side"), QStringLiteral("neck_side_to_waist_b"));
|
2015-10-27 07:32:34 +01:00
|
|
|
|
|
|
|
name = QStringLiteral("neck_side_to_waist_f");
|
|
|
|
names.insert(QStringLiteral("neck_to_front_waist_line"), name);
|
|
|
|
names.insert(QStringLiteral("front_shoulder_to_waist_length"), name);
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
names.insert(QStringLiteral("back_shoulder_to_waist_length"), QStringLiteral("neck_side_to_waist_b"));
|
|
|
|
names.insert(QStringLiteral("center_back_waist_length"), QStringLiteral("neck_back_to_waist_b"));
|
2015-10-27 07:32:34 +01:00
|
|
|
|
|
|
|
name = QStringLiteral("neck_front_to_highbust_f");
|
|
|
|
names.insert(QStringLiteral("neck_to_first_line_chest_circumference"), name);
|
|
|
|
names.insert(QStringLiteral("front_neck_to_upper_chest_height"), name);
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
names.insert(QStringLiteral("front_neck_to_bust_height"), QStringLiteral("neck_front_to_bust_f"));
|
|
|
|
names.insert(QStringLiteral("front_waist_to_upper_chest"), QStringLiteral("highbust_to_waist_f"));
|
|
|
|
names.insert(QStringLiteral("front_waist_to_lower_breast"), QStringLiteral("lowbust_to_waist_f"));
|
|
|
|
names.insert(QStringLiteral("neck_to_back_line_chest_circumference"), QStringLiteral("neck_back_to_highbust_b"));
|
|
|
|
names.insert(QStringLiteral("depth_waist_first"), QStringLiteral("waist_to_highhip_f"));
|
|
|
|
names.insert(QStringLiteral("depth_waist_second"), QStringLiteral("waist_to_hip_f"));
|
|
|
|
names.insert(QStringLiteral("shoulder_slope_degrees"), QStringLiteral("shoulder_slope_neck_side_angle"));
|
|
|
|
names.insert(QStringLiteral("shoulder_drop"), QStringLiteral("shoulder_slope_neck_side_length"));
|
2015-09-20 13:11:06 +02:00
|
|
|
names.insert(QStringLiteral("across_front_shoulder_width"), QStringLiteral("shoulder_tip_to_shoulder_tip_f"));
|
2015-09-07 15:51:13 +02:00
|
|
|
names.insert(QStringLiteral("upper_front_chest_width"), QStringLiteral("across_chest_f"));
|
2015-11-11 11:15:42 +01:00
|
|
|
names.insert(QStringLiteral("chest_width"), QStringLiteral("across_chest_f"));
|
|
|
|
names.insert(QStringLiteral("front_chest_width"), QStringLiteral("armfold_to_armfold_f"));
|
2015-10-27 07:32:34 +01:00
|
|
|
|
|
|
|
name = QStringLiteral("shoulder_tip_to_shoulder_tip_b");
|
|
|
|
names.insert(QStringLiteral("arc_behind_shoulder_girdle"), name);
|
|
|
|
names.insert(QStringLiteral("across_back_shoulder_width"), name);
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
names.insert(QStringLiteral("upper_back_width"), QStringLiteral("across_back_b"));
|
|
|
|
names.insert(QStringLiteral("back_width"), QStringLiteral("armfold_to_armfold_b"));
|
|
|
|
names.insert(QStringLiteral("neck_transverse_diameter"), QStringLiteral("neck_width"));
|
|
|
|
names.insert(QStringLiteral("bustpoint_to_bustpoint"), QStringLiteral("bustpoint_to_bustpoint"));
|
|
|
|
names.insert(QStringLiteral("neck_to_bustpoint"), QStringLiteral("bustpoint_to_neck_side"));
|
|
|
|
names.insert(QStringLiteral("halter_bustpoint_to_bustpoint"), QStringLiteral("bustpoint_to_bustpoint_halter"));
|
2015-10-27 07:32:34 +01:00
|
|
|
|
|
|
|
name = QStringLiteral("shoulder_tip_to_waist_front");
|
|
|
|
names.insert(QStringLiteral("front_slash_shoulder_height"), name);
|
|
|
|
names.insert(QStringLiteral("front_shoulder_slope_length"), name);
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
names.insert(QStringLiteral("front_waist_slope"), QStringLiteral("neck_front_to_waist_side"));
|
2015-10-27 07:32:34 +01:00
|
|
|
|
|
|
|
name = QStringLiteral("neck_side_to_armfold_f");
|
|
|
|
names.insert(QStringLiteral("height_armhole_slash"), name);
|
|
|
|
names.insert(QStringLiteral("chest_slope"), name);
|
|
|
|
|
|
|
|
name = QStringLiteral("shoulder_tip_to_waist_back");
|
|
|
|
names.insert(QStringLiteral("slash_shoulder_height"), name);
|
|
|
|
names.insert(QStringLiteral("back_shoulder_slope_length"), name);
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
names.insert(QStringLiteral("back_waist_slope"), QStringLiteral("neck_back_to_waist_side"));
|
|
|
|
names.insert(QStringLiteral("back_slope"), QStringLiteral("neck_side_to_armfold_b"));
|
|
|
|
names.insert(QStringLiteral("arm_length"), QStringLiteral("arm_shoulder_tip_to_wrist"));
|
|
|
|
names.insert(QStringLiteral("shoulder_to_elbow_length"), QStringLiteral("arm_shoulder_tip_to_elbow"));
|
|
|
|
names.insert(QStringLiteral("underarm_length"), QStringLiteral("arm_armpit_to_wrist"));
|
|
|
|
names.insert(QStringLiteral("upper_arm_girth"), QStringLiteral("arm_upper_circ"));
|
|
|
|
names.insert(QStringLiteral("wrist_girth"), QStringLiteral("arm_wrist_circ"));
|
|
|
|
names.insert(QStringLiteral("armscye_girth"), QStringLiteral("armscye_circ"));
|
|
|
|
names.insert(QStringLiteral("anteroposterior_diameter_hands"), QStringLiteral("armscye_width"));
|
|
|
|
names.insert(QStringLiteral("neck_to_third_finger"), QStringLiteral("arm_neck_side_to_finger_tip"));
|
2015-11-11 11:15:42 +01:00
|
|
|
names.insert(QStringLiteral("neck_to_radial_point"), QStringLiteral("arm_neck_side_to_outer_elbow"));
|
|
|
|
names.insert(QStringLiteral("shoulder_and_arm_length"), QStringLiteral("arm_neck_side_to_wrist"));
|
2015-09-07 15:51:13 +02:00
|
|
|
names.insert(QStringLiteral("crotch_height"), QStringLiteral("leg_crotch_to_floor"));
|
|
|
|
names.insert(QStringLiteral("side_waist_to_floor"), QStringLiteral("leg_waist_side_to_floor"));
|
|
|
|
names.insert(QStringLiteral("waist_to_knee"), QStringLiteral("leg_waist_side_to_knee"));
|
|
|
|
names.insert(QStringLiteral("thigh_girth"), QStringLiteral("leg_thigh_upper_circ"));
|
|
|
|
names.insert(QStringLiteral("mid_thigh_girth"), QStringLiteral("leg_thigh_mid_circ"));
|
|
|
|
names.insert(QStringLiteral("knee_girth"), QStringLiteral("leg_knee_circ"));
|
|
|
|
names.insert(QStringLiteral("calf_girth"), QStringLiteral("leg_calf_circ"));
|
|
|
|
names.insert(QStringLiteral("ankle_girth"), QStringLiteral("leg_ankle_circ"));
|
|
|
|
names.insert(QStringLiteral("girth_knee_flexed_feet"), QStringLiteral("leg_knee_circ_bent"));
|
|
|
|
names.insert(QStringLiteral("arc_through_groin_area"), QStringLiteral("crotch_length"));
|
2015-11-11 13:37:32 +01:00
|
|
|
names.insert(QStringLiteral("waist_to_plane_seat"), QStringLiteral("rise_length_side_sitting"));
|
2015-11-11 11:15:42 +01:00
|
|
|
names.insert(QStringLiteral("rise_height"), QStringLiteral("rise_length_diag"));
|
2015-09-07 15:51:13 +02:00
|
|
|
names.insert(QStringLiteral("hand_vertical_diameter"), QStringLiteral("hand_length"));
|
|
|
|
names.insert(QStringLiteral("hand_width"), QStringLiteral("hand_palm_width"));
|
|
|
|
names.insert(QStringLiteral("hand_girth"), QStringLiteral("hand_circ"));
|
|
|
|
names.insert(QStringLiteral("girth_foot_instep"), QStringLiteral("foot_instep_circ"));
|
|
|
|
names.insert(QStringLiteral("head_height"), QStringLiteral("head_length"));
|
|
|
|
names.insert(QStringLiteral("head_and_neck_length"), QStringLiteral("head_crown_to_neck_back"));
|
|
|
|
names.insert(QStringLiteral("neck_to_neck_base"), QStringLiteral("head_chin_to_neck_back"));
|
|
|
|
names.insert(QStringLiteral("arc_length_upper_body"), QStringLiteral("waist_to_waist_halter"));
|
|
|
|
names.insert(QStringLiteral("cervicale_to_wrist_length"), QStringLiteral("arm_neck_back_to_wrist_bent"));
|
|
|
|
names.insert(QStringLiteral("strap_length"), QStringLiteral("highbust_b_over_shoulder_to_highbust_f"));
|
|
|
|
names.insert(QStringLiteral("arc_through_shoulder_joint"), QStringLiteral("armscye_arc"));
|
2015-10-27 07:11:41 +01:00
|
|
|
names.insert(QStringLiteral("head_girth"), QStringLiteral("head_circ"));
|
2015-11-11 11:15:42 +01:00
|
|
|
names.insert(QStringLiteral("elbow_girth"), QStringLiteral("arm_elbow_circ"));
|
|
|
|
names.insert(QStringLiteral("height_under_buttock_folds"), QStringLiteral("height_gluteal_fold"));
|
|
|
|
names.insert(QStringLiteral("scye_depth"), QStringLiteral("neck_back_to_highbust_b"));
|
|
|
|
names.insert(QStringLiteral("back_waist_to_upper_chest"), QStringLiteral("across_back_to_waist_b"));
|
2015-10-27 07:11:41 +01:00
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
return names;
|
|
|
|
}
|
2015-11-11 15:26:48 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QMap<QString, QString> VPatternConverter::OldNamesToNewNames_InV0_2_1()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.1
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 1),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2015-11-11 15:26:48 +01:00
|
|
|
// old name, new name
|
|
|
|
QMap<QString, QString> names;
|
|
|
|
|
|
|
|
names.insert(QStringLiteral("rise_length_side"), QStringLiteral("rise_length_side_sitting"));
|
2015-11-11 19:52:38 +01:00
|
|
|
names.insert(QStringLiteral("size"), QStringLiteral("bust_arc_f"));
|
2015-11-11 15:26:48 +01:00
|
|
|
|
|
|
|
return names;
|
|
|
|
}
|
2016-08-20 16:32:45 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
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
|
|
|
|
{
|
2016-08-20 20:08:25 +02:00
|
|
|
quint32 spl = element.attribute(strCurve1).toUInt();
|
2016-08-20 16:32:45 +02:00
|
|
|
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
|
|
|
|
{
|
2016-08-20 20:08:25 +02:00
|
|
|
quint32 arc = element.attribute(strFirstArc).toUInt();
|
2016-08-20 16:32:45 +02:00
|
|
|
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
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-11-08 15:32:18 +01:00
|
|
|
|
2016-11-25 12:19:38 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::TagRemoveAttributeTypeObjectInV0_4_0()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.4.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
|
|
|
const QDomNodeList list = elementsByTagName(strModeling);
|
|
|
|
for (int i = 0; i < list.size(); ++i)
|
|
|
|
{
|
|
|
|
QDomElement modeling = list.at(i).toElement();
|
|
|
|
if (not modeling.isNull())
|
|
|
|
{
|
|
|
|
QDomNode domNode = modeling.firstChild();
|
|
|
|
while (not domNode.isNull())
|
|
|
|
{
|
|
|
|
QDomElement domElement = domNode.toElement();
|
|
|
|
if (not domElement.isNull())
|
|
|
|
{
|
2017-01-23 13:03:07 +01:00
|
|
|
if (domElement.hasAttribute(strTypeObject))
|
2016-11-25 12:19:38 +01:00
|
|
|
{
|
2017-01-23 13:03:07 +01:00
|
|
|
domElement.removeAttribute(strTypeObject);
|
2016-11-25 12:19:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
domNode = domNode.nextSibling();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-08 15:32:18 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::TagDetailToV0_4_0()
|
|
|
|
{
|
2016-11-08 16:07:16 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.4.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
2016-11-08 15:32:18 +01:00
|
|
|
const QDomNodeList list = elementsByTagName(strDetail);
|
|
|
|
for (int i=0; i < list.size(); ++i)
|
|
|
|
{
|
|
|
|
QDomElement dom = list.at(i).toElement();
|
|
|
|
|
|
|
|
if (not dom.isNull())
|
|
|
|
{
|
2016-11-10 11:53:02 +01:00
|
|
|
dom.setAttribute(strSeamAllowance, dom.attribute(strSupplement, "0"));
|
2016-11-08 15:32:18 +01:00
|
|
|
dom.removeAttribute(strSupplement);
|
2016-11-10 11:53:02 +01:00
|
|
|
|
2016-11-08 15:32:18 +01:00
|
|
|
dom.setAttribute(strVersion, "1");
|
|
|
|
|
|
|
|
const QStringList tags = QStringList() << strNode << strData << strPatternInfo << strGrainline;
|
|
|
|
|
|
|
|
QDomElement tagData;
|
|
|
|
QDomElement tagPatternInfo;
|
|
|
|
QDomElement tagGrainline;
|
|
|
|
QDomElement tagNodes = createElement(strNodes);
|
|
|
|
|
|
|
|
const QDomNodeList childList = dom.childNodes();
|
|
|
|
for (qint32 i = 0; i < childList.size(); ++i)
|
|
|
|
{
|
|
|
|
const QDomElement element = childList.at(i).toElement();
|
|
|
|
if (not element.isNull())
|
|
|
|
{
|
|
|
|
switch (tags.indexOf(element.tagName()))
|
|
|
|
{
|
|
|
|
case 0://strNode
|
|
|
|
{
|
|
|
|
QDomElement tagNode = createElement(strNode);
|
|
|
|
|
|
|
|
tagNode.setAttribute(strIdObject, element.attribute(strIdObject, NULL_ID_STR));
|
|
|
|
|
|
|
|
if (element.hasAttribute(strReverse))
|
|
|
|
{
|
|
|
|
tagNode.setAttribute(strReverse, element.attribute(strReverse, "0"));
|
|
|
|
}
|
2016-12-01 19:47:15 +01:00
|
|
|
|
|
|
|
if (element.hasAttribute(strMx))
|
|
|
|
{
|
|
|
|
tagNode.setAttribute(strMx, element.attribute(strMx, "0"));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (element.hasAttribute(strMy))
|
|
|
|
{
|
|
|
|
tagNode.setAttribute(strMy, element.attribute(strMy, "0"));
|
|
|
|
}
|
2016-11-08 15:32:18 +01:00
|
|
|
|
|
|
|
tagNode.setAttribute(strType, element.attribute(strType, ""));
|
|
|
|
|
|
|
|
tagNodes.appendChild(tagNode);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1://strData
|
|
|
|
tagData = element.cloneNode().toElement();
|
|
|
|
break;
|
|
|
|
case 2://strPatternInfo
|
|
|
|
tagPatternInfo = element.cloneNode().toElement();
|
|
|
|
break;
|
|
|
|
case 3://strGrainline
|
|
|
|
tagGrainline = element.cloneNode().toElement();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RemoveAllChildren(dom);
|
|
|
|
|
|
|
|
dom.appendChild(tagData);
|
|
|
|
dom.appendChild(tagPatternInfo);
|
|
|
|
dom.appendChild(tagGrainline);
|
|
|
|
dom.appendChild(tagNodes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-01-18 14:17:16 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QDomElement VPatternConverter::GetUnionDetailNodesV0_4_0(const QDomElement &detail)
|
|
|
|
{
|
|
|
|
QDomElement tagNodes = createElement(strNodes);
|
|
|
|
|
|
|
|
if (not detail.isNull())
|
|
|
|
{
|
|
|
|
const QDomNodeList childList = detail.childNodes();
|
|
|
|
for (qint32 i = 0; i < childList.size(); ++i)
|
|
|
|
{
|
|
|
|
const QDomElement node = childList.at(i).toElement();
|
|
|
|
if (not node.isNull())
|
|
|
|
{
|
|
|
|
QDomElement tagNode = createElement(strNode);
|
|
|
|
|
|
|
|
tagNode.setAttribute(strIdObject, node.attribute(strIdObject, NULL_ID_STR));
|
|
|
|
|
|
|
|
if (node.hasAttribute(strReverse))
|
|
|
|
{
|
|
|
|
tagNode.setAttribute(strReverse, node.attribute(strReverse, "0"));
|
|
|
|
}
|
|
|
|
|
|
|
|
tagNode.setAttribute(strType, node.attribute(strType, ""));
|
|
|
|
|
|
|
|
tagNodes.appendChild(tagNode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return tagNodes;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QDomElement VPatternConverter::GetUnionChildrenNodesV0_4_0(const QDomElement &detail)
|
|
|
|
{
|
|
|
|
QDomElement tagNodes = createElement(strNodes);
|
|
|
|
|
|
|
|
if (not detail.isNull())
|
|
|
|
{
|
|
|
|
const QDomNodeList childList = detail.childNodes();
|
|
|
|
for (qint32 i = 0; i < childList.size(); ++i)
|
|
|
|
{
|
|
|
|
const QDomElement node = childList.at(i).toElement();
|
|
|
|
if (not node.isNull())
|
|
|
|
{
|
|
|
|
QDomElement tagNode = node.cloneNode().toElement();
|
|
|
|
tagNodes.appendChild(tagNode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return tagNodes;
|
|
|
|
}
|
|
|
|
|
2017-03-14 12:54:15 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::LabelTagToV0_4_4(const QString &tagName)
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.4.4
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 4),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
|
|
|
Unit unit = Unit::Cm;
|
|
|
|
const QStringList units = QStringList() << "mm" << "cm" << "inch";
|
|
|
|
switch (units.indexOf(UniqueTagText(strUnit)))
|
|
|
|
{
|
|
|
|
case 0:// mm
|
|
|
|
unit = Unit::Mm;
|
|
|
|
break;
|
|
|
|
case 1:// cm
|
|
|
|
unit = Unit::Cm;
|
|
|
|
break;
|
|
|
|
case 2:// in
|
|
|
|
unit = Unit::Inch;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto ConvertData = [unit](QDomElement &dom, const QString &attribute)
|
|
|
|
{
|
|
|
|
if (dom.hasAttribute(attribute))
|
|
|
|
{
|
|
|
|
QString valStr = dom.attribute(attribute, "1");
|
|
|
|
bool ok = false;
|
|
|
|
qreal val = valStr.toDouble(&ok);
|
|
|
|
if (not ok)
|
|
|
|
{
|
|
|
|
val = 1;
|
|
|
|
}
|
|
|
|
dom.setAttribute(attribute, QString().setNum(FromPixel(val, unit)));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const QDomNodeList list = elementsByTagName(tagName);
|
|
|
|
for (int i=0; i < list.size(); ++i)
|
|
|
|
{
|
|
|
|
QDomElement dom = list.at(i).toElement();
|
|
|
|
|
|
|
|
if (not dom.isNull())
|
|
|
|
{
|
|
|
|
ConvertData(dom, strWidth);
|
|
|
|
ConvertData(dom, strHeight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-16 15:39:16 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QDomElement VPatternConverter::AddTagPatternLabelV0_5_1()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.6.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
|
|
|
const QDomNodeList list = elementsByTagName(strPatternLabel);
|
|
|
|
if (list.isEmpty())
|
|
|
|
{
|
|
|
|
const QStringList tags = QStringList() << strUnit
|
|
|
|
<< strImage
|
|
|
|
<< strAuthor
|
|
|
|
<< strDescription
|
|
|
|
<< strNotes
|
|
|
|
<< strGradation
|
|
|
|
<< strPatternName
|
|
|
|
<< strPatternNum
|
|
|
|
<< strCompanyName
|
|
|
|
<< strCustomerName
|
|
|
|
<< strPatternLabel;
|
|
|
|
|
|
|
|
QDomElement element = createElement(strPatternLabel);
|
|
|
|
QDomElement pattern = documentElement();
|
|
|
|
for (int i = tags.indexOf(element.tagName())-1; i >= 0; --i)
|
|
|
|
{
|
|
|
|
const QDomNodeList list = elementsByTagName(tags.at(i));
|
|
|
|
if (not list.isEmpty())
|
|
|
|
{
|
|
|
|
pattern.insertAfter(element, list.at(0));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
return list.at(0).toElement();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2017-08-18 08:02:03 +02:00
|
|
|
void VPatternConverter::PortPatternLabeltoV0_6_0(QDomElement &label)
|
2017-08-16 15:39:16 +02:00
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.6.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
|
|
|
if (not UniqueTagText(strCompanyName).isEmpty())
|
|
|
|
{
|
|
|
|
AddLabelTemplateLineV0_6_0(label, "%author%", true, false, 0, 4);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const QString author = UniqueTagText(strAuthor);
|
|
|
|
if (not author.isEmpty())
|
|
|
|
{
|
|
|
|
AddLabelTemplateLineV0_6_0(label, author, true, false, 0, 4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (not UniqueTagText(strPatternName).isEmpty())
|
|
|
|
{
|
|
|
|
AddLabelTemplateLineV0_6_0(label, "%patternName%", false, false, 0, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (not UniqueTagText(strPatternNum).isEmpty())
|
|
|
|
{
|
|
|
|
AddLabelTemplateLineV0_6_0(label, "%patternNumber%", false, false, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (not UniqueTagText(strCustomerName).isEmpty())
|
|
|
|
{
|
|
|
|
AddLabelTemplateLineV0_6_0(label, "%customer%", false, true, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString sizeField = UniqueTagText(strSize);
|
|
|
|
if (not sizeField.isEmpty())
|
|
|
|
{
|
|
|
|
AddLabelTemplateLineV0_6_0(label, sizeField, false, false, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (UniqueTagText(strShowMeasurements) == trueStr)
|
|
|
|
{
|
|
|
|
AddLabelTemplateLineV0_6_0(label, "%mFileName%.%mExt%", false, false, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (UniqueTagText(strShowDate) == trueStr)
|
|
|
|
{
|
|
|
|
AddLabelTemplateLineV0_6_0(label, "%date%", false, true, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::AddLabelTemplateLineV0_6_0(QDomElement &label, const QString &text, bool bold, bool italic,
|
|
|
|
int alignment, int fontSizeIncrement)
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.6.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
|
|
|
QDomElement tagLine = createElement(strLine);
|
|
|
|
|
|
|
|
SetAttribute(tagLine, strText, text);
|
|
|
|
SetAttribute(tagLine, strBold, bold);
|
|
|
|
SetAttribute(tagLine, strItalic, italic);
|
|
|
|
SetAttribute(tagLine, strAlignment, alignment);
|
|
|
|
SetAttribute(tagLine, strFSIncrement, fontSizeIncrement);
|
|
|
|
|
|
|
|
label.appendChild(tagLine);
|
|
|
|
}
|
|
|
|
|
2017-08-18 08:02:03 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::PortPieceLabelstoV0_6_0()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.6.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
|
|
|
const QDomNodeList nodeList = elementsByTagName(strData);
|
|
|
|
for (int i = 0; i < nodeList.size(); ++i)
|
|
|
|
{
|
|
|
|
QDomElement dataTag = nodeList.at(i).toElement();
|
2017-08-18 13:56:18 +02:00
|
|
|
QDomNodeList nodeListMCP = dataTag.childNodes();
|
|
|
|
const int count = nodeListMCP.count();
|
2017-08-18 08:02:03 +02:00
|
|
|
try
|
|
|
|
{
|
|
|
|
if (not GetParametrString(dataTag, strLetter, "").isEmpty())
|
|
|
|
{
|
|
|
|
AddLabelTemplateLineV0_6_0(dataTag, "%pLetter%", true, false, Qt::AlignHCenter, 6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(const VExceptionEmptyParameter &)
|
|
|
|
{}
|
|
|
|
|
|
|
|
AddLabelTemplateLineV0_6_0(dataTag, "%pName%", true, false, Qt::AlignHCenter, 2);
|
|
|
|
|
2017-09-18 08:11:39 +02:00
|
|
|
int firstLineCutNumber = 1;
|
|
|
|
bool firstLine = true;
|
|
|
|
|
2017-08-18 13:56:18 +02:00
|
|
|
for (int iMCP = 0; iMCP < count; ++iMCP)
|
2017-08-18 08:02:03 +02:00
|
|
|
{
|
|
|
|
QDomElement domMCP = nodeListMCP.at(iMCP).toElement();
|
|
|
|
|
|
|
|
QString line;
|
|
|
|
|
2017-08-21 17:59:11 +02:00
|
|
|
const int material = static_cast<int>(GetParametrUInt(domMCP, strMaterial, "0"));
|
2017-08-18 08:02:03 +02:00
|
|
|
switch(material)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
line.append("%mFabric%");
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
line.append("%mLining%");
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
line.append("%mInterfacing%");
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
line.append("%mInterlining%");
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
default:
|
|
|
|
line.append(GetParametrString(domMCP, strUserDefined, "User material"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2017-09-18 08:11:39 +02:00
|
|
|
line.append(", %wCut% ");
|
|
|
|
|
|
|
|
const int cutNumber = static_cast<int>(GetParametrUInt(domMCP, strCutNumber, "1"));
|
|
|
|
|
|
|
|
if (firstLine)
|
|
|
|
{
|
|
|
|
firstLineCutNumber = cutNumber;
|
|
|
|
dataTag.setAttribute(strQuantity, cutNumber);
|
|
|
|
line.append("%pQuantity%");
|
|
|
|
firstLine = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (firstLineCutNumber != cutNumber)
|
|
|
|
{
|
|
|
|
line.append(QString::number(cutNumber));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
line.append("%pQuantity%");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-18 13:56:18 +02:00
|
|
|
if (GetParametrUInt(domMCP, strPlacement, "0") == 1)
|
2017-08-18 08:02:03 +02:00
|
|
|
{
|
|
|
|
line.append(" %wOnFold%");
|
|
|
|
}
|
|
|
|
|
|
|
|
AddLabelTemplateLineV0_6_0(dataTag, line, false, false, Qt::AlignHCenter, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-16 15:39:16 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::RemoveUnusedTagsV0_6_0()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.6.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
|
|
|
RemoveUniqueTagV0_6_0(strAuthor);
|
|
|
|
RemoveUniqueTagV0_6_0(strSize);
|
|
|
|
RemoveUniqueTagV0_6_0(strShowDate);
|
|
|
|
RemoveUniqueTagV0_6_0(strShowMeasurements);
|
2017-08-18 08:02:03 +02:00
|
|
|
|
2017-08-21 17:07:30 +02:00
|
|
|
QDomNodeList nodeList = elementsByTagName(strData);
|
2017-08-18 08:02:03 +02:00
|
|
|
for (int i = 0; i < nodeList.size(); ++i)
|
|
|
|
{
|
2017-08-21 17:07:30 +02:00
|
|
|
QDomElement child = nodeList.at(i).firstChildElement(strMCP);
|
|
|
|
while (not child.isNull())
|
|
|
|
{
|
|
|
|
nodeList.at(i).removeChild(child);
|
|
|
|
child = nodeList.at(i).firstChildElement(strMCP);
|
|
|
|
}
|
2017-08-18 08:02:03 +02:00
|
|
|
}
|
2017-08-16 15:39:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::RemoveUniqueTagV0_6_0(const QString &tag)
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.6.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
|
|
|
const QDomNodeList nodeList = elementsByTagName(tag);
|
|
|
|
if (nodeList.isEmpty())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
QDomElement pattern = documentElement();
|
|
|
|
pattern.removeChild(nodeList.at(0));
|
|
|
|
}
|
|
|
|
|
2017-09-02 13:47:44 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::AddTagPreviewCalculationsV0_6_2()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.6.2
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 2),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
|
|
|
const QDomNodeList list = elementsByTagName(strIncrements);
|
|
|
|
if (not list.isEmpty())
|
|
|
|
{
|
|
|
|
QDomElement pattern = documentElement();
|
|
|
|
pattern.insertAfter(createElement(strPreviewCalculations), list.at(0));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-18 14:17:16 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPatternConverter::TagUnionDetailsToV0_4_0()
|
|
|
|
{
|
|
|
|
// TODO. Delete if minimal supported version is 0.4.0
|
|
|
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 0),
|
|
|
|
"Time to refactor the code.");
|
|
|
|
|
|
|
|
const QDomNodeList list = elementsByTagName(strTools);
|
|
|
|
for (int i=0; i < list.size(); ++i)
|
|
|
|
{
|
|
|
|
// Tag 'tools' used only for union details, so no need to check any additional attributes
|
|
|
|
QDomElement toolDOM = list.at(i).toElement();
|
|
|
|
if (not toolDOM.isNull())
|
|
|
|
{
|
|
|
|
const QStringList tags = QStringList() << strDet << strChildren;
|
|
|
|
|
|
|
|
QVector<QDomElement> nodes;
|
|
|
|
QDomElement tagChildrenNodes = createElement(strChildren);
|
|
|
|
|
|
|
|
const QDomNodeList childList = toolDOM.childNodes();
|
|
|
|
for (qint32 i = 0; i < childList.size(); ++i)
|
|
|
|
{
|
|
|
|
const QDomElement element = childList.at(i).toElement();
|
|
|
|
if (not element.isNull())
|
|
|
|
{
|
|
|
|
switch (tags.indexOf(element.tagName()))
|
|
|
|
{
|
|
|
|
case 0://strDet
|
|
|
|
nodes.append(GetUnionDetailNodesV0_4_0(element));
|
|
|
|
break;
|
|
|
|
case 1://strChildren
|
|
|
|
tagChildrenNodes.appendChild(GetUnionChildrenNodesV0_4_0(element));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RemoveAllChildren(toolDOM);
|
|
|
|
|
|
|
|
for (int i = 0; i < nodes.size(); ++i)
|
|
|
|
{
|
|
|
|
QDomElement tagDet = createElement(strDet);
|
|
|
|
tagDet.appendChild(nodes.at(i));
|
|
|
|
toolDOM.appendChild(tagDet);
|
|
|
|
}
|
|
|
|
toolDOM.appendChild(tagChildrenNodes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|