Read and save a spline path attribute 'duplicate'.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-02-16 15:37:01 +02:00
parent c80fe9c61b
commit 0846d3c282
2 changed files with 19 additions and 1 deletions

View File

@ -1894,7 +1894,13 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement
ToolsCommonAttributes(domElement, id); ToolsCommonAttributes(domElement, id);
const qreal kCurve = GetParametrDouble(domElement, AttrKCurve, "1.0"); const qreal kCurve = GetParametrDouble(domElement, AttrKCurve, "1.0");
const QString color = GetParametrString(domElement, AttrColor, ColorBlack); const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
VSplinePath *path = new VSplinePath(kCurve); const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, "0");
auto path = new VSplinePath(kCurve);
if (duplicate > 0)
{
path->SetDuplicate(duplicate);
}
const QDomNodeList nodeList = domElement.childNodes(); const QDomNodeList nodeList = domElement.childNodes();
const qint32 num = nodeList.size(); const qint32 num = nodeList.size();

View File

@ -404,6 +404,18 @@ void VToolSplinePath::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &ob
doc->SetAttribute(tag, AttrType, ToolType); doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrKCurve, splPath->GetKCurve()); doc->SetAttribute(tag, AttrKCurve, splPath->GetKCurve());
if (splPath->GetDuplicate() > 0)
{
doc->SetAttribute(tag, AttrDuplicate, splPath->GetDuplicate());
}
else
{
if (tag.hasAttribute(AttrDuplicate))
{
tag.removeAttribute(AttrDuplicate);
}
}
doc->RemoveAllChild(tag); doc->RemoveAllChild(tag);
for (qint32 i = 0; i < splPath->CountPoint(); ++i) for (qint32 i = 0; i < splPath->CountPoint(); ++i)
{ {