Fixed saving grainline formulas when grainline is set to not visible

--HG--
branch : feature
This commit is contained in:
BojanKverh 2016-10-23 21:24:16 +02:00
parent e82f65fc6a
commit 5862264a1d
2 changed files with 12 additions and 8 deletions

View File

@ -726,16 +726,23 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
ptPos.setX(GetParametrDouble(element, AttrMx, "0")); ptPos.setX(GetParametrDouble(element, AttrMx, "0"));
ptPos.setY(GetParametrDouble(element, AttrMy, "0")); ptPos.setY(GetParametrDouble(element, AttrMy, "0"));
detail.GetGrainlineGeometry().SetPos(ptPos); detail.GetGrainlineGeometry().SetPos(ptPos);
if (detail.GetGrainlineGeometry().IsVisible() == true) try
{ {
QString qsLength = GetParametrString(element, AttrLength); QString qsLength = GetParametrString(element, AttrLength);
detail.GetGrainlineGeometry().SetLength(qsLength); detail.GetGrainlineGeometry().SetLength(qsLength);
}
catch (...)
{
detail.GetGrainlineGeometry().SetLength("");
}
try
{
QString qsRot = GetParametrString(element, VToolDetail::AttrRotation); QString qsRot = GetParametrString(element, VToolDetail::AttrRotation);
detail.GetGrainlineGeometry().SetRotation(qsRot); detail.GetGrainlineGeometry().SetRotation(qsRot);
} }
else catch(...)
{ {
detail.GetGrainlineGeometry().SetLength("");
detail.GetGrainlineGeometry().SetRotation(""); detail.GetGrainlineGeometry().SetRotation("");
} }
} }

View File

@ -208,11 +208,8 @@ void SaveDetailOptions::SaveGrainline(QDomElement &domElement, const VDetail &de
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, glGeom.IsVisible() == true? trueStr : falseStr); doc->SetAttribute(domData, VAbstractPattern::AttrVisible, glGeom.IsVisible() == true? trueStr : falseStr);
doc->SetAttribute(domData, AttrMx, glGeom.GetPos().x()); doc->SetAttribute(domData, AttrMx, glGeom.GetPos().x());
doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y()); doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y());
if (glGeom.IsVisible() == true) doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
{ doc->SetAttribute(domData, VToolDetail::AttrRotation, glGeom.GetRotation());
doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
doc->SetAttribute(domData, VToolDetail::AttrRotation, glGeom.GetRotation());
}
domElement.appendChild(domData); domElement.appendChild(domData);
} }