The tool Detail now supports Cubic Bezier Path curve.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-03-22 17:33:05 +02:00
parent 4c1c0d4d0a
commit ff667c8602
2 changed files with 25 additions and 5 deletions

View File

@ -2232,10 +2232,21 @@ void VPattern::ParseNodeSplinePath(const QDomElement &domElement, const Document
quint32 idTool = 0; quint32 idTool = 0;
SplinesCommonAttributes(domElement, id, idObject, idTool); SplinesCommonAttributes(domElement, id, idObject, idTool);
const auto obj = data->GetGObject(idObject);
if (obj->getType() == GOType::SplinePath)
{
VSplinePath *path = new VSplinePath(*data->GeometricObject<VSplinePath>(idObject)); VSplinePath *path = new VSplinePath(*data->GeometricObject<VSplinePath>(idObject));
path->setIdObject(idObject); path->setIdObject(idObject);
path->setMode(Draw::Modeling); path->setMode(Draw::Modeling);
data->UpdateGObject(id, path); data->UpdateGObject(id, path);
}
else
{
VCubicBezierPath *spl = new VCubicBezierPath(*data->GeometricObject<VCubicBezierPath>(idObject));
spl->setIdObject(idObject);
spl->setMode(Draw::Modeling);
data->UpdateGObject(id, spl);
}
VNodeSplinePath::Create(this, data, id, idObject, parse, Source::FromFile, idTool); VNodeSplinePath::Create(this, data, id, idObject, parse, Source::FromFile, idTool);
} }
catch (const VExceptionBadId &e) catch (const VExceptionBadId &e)

View File

@ -31,6 +31,7 @@
#include "../vgeometry/varc.h" #include "../vgeometry/varc.h"
#include "../vgeometry/vcubicbezier.h" #include "../vgeometry/vcubicbezier.h"
#include "../vgeometry/vsplinepath.h" #include "../vgeometry/vsplinepath.h"
#include "../vgeometry/vcubicbezierpath.h"
#include "../vwidgets/vmaingraphicsscene.h" #include "../vwidgets/vmaingraphicsscene.h"
#include "../vwidgets/vmaingraphicsview.h" #include "../vwidgets/vmaingraphicsview.h"
#include "../dialogs/tools/dialogtool.h" #include "../dialogs/tools/dialogtool.h"
@ -192,8 +193,16 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstrac
} }
break; break;
case (Tool::NodeSplinePath): case (Tool::NodeSplinePath):
{
const auto obj = data->GetGObject(nodeD.getId());
if (obj->getType() == GOType::SplinePath)
{ {
id = CreateNode<VSplinePath>(data, nodeD.getId()); id = CreateNode<VSplinePath>(data, nodeD.getId());
}
else
{
id = CreateNode<VCubicBezierPath>(data, nodeD.getId());
}
VNodeSplinePath::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui); VNodeSplinePath::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui);
} }
break; break;