From 2d69e1a46ff3cd2ef27281a79677083c6bdbd374 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 10 Mar 2016 19:08:37 +0200 Subject: [PATCH] The tool Detail now supports Cubic Bezier curve. --HG-- branch : feature --- src/app/valentina/xml/vpattern.cpp | 20 ++++++++++++++++---- src/libs/vtools/tools/vtooldetail.cpp | 11 ++++++++++- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 0328f3da2..7311a8b72 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -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(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(idObject)); + spl->setIdObject(idObject); + spl->setMode(Draw::Modeling); + data->UpdateGObject(id, spl); + } + else + { + VCubicBezier *spl = new VCubicBezier(*data->GeometricObject(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) diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp index e3fd18cea..525dc0176 100644 --- a/src/libs/vtools/tools/vtooldetail.cpp +++ b/src/libs/vtools/tools/vtooldetail.cpp @@ -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(data, nodeD.getId()); + const auto obj = data->GetGObject(nodeD.getId()); + if (obj->getType() == GOType::Spline) + { + id = CreateNode(data, nodeD.getId()); + } + else + { + id = CreateNode(data, nodeD.getId()); + } VNodeSpline::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui); } break;