For modeling no need to seek parent tool id.

(grafted from b84438717fd8436e747b3982461cee3c4124d935)

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-03-15 17:32:12 +02:00
parent a56c3354e1
commit 4a9302ee4e

View File

@ -73,25 +73,7 @@ void VUndoCommand::IncrementReferences(const QVector<VNodeDetail> &nodes) const
{ {
for (qint32 i = 0; i < nodes.size(); ++i) for (qint32 i = 0; i < nodes.size(); ++i)
{ {
switch (nodes.at(i).getTypeTool()) doc->IncrementReferens(nodes.at(i).getId());
{
case (Tool::NodePoint):
{
auto tool = qobject_cast<VAbstractTool *>(doc->getTool(nodeId));
SCASSERT(tool != nullptr);
const auto point = tool->getData()->GeometricObject<VPointF>(nodes.at(i).getId());
doc->IncrementReferens(point->getIdTool());
break;
}
case (Tool::NodeArc):
case (Tool::NodeSpline):
case (Tool::NodeSplinePath):
doc->IncrementReferens(nodes.at(i).getId());
break;
default:
qDebug()<<"Get wrong tool type. Ignore.";
break;
}
} }
} }
@ -100,24 +82,6 @@ void VUndoCommand::DecrementReferences(const QVector<VNodeDetail> &nodes) const
{ {
for (qint32 i = 0; i < nodes.size(); ++i) for (qint32 i = 0; i < nodes.size(); ++i)
{ {
switch (nodes.at(i).getTypeTool()) doc->DecrementReferens(nodes.at(i).getId());
{
case (Tool::NodePoint):
{
auto tool = qobject_cast<VAbstractTool *>(doc->getTool(nodeId));
SCASSERT(tool != nullptr);
const auto point = tool->getData()->GeometricObject<VPointF>(nodes.at(i).getId());
doc->DecrementReferens(point->getIdTool());
break;
}
case (Tool::NodeArc):
case (Tool::NodeSpline):
case (Tool::NodeSplinePath):
doc->DecrementReferens(nodes.at(i).getId());
break;
default:
qDebug()<<"Get wrong tool type. Ignore.";
break;
}
} }
} }