Optimization. Update increments only if necessary.
--HG-- branch : develop
This commit is contained in:
parent
8a6ee744c6
commit
cf3be706c2
|
@ -736,7 +736,7 @@ void DialogIncrements::RefreshPattern()
|
||||||
const int row = ui->tableWidgetIncrement->currentRow();
|
const int row = ui->tableWidgetIncrement->currentRow();
|
||||||
const int rowPC = ui->tableWidgetPC->currentRow();
|
const int rowPC = ui->tableWidgetPC->currentRow();
|
||||||
|
|
||||||
doc->LiteParseTree(Document::LiteParse);
|
doc->LiteParseTree(Document::FullLiteParse);
|
||||||
|
|
||||||
ui->tableWidgetIncrement->blockSignals(true);
|
ui->tableWidgetIncrement->blockSignals(true);
|
||||||
ui->tableWidgetIncrement->selectRow(row);
|
ui->tableWidgetIncrement->selectRow(row);
|
||||||
|
|
|
@ -153,6 +153,9 @@ void VPattern::Parse(const Document &parse)
|
||||||
case Document::LiteParse:
|
case Document::LiteParse:
|
||||||
qCDebug(vXML, "Lite parse.");
|
qCDebug(vXML, "Lite parse.");
|
||||||
break;
|
break;
|
||||||
|
case Document::FullLiteParse:
|
||||||
|
qCDebug(vXML, "Full lite parse.");
|
||||||
|
break;
|
||||||
case Document::LitePPParse:
|
case Document::LitePPParse:
|
||||||
qCDebug(vXML, "Lite pattern piece parse.");
|
qCDebug(vXML, "Lite pattern piece parse.");
|
||||||
break;
|
break;
|
||||||
|
@ -162,12 +165,9 @@ void VPattern::Parse(const Document &parse)
|
||||||
|
|
||||||
SCASSERT(sceneDraw != nullptr)
|
SCASSERT(sceneDraw != nullptr)
|
||||||
SCASSERT(sceneDetail != nullptr)
|
SCASSERT(sceneDetail != nullptr)
|
||||||
QStringList tags = QStringList() << TagDraw << TagIncrements << TagDescription << TagNotes
|
static const QStringList tags({TagDraw, TagIncrements, TagPreviewCalculations});
|
||||||
<< TagMeasurements << TagVersion << TagGradation << TagImage << TagUnit
|
|
||||||
<< TagPatternName << TagPatternNum << TagCompanyName << TagCustomerName
|
|
||||||
<< TagPatternLabel << TagPatternMaterials << TagPreviewCalculations
|
|
||||||
<< TagFinalMeasurements;
|
|
||||||
PrepareForParse(parse);
|
PrepareForParse(parse);
|
||||||
|
|
||||||
QDomNode domNode = documentElement().firstChild();
|
QDomNode domNode = documentElement().firstChild();
|
||||||
while (domNode.isNull() == false)
|
while (domNode.isNull() == false)
|
||||||
{
|
{
|
||||||
|
@ -199,57 +199,21 @@ void VPattern::Parse(const Document &parse)
|
||||||
ParseDrawElement(domElement, parse);
|
ParseDrawElement(domElement, parse);
|
||||||
break;
|
break;
|
||||||
case 1: // TagIncrements
|
case 1: // TagIncrements
|
||||||
qCDebug(vXML, "Tag increments.");
|
if (parse != Document::LiteParse)
|
||||||
ParseIncrementsElement(domElement, parse);
|
{
|
||||||
|
qCDebug(vXML, "Tag increments.");
|
||||||
|
ParseIncrementsElement(domElement, parse);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // TagDescription
|
case 2: // TagPreviewCalculations
|
||||||
qCDebug(vXML, "Tag description.");
|
if (parse != Document::LiteParse)
|
||||||
break;
|
{
|
||||||
case 3: // TagNotes
|
qCDebug(vXML, "Tag prewiew calculations.");
|
||||||
qCDebug(vXML, "Tag notes.");
|
ParseIncrementsElement(domElement, parse);
|
||||||
break;
|
}
|
||||||
case 4: // TagMeasurements
|
|
||||||
qCDebug(vXML, "Tag measurements.");
|
|
||||||
break;
|
|
||||||
case 5: // TagVersion
|
|
||||||
qCDebug(vXML, "Tag version.");
|
|
||||||
break;
|
|
||||||
case 6: // TagGradation
|
|
||||||
qCDebug(vXML, "Tag gradation.");
|
|
||||||
break;
|
|
||||||
case 7: // TagImage
|
|
||||||
qCDebug(vXML, "Tag image.");
|
|
||||||
break;
|
|
||||||
case 8: // TagUnit
|
|
||||||
qCDebug(vXML, "Tag unit.");
|
|
||||||
break;
|
|
||||||
case 9: // TagPatternName
|
|
||||||
qCDebug(vXML, "Pattern name.");
|
|
||||||
break;
|
|
||||||
case 10: // TagPatternNumber
|
|
||||||
qCDebug(vXML, "Pattern number.");
|
|
||||||
break;
|
|
||||||
case 11: // TagCompanyName
|
|
||||||
qCDebug(vXML, "Company name.");
|
|
||||||
break;
|
|
||||||
case 12: // TagCustomerName
|
|
||||||
qCDebug(vXML, "Customer name.");
|
|
||||||
break;
|
|
||||||
case 13: // TagPatternLabel
|
|
||||||
qCDebug(vXML, "Pattern label.");
|
|
||||||
break;
|
|
||||||
case 14: // TagPatternMaterials
|
|
||||||
qCDebug(vXML, "Pattern materials.");
|
|
||||||
break;
|
|
||||||
case 15: // TagPreviewCalculations
|
|
||||||
qCDebug(vXML, "Tag prewiew calculations.");
|
|
||||||
ParseIncrementsElement(domElement, parse);
|
|
||||||
break;
|
|
||||||
case 16: // TagFinalMeasurements
|
|
||||||
qCDebug(vXML, "Tag final measurements.");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qCDebug(vXML, "Wrong tag name %s", qUtf8Printable(domElement.tagName()));
|
qCDebug(vXML, "Ignoring tag %s", qUtf8Printable(domElement.tagName()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -561,6 +525,7 @@ void VPattern::LiteParseTree(const Document &parse)
|
||||||
case Document::LitePPParse:
|
case Document::LitePPParse:
|
||||||
ParseCurrentPP();
|
ParseCurrentPP();
|
||||||
break;
|
break;
|
||||||
|
case Document::FullLiteParse:
|
||||||
case Document::LiteParse:
|
case Document::LiteParse:
|
||||||
Parse(parse);
|
Parse(parse);
|
||||||
break;
|
break;
|
||||||
|
@ -768,23 +733,15 @@ void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const
|
||||||
{
|
{
|
||||||
SCASSERT(sceneDraw != nullptr)
|
SCASSERT(sceneDraw != nullptr)
|
||||||
SCASSERT(sceneDetail != nullptr)
|
SCASSERT(sceneDetail != nullptr)
|
||||||
VMainGraphicsScene *scene = nullptr;
|
VMainGraphicsScene *scene = mode == Draw::Calculation ? sceneDraw : sceneDetail;
|
||||||
if (mode == Draw::Calculation)
|
static const QStringList tags({TagPoint,
|
||||||
{
|
TagLine,
|
||||||
scene = sceneDraw;
|
TagSpline,
|
||||||
}
|
TagArc,
|
||||||
else
|
TagTools,
|
||||||
{
|
TagOperation,
|
||||||
scene = sceneDetail;
|
TagElArc,
|
||||||
}
|
TagPath});
|
||||||
const QStringList tags = QStringList() << TagPoint
|
|
||||||
<< TagLine
|
|
||||||
<< TagSpline
|
|
||||||
<< TagArc
|
|
||||||
<< TagTools
|
|
||||||
<< TagOperation
|
|
||||||
<< TagElArc
|
|
||||||
<< TagPath;
|
|
||||||
const QDomNodeList nodeList = node.childNodes();
|
const QDomNodeList nodeList = node.childNodes();
|
||||||
const qint32 num = nodeList.size();
|
const qint32 num = nodeList.size();
|
||||||
for (qint32 i = 0; i < num; ++i)
|
for (qint32 i = 0; i < num; ++i)
|
||||||
|
@ -1167,31 +1124,31 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of point is empty");
|
Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of point is empty");
|
||||||
|
|
||||||
QStringList points = QStringList() << VToolBasePoint::ToolType /*0*/
|
static const QStringList points({VToolBasePoint::ToolType, /*0*/
|
||||||
<< VToolEndLine::ToolType /*1*/
|
VToolEndLine::ToolType, /*1*/
|
||||||
<< VToolAlongLine::ToolType /*2*/
|
VToolAlongLine::ToolType, /*2*/
|
||||||
<< VToolShoulderPoint::ToolType /*3*/
|
VToolShoulderPoint::ToolType, /*3*/
|
||||||
<< VToolNormal::ToolType /*4*/
|
VToolNormal::ToolType, /*4*/
|
||||||
<< VToolBisector::ToolType /*5*/
|
VToolBisector::ToolType, /*5*/
|
||||||
<< VToolLineIntersect::ToolType /*6*/
|
VToolLineIntersect::ToolType, /*6*/
|
||||||
<< VToolPointOfContact::ToolType /*7*/
|
VToolPointOfContact::ToolType, /*7*/
|
||||||
<< VNodePoint::ToolType /*8*/
|
VNodePoint::ToolType, /*8*/
|
||||||
<< VToolHeight::ToolType /*9*/
|
VToolHeight::ToolType, /*9*/
|
||||||
<< VToolTriangle::ToolType /*10*/
|
VToolTriangle::ToolType, /*10*/
|
||||||
<< VToolPointOfIntersection::ToolType /*11*/
|
VToolPointOfIntersection::ToolType, /*11*/
|
||||||
<< VToolCutSpline::ToolType /*12*/
|
VToolCutSpline::ToolType, /*12*/
|
||||||
<< VToolCutSplinePath::ToolType /*13*/
|
VToolCutSplinePath::ToolType, /*13*/
|
||||||
<< VToolCutArc::ToolType /*14*/
|
VToolCutArc::ToolType, /*14*/
|
||||||
<< VToolLineIntersectAxis::ToolType /*15*/
|
VToolLineIntersectAxis::ToolType, /*15*/
|
||||||
<< VToolCurveIntersectAxis::ToolType /*16*/
|
VToolCurveIntersectAxis::ToolType, /*16*/
|
||||||
<< VToolPointOfIntersectionArcs::ToolType /*17*/
|
VToolPointOfIntersectionArcs::ToolType, /*17*/
|
||||||
<< VToolPointOfIntersectionCircles::ToolType /*18*/
|
VToolPointOfIntersectionCircles::ToolType, /*18*/
|
||||||
<< VToolPointFromCircleAndTangent::ToolType /*19*/
|
VToolPointFromCircleAndTangent::ToolType, /*19*/
|
||||||
<< VToolPointFromArcAndTangent::ToolType /*20*/
|
VToolPointFromArcAndTangent::ToolType, /*20*/
|
||||||
<< VToolTrueDarts::ToolType /*21*/
|
VToolTrueDarts::ToolType, /*21*/
|
||||||
<< VToolPointOfIntersectionCurves::ToolType /*22*/
|
VToolPointOfIntersectionCurves::ToolType, /*22*/
|
||||||
<< VToolPin::ToolType /*23*/
|
VToolPin::ToolType, /*23*/
|
||||||
<< VToolPlaceLabel::ToolType; /*24*/
|
VToolPlaceLabel::ToolType}); /*24*/
|
||||||
switch (points.indexOf(type))
|
switch (points.indexOf(type))
|
||||||
{
|
{
|
||||||
case 0: //VToolBasePoint::ToolType
|
case 0: //VToolBasePoint::ToolType
|
||||||
|
@ -3539,14 +3496,14 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, QDomElement &domEle
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
||||||
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
|
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
|
||||||
|
|
||||||
QStringList splines = QStringList() << VToolSpline::OldToolType /*0*/
|
static const QStringList splines({VToolSpline::OldToolType, /*0*/
|
||||||
<< VToolSpline::ToolType /*1*/
|
VToolSpline::ToolType, /*1*/
|
||||||
<< VToolSplinePath::OldToolType /*2*/
|
VToolSplinePath::OldToolType, /*2*/
|
||||||
<< VToolSplinePath::ToolType /*3*/
|
VToolSplinePath::ToolType, /*3*/
|
||||||
<< VNodeSpline::ToolType /*4*/
|
VNodeSpline::ToolType, /*4*/
|
||||||
<< VNodeSplinePath::ToolType /*5*/
|
VNodeSplinePath::ToolType, /*5*/
|
||||||
<< VToolCubicBezier::ToolType /*6*/
|
VToolCubicBezier::ToolType, /*6*/
|
||||||
<< VToolCubicBezierPath::ToolType; /*7*/
|
VToolCubicBezierPath::ToolType});/*7*/
|
||||||
switch (splines.indexOf(type))
|
switch (splines.indexOf(type))
|
||||||
{
|
{
|
||||||
case 0: //VToolSpline::OldToolType
|
case 0: //VToolSpline::OldToolType
|
||||||
|
@ -4272,17 +4229,21 @@ void VPattern::PrepareForParse(const Document &parse)
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
history.clear();
|
history.clear();
|
||||||
}
|
}
|
||||||
else if (parse == Document::LiteParse)
|
else if (parse == Document::LiteParse || parse == Document::FullLiteParse)
|
||||||
{
|
{
|
||||||
data->ClearUniqueNames();
|
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(VarType::Unknown) == 8, "Check that you used all types");
|
Q_STATIC_ASSERT_X(static_cast<int>(VarType::Unknown) == 8, "Check that you used all types");
|
||||||
data->ClearVariables(QVector<VarType>({VarType::Increment,
|
QVector<VarType> types({VarType::LineAngle,
|
||||||
VarType::LineAngle,
|
VarType::LineLength,
|
||||||
VarType::LineLength,
|
VarType::CurveLength,
|
||||||
VarType::CurveLength,
|
VarType::CurveCLength,
|
||||||
VarType::CurveCLength,
|
VarType::ArcRadius,
|
||||||
VarType::ArcRadius,
|
VarType::CurveAngle});
|
||||||
VarType::CurveAngle}));
|
if (parse == Document::FullLiteParse)
|
||||||
|
{
|
||||||
|
types.append(VarType::Increment);
|
||||||
|
}
|
||||||
|
|
||||||
|
data->ClearVariables(types);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ class QDomElement;
|
||||||
class VPiecePath;
|
class VPiecePath;
|
||||||
class VPieceNode;
|
class VPieceNode;
|
||||||
|
|
||||||
enum class Document : char { LiteParse, LitePPParse, FullParse };
|
enum class Document : char { FullLiteParse, LiteParse, LitePPParse, FullParse };
|
||||||
enum class LabelType : char {NewPatternPiece, NewLabel};
|
enum class LabelType : char {NewPatternPiece, NewLabel};
|
||||||
|
|
||||||
// Don't touch values!!!. Same values stored in xml.
|
// Don't touch values!!!. Same values stored in xml.
|
||||||
|
|
|
@ -338,9 +338,8 @@ void VContainer::AddVariable(const QString& name, const QSharedPointer<T> &var)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d->variables.insert(name, var);
|
d->variables.insert(name, var);
|
||||||
|
uniqueNames[d->nspace].insert(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
uniqueNames[d->nspace].insert(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -216,7 +216,7 @@ VToolSpline *VToolSpline::Create(VToolSplineInitData &initData)
|
||||||
auto p4 = initData.data->GeometricObject<VPointF>(initData.point4);
|
auto p4 = initData.data->GeometricObject<VPointF>(initData.point4);
|
||||||
|
|
||||||
auto* spline = new VSpline(*p1, *p4, calcAngle1, initData.a1, calcAngle2, initData.a2, calcLength1, initData.l1,
|
auto* spline = new VSpline(*p1, *p4, calcAngle1, initData.a1, calcAngle2, initData.a2, calcLength1, initData.l1,
|
||||||
calcLength2, initData.l2);
|
calcLength2, initData.l2);
|
||||||
if (initData.duplicate > 0)
|
if (initData.duplicate > 0)
|
||||||
{
|
{
|
||||||
spline->SetDuplicate(initData.duplicate);
|
spline->SetDuplicate(initData.duplicate);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user