The tool Detail now supports Cubic Bezier curve.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-03-10 19:08:37 +02:00
parent 2548697a9e
commit 2d69e1a46f
2 changed files with 26 additions and 5 deletions

View File

@ -2141,10 +2141,22 @@ void VPattern::ParseNodeSpline(const QDomElement &domElement, const Document &pa
quint32 idTool = 0;
SplinesCommonAttributes(domElement, id, idObject, idTool);
VSpline *spl = new VSpline(*data->GeometricObject<VSpline>(idObject));
spl->setIdObject(idObject);
spl->setMode(Draw::Modeling);
data->UpdateGObject(id, spl);
const auto obj = data->GetGObject(idObject);
if (obj->getType() == GOType::Spline)
{
VSpline *spl = new VSpline(*data->GeometricObject<VSpline>(idObject));
spl->setIdObject(idObject);
spl->setMode(Draw::Modeling);
data->UpdateGObject(id, spl);
}
else
{
VCubicBezier *spl = new VCubicBezier(*data->GeometricObject<VCubicBezier>(idObject));
spl->setIdObject(idObject);
spl->setMode(Draw::Modeling);
data->UpdateGObject(id, spl);
}
VNodeSpline::Create(this, data, id, idObject, parse, Source::FromFile, idTool);
}
catch (const VExceptionBadId &e)

View File

@ -29,6 +29,7 @@
#include "vtooldetail.h"
#include "nodeDetails/nodedetails.h"
#include "../vgeometry/varc.h"
#include "../vgeometry/vcubicbezier.h"
#include "../vgeometry/vsplinepath.h"
#include "../vwidgets/vmaingraphicsscene.h"
#include "../vwidgets/vmaingraphicsview.h"
@ -178,7 +179,15 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstrac
break;
case (Tool::NodeSpline):
{
id = CreateNode<VSpline>(data, nodeD.getId());
const auto obj = data->GetGObject(nodeD.getId());
if (obj->getType() == GOType::Spline)
{
id = CreateNode<VSpline>(data, nodeD.getId());
}
else
{
id = CreateNode<VCubicBezier>(data, nodeD.getId());
}
VNodeSpline::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui);
}
break;