The app again parse tag "detail".
--HG-- branch : feature
This commit is contained in:
parent
2eea6482de
commit
6c0e4348e7
|
@ -30,6 +30,7 @@
|
||||||
#include "../vwidgets/vabstractmainwindow.h"
|
#include "../vwidgets/vabstractmainwindow.h"
|
||||||
#include "../vtools/tools/vdatatool.h"
|
#include "../vtools/tools/vdatatool.h"
|
||||||
#include "../vtools/tools/vtooldetail.h"
|
#include "../vtools/tools/vtooldetail.h"
|
||||||
|
#include "../vtools/tools/vtoolseamallowance.h"
|
||||||
#include "../vtools/tools/vtooluniondetails.h"
|
#include "../vtools/tools/vtooluniondetails.h"
|
||||||
#include "../vtools/tools/drawTools/drawtools.h"
|
#include "../vtools/tools/drawTools/drawtools.h"
|
||||||
#include "../vtools/tools/nodeDetails/nodedetails.h"
|
#include "../vtools/tools/nodeDetails/nodedetails.h"
|
||||||
|
@ -48,6 +49,7 @@
|
||||||
#include "../vgeometry/vcubicbezier.h"
|
#include "../vgeometry/vcubicbezier.h"
|
||||||
#include "../vgeometry/vcubicbezierpath.h"
|
#include "../vgeometry/vcubicbezierpath.h"
|
||||||
#include "../core/vapplication.h"
|
#include "../core/vapplication.h"
|
||||||
|
#include "../vpatterndb/vpiecenode.h"
|
||||||
#include "../vpatterndb/calculator.h"
|
#include "../vpatterndb/calculator.h"
|
||||||
#include "../vpatterndb/vpatternpiecedata.h"
|
#include "../vpatterndb/vpatternpiecedata.h"
|
||||||
#include "../vpatterndb/vpatterninfogeometry.h"
|
#include "../vpatterndb/vpatterninfogeometry.h"
|
||||||
|
@ -608,14 +610,14 @@ void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const
|
||||||
*/
|
*/
|
||||||
void VPattern::ParseDetailElement(const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseDetailElement(const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
// Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
// try
|
try
|
||||||
// {
|
{
|
||||||
// VDetail detail;
|
VPiece detail;
|
||||||
// const quint32 id = GetParametrId(domElement);
|
const quint32 id = GetParametrId(domElement);
|
||||||
// detail.setName(GetParametrString(domElement, AttrName, ""));
|
// detail.setName(GetParametrString(domElement, AttrName, ""));
|
||||||
// detail.setMx(qApp->toPixel(GetParametrDouble(domElement, AttrMx, "0.0")));
|
detail.SetMx(qApp->toPixel(GetParametrDouble(domElement, AttrMx, "0.0")));
|
||||||
// detail.setMy(qApp->toPixel(GetParametrDouble(domElement, AttrMy, "0.0")));
|
detail.SetMy(qApp->toPixel(GetParametrDouble(domElement, AttrMy, "0.0")));
|
||||||
// detail.setSeamAllowance(GetParametrUInt(domElement, VToolDetail::AttrSupplement, "1"));
|
// detail.setSeamAllowance(GetParametrUInt(domElement, VToolDetail::AttrSupplement, "1"));
|
||||||
// detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0"));
|
// detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0"));
|
||||||
// detail.setClosed(GetParametrUInt(domElement, VToolDetail::AttrClosed, "1"));
|
// detail.setClosed(GetParametrUInt(domElement, VToolDetail::AttrClosed, "1"));
|
||||||
|
@ -623,47 +625,33 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
||||||
// QString().setNum(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping())));
|
// QString().setNum(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping())));
|
||||||
// detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr));
|
// detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr));
|
||||||
|
|
||||||
// QStringList types = QStringList() << VToolDetail::NodePoint << VToolDetail::NodeArc << VToolDetail::NodeSpline
|
const QStringList tags = QStringList() << VToolSeamAllowance::TagNodes
|
||||||
// << VToolDetail::NodeSplinePath;
|
<< TagData
|
||||||
// const QDomNodeList nodeList = domElement.childNodes();
|
<< TagPatternInfo
|
||||||
// const qint32 num = nodeList.size();
|
<< TagGrainline;
|
||||||
// for (qint32 i = 0; i < num; ++i)
|
|
||||||
// {
|
|
||||||
// const QDomElement element = nodeList.at(i).toElement();
|
|
||||||
// if (element.isNull() == false)
|
|
||||||
// {
|
|
||||||
// if (element.tagName() == VToolDetail::TagNode)
|
|
||||||
// {
|
|
||||||
// const quint32 id = GetParametrUInt(element, AttrIdObject, NULL_ID_STR);
|
|
||||||
// const qreal mx = qApp->toPixel(GetParametrDouble(element, AttrMx, "0.0"));
|
|
||||||
// const qreal my = qApp->toPixel(GetParametrDouble(element, AttrMy, "0.0"));
|
|
||||||
// const bool reverse = GetParametrUInt(element, VToolDetail::AttrReverse, "0");
|
|
||||||
// const NodeDetail nodeType = NodeDetail::Contour;
|
|
||||||
|
|
||||||
// const QString t = GetParametrString(element, AttrType, "NodePoint");
|
const QDomNodeList nodeList = domElement.childNodes();
|
||||||
// Tool tool;
|
for (qint32 i = 0; i < nodeList.size(); ++i)
|
||||||
|
{
|
||||||
// switch (types.indexOf(t))
|
const QDomElement element = nodeList.at(i).toElement();
|
||||||
// {
|
if (not element.isNull())
|
||||||
// case 0: // VToolDetail::NodePoint
|
{
|
||||||
// tool = Tool::NodePoint;
|
switch (tags.indexOf(element.tagName()))
|
||||||
// break;
|
{
|
||||||
// case 1: // VToolDetail::NodeArc
|
case 0:// VToolSeamAllowance::TagNodes
|
||||||
// tool = Tool::NodeArc;
|
ParseDetailNodes(element, detail);
|
||||||
// break;
|
break;
|
||||||
// case 2: // VToolDetail::NodeSpline
|
case 1:// TagData
|
||||||
// tool = Tool::NodeSpline;
|
break;
|
||||||
// break;
|
case 2:// TagPatternInfo
|
||||||
// case 3: // VToolDetail::NodeSplinePath
|
break;
|
||||||
// tool = Tool::NodeSplinePath;
|
case 3:// TagGrainline
|
||||||
// break;
|
break;
|
||||||
// default:
|
default:
|
||||||
// VException e(tr("Wrong tag name '%1'.").arg(t));
|
break;
|
||||||
// throw e;
|
}
|
||||||
// }
|
}
|
||||||
// detail.append(VNodeDetail(id, tool, nodeType, mx, my, reverse));
|
// if (element.tagName() == TagData)
|
||||||
// }
|
|
||||||
// else if (element.tagName() == TagData)
|
|
||||||
// {
|
// {
|
||||||
// bool bVisible = GetParametrBool(element, AttrVisible, trueStr);
|
// bool bVisible = GetParametrBool(element, AttrVisible, trueStr);
|
||||||
// detail.GetPatternPieceData().SetVisible(bVisible);
|
// detail.GetPatternPieceData().SetVisible(bVisible);
|
||||||
|
@ -735,17 +723,59 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
||||||
// detail.GetGrainlineGeometry().SetArrowType(eAT);
|
// detail.GetGrainlineGeometry().SetArrowType(eAT);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
}
|
||||||
// VToolDetail::Create(id, detail, sceneDetail, this, data, parse, Source::FromFile);
|
VToolSeamAllowance::Create(id, detail, sceneDetail, this, data, parse, Source::FromFile);
|
||||||
// }
|
}
|
||||||
// catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
// {
|
{
|
||||||
// VExceptionObjectError excep(tr("Error creating or updating detail"), domElement);
|
VExceptionObjectError excep(tr("Error creating or updating detail"), domElement);
|
||||||
// excep.AddMoreInformation(e.ErrorMessage());
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
// throw excep;
|
throw excep;
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPattern::ParseDetailNodes(const QDomElement &domElement, VPiece &detail) const
|
||||||
|
{
|
||||||
|
const QStringList types = QStringList() << VToolSeamAllowance::NodePoint
|
||||||
|
<< VToolSeamAllowance::NodeArc
|
||||||
|
<< VToolSeamAllowance::NodeSpline
|
||||||
|
<< VToolSeamAllowance::NodeSplinePath;
|
||||||
|
|
||||||
|
const QDomNodeList nodeList = domElement.childNodes();
|
||||||
|
for (qint32 i = 0; i < nodeList.size(); ++i)
|
||||||
|
{
|
||||||
|
const QDomElement element = nodeList.at(i).toElement();
|
||||||
|
if (not element.isNull() && element.tagName() == VToolSeamAllowance::TagNode)
|
||||||
|
{
|
||||||
|
const quint32 id = GetParametrUInt(element, AttrIdObject, NULL_ID_STR);
|
||||||
|
const bool reverse = GetParametrUInt(element, VToolDetail::AttrReverse, "0");
|
||||||
|
|
||||||
|
const QString t = GetParametrString(element, AttrType, VToolSeamAllowance::NodePoint);
|
||||||
|
Tool tool;
|
||||||
|
|
||||||
|
switch (types.indexOf(t))
|
||||||
|
{
|
||||||
|
case 0: // VToolSeamAllowance::NodePoint
|
||||||
|
tool = Tool::NodePoint;
|
||||||
|
break;
|
||||||
|
case 1: // VToolSeamAllowance::NodeArc
|
||||||
|
tool = Tool::NodeArc;
|
||||||
|
break;
|
||||||
|
case 2: // VToolSeamAllowance::NodeSpline
|
||||||
|
tool = Tool::NodeSpline;
|
||||||
|
break;
|
||||||
|
case 3: // VToolSeamAllowance::NodeSplinePath
|
||||||
|
tool = Tool::NodeSplinePath;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
VException e(tr("Wrong tag name '%1'.").arg(t));
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
detail.Append(VPieceNode(id, tool, reverse));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief ParseDetails parse details tag.
|
* @brief ParseDetails parse details tag.
|
||||||
|
|
|
@ -115,6 +115,7 @@ private:
|
||||||
void ParseDrawElement(const QDomNode& node, const Document &parse);
|
void ParseDrawElement(const QDomNode& node, const Document &parse);
|
||||||
void ParseDrawMode(const QDomNode& node, const Document &parse, const Draw &mode);
|
void ParseDrawMode(const QDomNode& node, const Document &parse, const Draw &mode);
|
||||||
void ParseDetailElement(const QDomElement &domElement, const Document &parse);
|
void ParseDetailElement(const QDomElement &domElement, const Document &parse);
|
||||||
|
void ParseDetailNodes(const QDomElement &domElement, VPiece &detail) const;
|
||||||
void ParseDetails(const QDomElement &domElement, const Document &parse);
|
void ParseDetails(const QDomElement &domElement, const Document &parse);
|
||||||
|
|
||||||
void ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
void ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user