Refactoring.

Rename method name.
This commit is contained in:
Roman Telezhynskyi 2023-01-16 15:50:53 +02:00
parent 32f6b1be3e
commit 07dbc5e2ff
7 changed files with 76 additions and 76 deletions

View File

@ -1036,11 +1036,11 @@ void VPattern::ParseDetailInternals(const QDomElement &domElement, VPiece &detai
break;
case 1:// TagData
futurePPData = QtConcurrent::run(this, &VPattern::ParsePieceDataTag, element,
detail.GetPatternPieceData());
detail.GetPieceLabelData());
break;
case 2:// TagPatternInfo
futurePatternInfo = QtConcurrent::run(this, &VPattern::ParsePiecePatternInfo, element,
detail.GetPatternInfo());
detail.GetPatternLabelData());
break;
case 3:// TagGrainline
futureGGeometry = QtConcurrent::run(this, &VPattern::ParsePieceGrainline, element,
@ -1075,12 +1075,12 @@ void VPattern::ParseDetailInternals(const QDomElement &domElement, VPiece &detai
if (not futurePPData.isCanceled())
{
detail.SetPatternPieceData(futurePPData.result());
detail.SetPieceLabelData(futurePPData.result());
}
if (not futurePatternInfo.isCanceled())
{
detail.SetPatternInfo(futurePatternInfo.result());
detail.SetPatternLabelData(futurePatternInfo.result());
}
if (not futureGGeometry.isCanceled())

View File

@ -669,14 +669,14 @@ auto VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContainer *pat
throw VException (tr("Piece %1 doesn't have shape.").arg(piece.GetName()));
}
const VPieceLabelData& data = piece.GetPatternPieceData();
const VPieceLabelData& data = piece.GetPieceLabelData();
det.SetQuantity(data.GetQuantity());
if (data.IsVisible())
{
det.SetPieceText(piece.GetName(), data, VAbstractApplication::VApp()->Settings()->GetLabelFont(), pattern);
}
const VPatternLabelData& geom = piece.GetPatternInfo();
const VPatternLabelData& geom = piece.GetPatternLabelData();
if (geom.IsVisible())
{
VAbstractPattern* pDoc = VAbstractValApplication::VApp()->getCurrentDocument();

View File

@ -570,7 +570,7 @@ QVector<quint32> VPiece::MissingPlaceLabels(const VPiece &det) const
}
//---------------------------------------------------------------------------------------------------------------------
void VPiece::SetPatternPieceData(const VPieceLabelData &data)
void VPiece::SetPieceLabelData(const VPieceLabelData &data)
{
d->m_ppData = data;
d->m_ppData.SetAreaShartName(VPieceArea::PieceShortName(*this));
@ -581,7 +581,7 @@ void VPiece::SetPatternPieceData(const VPieceLabelData &data)
* @brief Returns full access to the pattern piece data object
* @return pattern piece data object
*/
VPieceLabelData &VPiece::GetPatternPieceData()
VPieceLabelData &VPiece::GetPieceLabelData()
{
return d->m_ppData;
}
@ -591,13 +591,13 @@ VPieceLabelData &VPiece::GetPatternPieceData()
* @brief Returns the read only reference to the pattern piece data object
* @return pattern piece data object
*/
const VPieceLabelData &VPiece::GetPatternPieceData() const
const VPieceLabelData &VPiece::GetPieceLabelData() const
{
return d->m_ppData;
}
//---------------------------------------------------------------------------------------------------------------------
void VPiece::SetPatternInfo(const VPatternLabelData &info)
void VPiece::SetPatternLabelData(const VPatternLabelData &info)
{
d->m_piPatternInfo = info;
}
@ -607,7 +607,7 @@ void VPiece::SetPatternInfo(const VPatternLabelData &info)
* @brief Returns full access to the pattern info geometry object
* @return pattern info geometry object
*/
VPatternLabelData &VPiece::GetPatternInfo()
VPatternLabelData &VPiece::GetPatternLabelData()
{
return d->m_piPatternInfo;
}
@ -617,7 +617,7 @@ VPatternLabelData &VPiece::GetPatternInfo()
* @brief Returns the read only reference to the pattern info geometry object
* @return pattern info geometry object
*/
const VPatternLabelData &VPiece::GetPatternInfo() const
const VPatternLabelData &VPiece::GetPatternLabelData() const
{
return d->m_piPatternInfo;
}

View File

@ -121,13 +121,13 @@ public:
QVector<quint32> MissingPins(const VPiece &det) const;
QVector<quint32> MissingPlaceLabels(const VPiece &det) const;
void SetPatternPieceData(const VPieceLabelData &data);
VPieceLabelData& GetPatternPieceData();
const VPieceLabelData& GetPatternPieceData() const;
void SetPieceLabelData(const VPieceLabelData &data);
VPieceLabelData& GetPieceLabelData();
const VPieceLabelData& GetPieceLabelData() const;
void SetPatternInfo(const VPatternLabelData &info);
VPatternLabelData& GetPatternInfo();
const VPatternLabelData& GetPatternInfo() const;
void SetPatternLabelData(const VPatternLabelData &info);
VPatternLabelData& GetPatternLabelData();
const VPatternLabelData& GetPatternLabelData() const;
void SetGrainlineGeometry(const VGrainlineData &data);
VGrainlineData& GetGrainlineGeometry();

View File

@ -775,7 +775,7 @@ void DialogEditLabel::SetTemplate(const QVector<VLabelTemplateLine> &lines)
//---------------------------------------------------------------------------------------------------------------------
void DialogEditLabel::SetPiece(const VPiece &piece)
{
const VPieceLabelData& pieceData = piece.GetPatternPieceData();
const VPieceLabelData& pieceData = piece.GetPieceLabelData();
m_placeholders[pl_pLetter].second = pieceData.GetLetter();
m_placeholders[pl_pAnnotation].second = pieceData.GetAnnotation();
m_placeholders[pl_pOrientation].second = pieceData.GetOrientation();

View File

@ -366,7 +366,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
->FormulaToUser(piece.GetFormulaSAWidth(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
m_saWidth = piece.GetSAWidth();
const VPieceLabelData &ppData = piece.GetPatternPieceData();
const VPieceLabelData &ppData = piece.GetPieceLabelData();
uiTabLabels->lineEditLetter->setText(ppData.GetLetter());
uiTabLabels->lineEditAnnotation->setText(ppData.GetAnnotation());
uiTabLabels->lineEditOrientation->setText(ppData.GetOrientation());
@ -389,7 +389,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
SetDLHeight(ppData.GetLabelHeight());
SetDLAngle(ppData.GetRotation());
const VPatternLabelData &patternInfo = piece.GetPatternInfo();
const VPatternLabelData &patternInfo = piece.GetPatternLabelData();
uiTabLabels->groupBoxPatternLabel->setEnabled(not m_doc->GetPatternLabelTemplate().isEmpty());
uiTabLabels->groupBoxPatternLabel->setChecked(patternInfo.IsVisible());
ChangeCurrentData(uiTabLabels->comboBoxPLCenterPin, patternInfo.CenterPin());
@ -2605,53 +2605,53 @@ VPiece DialogSeamAllowance::CreatePiece() const
piece.SetGradationLabel(uiTabPaths->lineEditGradationLabel->text());
piece.SetPriority(static_cast<uint>(uiTabPaths->spinBoxPriority->value()));
piece.SetFormulaSAWidth(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidth), m_saWidth);
piece.GetPatternPieceData().SetLetter(uiTabLabels->lineEditLetter->text());
piece.GetPatternPieceData().SetAnnotation(uiTabLabels->lineEditAnnotation->text());
piece.GetPatternPieceData().SetOrientation(uiTabLabels->lineEditOrientation->text());
piece.GetPatternPieceData().SetRotationWay(uiTabLabels->lineEditRotation->text());
piece.GetPatternPieceData().SetTilt(uiTabLabels->lineEditTilt->text());
piece.GetPatternPieceData().SetFoldPosition(uiTabLabels->lineEditFoldPosition->text());
piece.GetPatternPieceData().SetQuantity(static_cast<quint16>(uiTabLabels->spinBoxQuantity->value()));
piece.GetPatternPieceData().SetOnFold(uiTabLabels->checkBoxFold->isChecked());
piece.GetPatternPieceData().SetLabelTemplate(m_templateLines);
piece.GetPatternPieceData().SetRotation(GetFormulaFromUser(uiTabLabels->lineEditDLAngleFormula));
piece.GetPatternPieceData().SetVisible(uiTabLabels->groupBoxDetailLabel->isChecked());
piece.GetPieceLabelData().SetLetter(uiTabLabels->lineEditLetter->text());
piece.GetPieceLabelData().SetAnnotation(uiTabLabels->lineEditAnnotation->text());
piece.GetPieceLabelData().SetOrientation(uiTabLabels->lineEditOrientation->text());
piece.GetPieceLabelData().SetRotationWay(uiTabLabels->lineEditRotation->text());
piece.GetPieceLabelData().SetTilt(uiTabLabels->lineEditTilt->text());
piece.GetPieceLabelData().SetFoldPosition(uiTabLabels->lineEditFoldPosition->text());
piece.GetPieceLabelData().SetQuantity(static_cast<quint16>(uiTabLabels->spinBoxQuantity->value()));
piece.GetPieceLabelData().SetOnFold(uiTabLabels->checkBoxFold->isChecked());
piece.GetPieceLabelData().SetLabelTemplate(m_templateLines);
piece.GetPieceLabelData().SetRotation(GetFormulaFromUser(uiTabLabels->lineEditDLAngleFormula));
piece.GetPieceLabelData().SetVisible(uiTabLabels->groupBoxDetailLabel->isChecked());
if (not flagDPin)
{
piece.GetPatternPieceData().SetLabelWidth(GetFormulaFromUser(uiTabLabels->lineEditDLWidthFormula));
piece.GetPatternPieceData().SetLabelHeight(GetFormulaFromUser(uiTabLabels->lineEditDLHeightFormula));
piece.GetPatternPieceData().SetCenterPin(getCurrentObjectId(uiTabLabels->comboBoxDLCenterPin));
piece.GetPatternPieceData().SetTopLeftPin(NULL_ID);
piece.GetPatternPieceData().SetBottomRightPin(NULL_ID);
piece.GetPieceLabelData().SetLabelWidth(GetFormulaFromUser(uiTabLabels->lineEditDLWidthFormula));
piece.GetPieceLabelData().SetLabelHeight(GetFormulaFromUser(uiTabLabels->lineEditDLHeightFormula));
piece.GetPieceLabelData().SetCenterPin(getCurrentObjectId(uiTabLabels->comboBoxDLCenterPin));
piece.GetPieceLabelData().SetTopLeftPin(NULL_ID);
piece.GetPieceLabelData().SetBottomRightPin(NULL_ID);
}
else
{
piece.GetPatternPieceData().SetLabelWidth(m_defLabelValue);
piece.GetPatternPieceData().SetLabelHeight(m_defLabelValue);
piece.GetPatternPieceData().SetCenterPin(NULL_ID);
piece.GetPatternPieceData().SetTopLeftPin(getCurrentObjectId(uiTabLabels->comboBoxDLTopLeftPin));
piece.GetPatternPieceData().SetBottomRightPin(getCurrentObjectId(uiTabLabels->comboBoxDLBottomRightPin));
piece.GetPieceLabelData().SetLabelWidth(m_defLabelValue);
piece.GetPieceLabelData().SetLabelHeight(m_defLabelValue);
piece.GetPieceLabelData().SetCenterPin(NULL_ID);
piece.GetPieceLabelData().SetTopLeftPin(getCurrentObjectId(uiTabLabels->comboBoxDLTopLeftPin));
piece.GetPieceLabelData().SetBottomRightPin(getCurrentObjectId(uiTabLabels->comboBoxDLBottomRightPin));
}
piece.GetPatternInfo().SetVisible(uiTabLabels->groupBoxPatternLabel->isChecked());
piece.GetPatternInfo().SetRotation(GetFormulaFromUser(uiTabLabels->lineEditPLAngleFormula));
piece.GetPatternLabelData().SetVisible(uiTabLabels->groupBoxPatternLabel->isChecked());
piece.GetPatternLabelData().SetRotation(GetFormulaFromUser(uiTabLabels->lineEditPLAngleFormula));
if (not flagPPin)
{
piece.GetPatternInfo().SetCenterPin(getCurrentObjectId(uiTabLabels->comboBoxPLCenterPin));
piece.GetPatternInfo().SetTopLeftPin(NULL_ID);
piece.GetPatternInfo().SetBottomRightPin(NULL_ID);
piece.GetPatternInfo().SetLabelWidth(GetFormulaFromUser(uiTabLabels->lineEditPLWidthFormula));
piece.GetPatternInfo().SetLabelHeight(GetFormulaFromUser(uiTabLabels->lineEditPLHeightFormula));
piece.GetPatternLabelData().SetCenterPin(getCurrentObjectId(uiTabLabels->comboBoxPLCenterPin));
piece.GetPatternLabelData().SetTopLeftPin(NULL_ID);
piece.GetPatternLabelData().SetBottomRightPin(NULL_ID);
piece.GetPatternLabelData().SetLabelWidth(GetFormulaFromUser(uiTabLabels->lineEditPLWidthFormula));
piece.GetPatternLabelData().SetLabelHeight(GetFormulaFromUser(uiTabLabels->lineEditPLHeightFormula));
}
else
{
piece.GetPatternInfo().SetCenterPin(NULL_ID);
piece.GetPatternInfo().SetTopLeftPin(getCurrentObjectId(uiTabLabels->comboBoxPLTopLeftPin));
piece.GetPatternInfo().SetBottomRightPin(getCurrentObjectId(uiTabLabels->comboBoxPLBottomRightPin));
piece.GetPatternInfo().SetLabelWidth(m_defLabelValue);
piece.GetPatternInfo().SetLabelHeight(m_defLabelValue);
piece.GetPatternLabelData().SetCenterPin(NULL_ID);
piece.GetPatternLabelData().SetTopLeftPin(getCurrentObjectId(uiTabLabels->comboBoxPLTopLeftPin));
piece.GetPatternLabelData().SetBottomRightPin(getCurrentObjectId(uiTabLabels->comboBoxPLBottomRightPin));
piece.GetPatternLabelData().SetLabelWidth(m_defLabelValue);
piece.GetPatternLabelData().SetLabelHeight(m_defLabelValue);
}
piece.GetGrainlineGeometry().SetVisible(uiTabGrainline->groupBoxGrainline->isChecked());

View File

@ -279,8 +279,8 @@ auto VToolSeamAllowance::Duplicate(VToolSeamAllowanceInitData &initData) -> VToo
const QMap<quint32, quint32> mappedPins = DuplicatePins(initData.detail.GetPins(), initData);
dupDetail.SetPins(ConvertToVector(mappedPins.values()));
dupDetail.SetPatternPieceData(FixLabelPins(initData.detail.GetPatternPieceData(), mappedPins));
dupDetail.SetPatternInfo(FixLabelPins(initData.detail.GetPatternInfo(), mappedPins));
dupDetail.SetPieceLabelData(FixLabelPins(initData.detail.GetPieceLabelData(), mappedPins));
dupDetail.SetPatternLabelData(FixLabelPins(initData.detail.GetPatternLabelData(), mappedPins));
dupDetail.SetGrainlineGeometry(FixGrainlinePins(initData.detail.GetGrainlineGeometry(), mappedPins));
initData.detail = dupDetail;
@ -439,7 +439,7 @@ void VToolSeamAllowance::AddPlaceLabels(VAbstractPattern *doc, QDomElement &domE
void VToolSeamAllowance::AddPatternPieceData(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece)
{
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
const VPieceLabelData& data = piece.GetPatternPieceData();
const VPieceLabelData& data = piece.GetPieceLabelData();
doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter());
doc->SetAttribute(domData, VAbstractPattern::AttrAnnotation, data.GetAnnotation());
doc->SetAttribute(domData, VAbstractPattern::AttrOrientation, data.GetOrientation());
@ -470,7 +470,7 @@ void VToolSeamAllowance::AddPatternPieceData(VAbstractPattern *doc, QDomElement
void VToolSeamAllowance::AddPatternInfo(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece)
{
QDomElement domData = doc->createElement(VAbstractPattern::TagPatternInfo);
const VPatternLabelData& geom = piece.GetPatternInfo();
const VPatternLabelData& geom = piece.GetPatternLabelData();
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, geom.IsVisible());
doc->SetAttribute(domData, AttrMx, geom.GetPos().x());
doc->SetAttribute(domData, AttrMy, geom.GetPos().y());
@ -652,14 +652,14 @@ void VToolSeamAllowance::ResetChildren(QGraphicsItem *pItem)
VTextGraphicsItem* pVGI = qgraphicsitem_cast<VTextGraphicsItem*>(pItem);
if (pVGI != m_dataLabel)
{
if (detail.GetPatternPieceData().IsVisible())
if (detail.GetPieceLabelData().IsVisible())
{
m_dataLabel->Reset();
}
}
if (pVGI != m_patternInfo)
{
if (detail.GetPatternInfo().IsVisible())
if (detail.GetPatternLabelData().IsVisible())
{
m_patternInfo->Reset();
}
@ -704,7 +704,7 @@ void VToolSeamAllowance::Highlight(quint32 id)
void VToolSeamAllowance::UpdateDetailLabel()
{
const VPiece detail = VAbstractTool::data.GetPiece(m_id);
const VPieceLabelData& labelData = detail.GetPatternPieceData();
const VPieceLabelData& labelData = detail.GetPieceLabelData();
const QVector<quint32> &pins = detail.GetPins();
if (labelData.IsVisible() == true)
@ -731,7 +731,7 @@ void VToolSeamAllowance::UpdateDetailLabel()
void VToolSeamAllowance::UpdatePatternInfo()
{
const VPiece detail = VAbstractTool::data.GetPiece(m_id);
const VPatternLabelData& geom = detail.GetPatternInfo();
const VPatternLabelData& geom = detail.GetPatternLabelData();
const QVector<quint32> &pins = detail.GetPins();
if (geom.IsVisible() == true)
@ -808,7 +808,7 @@ void VToolSeamAllowance::SaveMoveDetail(const QPointF& ptPos)
{
VPiece oldDet = VAbstractTool::data.GetPiece(m_id);
VPiece newDet = oldDet;
newDet.GetPatternPieceData().SetPos(ptPos);
newDet.GetPieceLabelData().SetPos(ptPos);
SavePieceOptions* moveCommand = new SavePieceOptions(oldDet, newDet, doc, m_id);
moveCommand->setText(tr("move pattern piece label"));
@ -825,10 +825,10 @@ void VToolSeamAllowance::SaveResizeDetail(qreal dLabelW, int iFontSize)
VPiece newDet = oldDet;
dLabelW = FromPixel(dLabelW, *VDataTool::data.GetPatternUnit());
newDet.GetPatternPieceData().SetLabelWidth(QString().setNum(dLabelW));
newDet.GetPieceLabelData().SetLabelWidth(QString().setNum(dLabelW));
const qreal height = FromPixel(m_dataLabel->boundingRect().height(), *VDataTool::data.GetPatternUnit());
newDet.GetPatternPieceData().SetLabelHeight(QString().setNum(height));
newDet.GetPatternPieceData().SetFontSize(iFontSize);
newDet.GetPieceLabelData().SetLabelHeight(QString().setNum(height));
newDet.GetPieceLabelData().SetFontSize(iFontSize);
SavePieceOptions* resizeCommand = new SavePieceOptions(oldDet, newDet, doc, m_id);
resizeCommand->setText(tr("resize pattern piece label"));
@ -843,13 +843,13 @@ void VToolSeamAllowance::SaveRotationDetail(qreal dRot)
{
VPiece oldDet = VAbstractTool::data.GetPiece(m_id);
VPiece newDet = oldDet;
newDet.GetPatternPieceData().SetPos(m_dataLabel->pos());
newDet.GetPatternPieceData().SetFontSize(m_dataLabel->GetFontSize());
newDet.GetPieceLabelData().SetPos(m_dataLabel->pos());
newDet.GetPieceLabelData().SetFontSize(m_dataLabel->GetFontSize());
// Tranform angle to anticlockwise
QLineF line(0, 0, 100, 0);
line.setAngle(-dRot);
newDet.GetPatternPieceData().SetRotation(QString().setNum(line.angle()));
newDet.GetPieceLabelData().SetRotation(QString().setNum(line.angle()));
SavePieceOptions* rotateCommand = new SavePieceOptions(oldDet, newDet, doc, m_id);
rotateCommand->setText(tr("rotate pattern piece label"));
@ -865,7 +865,7 @@ void VToolSeamAllowance::SaveMovePattern(const QPointF &ptPos)
{
VPiece oldDet = VAbstractTool::data.GetPiece(m_id);
VPiece newDet = oldDet;
newDet.GetPatternInfo().SetPos(ptPos);
newDet.GetPatternLabelData().SetPos(ptPos);
SavePieceOptions* moveCommand = new SavePieceOptions(oldDet, newDet, doc, m_id);
moveCommand->setText(tr("move pattern info label"));
@ -882,10 +882,10 @@ void VToolSeamAllowance::SaveResizePattern(qreal dLabelW, int iFontSize)
VPiece newDet = oldDet;
dLabelW = FromPixel(dLabelW, *VDataTool::data.GetPatternUnit());
newDet.GetPatternInfo().SetLabelWidth(QString().setNum(dLabelW));
newDet.GetPatternLabelData().SetLabelWidth(QString().setNum(dLabelW));
qreal height = FromPixel(m_patternInfo->boundingRect().height(), *VDataTool::data.GetPatternUnit());
newDet.GetPatternInfo().SetLabelHeight(QString().setNum(height));
newDet.GetPatternInfo().SetFontSize(iFontSize);
newDet.GetPatternLabelData().SetLabelHeight(QString().setNum(height));
newDet.GetPatternLabelData().SetFontSize(iFontSize);
SavePieceOptions* resizeCommand = new SavePieceOptions(oldDet, newDet, doc, m_id);
resizeCommand->setText(tr("resize pattern info label"));
@ -898,13 +898,13 @@ void VToolSeamAllowance::SaveRotationPattern(qreal dRot)
VPiece oldDet = VAbstractTool::data.GetPiece(m_id);
VPiece newDet = oldDet;
newDet.GetPatternInfo().SetPos(m_patternInfo->pos());
newDet.GetPatternInfo().SetFontSize(m_patternInfo->GetFontSize());
newDet.GetPatternLabelData().SetPos(m_patternInfo->pos());
newDet.GetPatternLabelData().SetFontSize(m_patternInfo->GetFontSize());
// Tranform angle to anticlockwise
QLineF line(0, 0, 100, 0);
line.setAngle(-dRot);
newDet.GetPatternInfo().SetRotation(QString().setNum(line.angle()));
newDet.GetPatternLabelData().SetRotation(QString().setNum(line.angle()));
SavePieceOptions* rotateCommand = new SavePieceOptions(oldDet, newDet, doc, m_id);
rotateCommand->setText(tr("rotate pattern info label"));