Fix bug in copy piece tool.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-01-25 10:31:59 +02:00
parent 3ae5b3d99a
commit 2bf477ca8a

View File

@ -2007,6 +2007,9 @@ QVector<quint32> VToolSeamAllowance::DuplicatePins(const QVector<quint32> &pins,
{ {
QSharedPointer<VPointF> pin = initData.data->GeometricObject<VPointF>(pins.at(i)); QSharedPointer<VPointF> pin = initData.data->GeometricObject<VPointF>(pins.at(i));
VAbstractNode *tool = qobject_cast<VAbstractNode *>(VAbstractPattern::getTool(i));
SCASSERT(tool != nullptr)
VToolPinInitData initNodeData; VToolPinInitData initNodeData;
initNodeData.id = initData.data->AddGObject(new VPointF(*pin)); initNodeData.id = initData.data->AddGObject(new VPointF(*pin));
initNodeData.pointId = pin->getIdObject(); initNodeData.pointId = pin->getIdObject();
@ -2016,6 +2019,7 @@ QVector<quint32> VToolSeamAllowance::DuplicatePins(const QVector<quint32> &pins,
initNodeData.parse = Document::FullParse; initNodeData.parse = Document::FullParse;
initNodeData.typeCreation = Source::FromTool; initNodeData.typeCreation = Source::FromTool;
initNodeData.drawName = initData.drawName; initNodeData.drawName = initData.drawName;
initNodeData.idTool = tool->GetIdTool();
VToolPin::Create(initNodeData); VToolPin::Create(initNodeData);
newPins.append(initNodeData.id); newPins.append(initNodeData.id);
@ -2031,6 +2035,8 @@ QVector<quint32> VToolSeamAllowance::DuplicatePlaceLabels(const QVector<quint32>
for(int i=0; i < placeLabels.size(); ++i) for(int i=0; i < placeLabels.size(); ++i)
{ {
QSharedPointer<VPlaceLabelItem> label = initData.data->GeometricObject<VPlaceLabelItem>(placeLabels.at(i)); QSharedPointer<VPlaceLabelItem> label = initData.data->GeometricObject<VPlaceLabelItem>(placeLabels.at(i));
VAbstractNode *tool = qobject_cast<VAbstractNode *>(VAbstractPattern::getTool(placeLabels.at(i)));
SCASSERT(tool != nullptr)
VToolPlaceLabelInitData initNodeData; VToolPlaceLabelInitData initNodeData;
initNodeData.idObject = NULL_ID; // piece id initNodeData.idObject = NULL_ID; // piece id
@ -2045,6 +2051,7 @@ QVector<quint32> VToolSeamAllowance::DuplicatePlaceLabels(const QVector<quint32>
initNodeData.type = label->GetLabelType(); initNodeData.type = label->GetLabelType();
initNodeData.centerPoint = label->GetCenterPoint(); initNodeData.centerPoint = label->GetCenterPoint();
initNodeData.id = initNodeData.data->AddGObject(new VPlaceLabelItem(*label)); initNodeData.id = initNodeData.data->AddGObject(new VPlaceLabelItem(*label));
initNodeData.idTool = tool->GetIdTool();
VToolPlaceLabel::Create(initNodeData); VToolPlaceLabel::Create(initNodeData);
newPlaceLabels.append(initNodeData.id); newPlaceLabels.append(initNodeData.id);