From a287913500fcaeb80987704751fa0d57c717207d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 23 Feb 2017 11:33:17 +0200 Subject: [PATCH] Refactoring. Rename class VGrainlineGeometry to VGrainlineData. --HG-- branch : feature --- src/app/valentina/mainwindowsnogui.cpp | 2 +- src/app/valentina/xml/vpattern.cpp | 6 ++--- src/libs/vlayout/vlayoutpiece.cpp | 8 +++--- src/libs/vlayout/vlayoutpiece.h | 2 +- src/libs/vlayout/vlayoutpiece_p.h | 4 +-- ...ainlinegeometry.cpp => vgrainlinedata.cpp} | 26 +++++++++---------- ...{vgrainlinegeometry.h => vgrainlinedata.h} | 9 ++++--- src/libs/vpatterndb/vpatterndb.pri | 8 +++--- src/libs/vpatterndb/vpiece.cpp | 4 +-- src/libs/vpatterndb/vpiece.h | 6 ++--- src/libs/vpatterndb/vpiece_p.h | 4 +-- .../dialogs/tools/dialogseamallowance.cpp | 2 +- .../dialogs/tools/dialogseamallowance.h | 4 +-- src/libs/vtools/tools/vtoolseamallowance.cpp | 4 +-- .../vtools/undocommands/savepieceoptions.cpp | 2 +- src/libs/vwidgets/vgrainlineitem.cpp | 8 +++--- src/libs/vwidgets/vgrainlineitem.h | 6 ++--- 17 files changed, 53 insertions(+), 52 deletions(-) rename src/libs/vpatterndb/{vgrainlinegeometry.cpp => vgrainlinedata.cpp} (82%) rename src/libs/vpatterndb/{vgrainlinegeometry.h => vgrainlinedata.h} (94%) diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 8f77f123d..a17821cbf 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -39,7 +39,7 @@ #include "../vlayout/vposter.h" #include "../vpatterndb/vpiecelabeldata.h" #include "../vpatterndb/vpatternlabeldata.h" -#include "../vpatterndb/vgrainlinegeometry.h" +#include "../vpatterndb/vgrainlinedata.h" #include "../vtools/tools/vabstracttool.h" #include diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 819c472cb..4d75d8627 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -53,7 +53,7 @@ #include "../vpatterndb/calculator.h" #include "../vpatterndb/vpiecelabeldata.h" #include "../vpatterndb/vpatternlabeldata.h" -#include "../vpatterndb/vgrainlinegeometry.h" +#include "../vpatterndb/vgrainlinedata.h" #include "../vpatterndb/vpiecepath.h" #include "../vpatterndb/vnodedetail.h" @@ -874,8 +874,8 @@ void VPattern::ParsePieceGrainline(const QDomElement &domElement, VPiece &detail detail.GetGrainlineGeometry().SetLength(qsLength); QString qsRot = GetParametrString(domElement, AttrRotation, "90"); detail.GetGrainlineGeometry().SetRotation(qsRot); - VGrainlineGeometry::ArrowType eAT = - VGrainlineGeometry::ArrowType(GetParametrUInt(domElement, AttrArrows, "0")); + VGrainlineData::ArrowType eAT = + VGrainlineData::ArrowType(GetParametrUInt(domElement, AttrArrows, "0")); detail.GetGrainlineGeometry().SetArrowType(eAT); } diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index a7e164caa..8728d049f 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -117,7 +117,7 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern VAbstractPattern* pDoc = qApp->getCurrentDocument(); det.SetPatternInfo(pDoc, geom, qApp->font(), pattern->size(), pattern->height()); } - const VGrainlineGeometry& grainlineGeom = piece.GetGrainlineGeometry(); + const VGrainlineData& grainlineGeom = piece.GetGrainlineGeometry(); if (grainlineGeom.IsVisible() == true) { det.SetGrainline(grainlineGeom, *pattern); @@ -230,7 +230,7 @@ void VLayoutPiece::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLa } //--------------------------------------------------------------------------------------------------------------------- -void VLayoutPiece::SetGrainline(const VGrainlineGeometry& geom, const VContainer& rPattern) +void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer& rPattern) { d->grainlineGeom = geom; qreal dAng; @@ -267,7 +267,7 @@ void VLayoutPiece::SetGrainline(const VGrainlineGeometry& geom, const VContainer v << pt1; - if (geom.GetArrowType() != VGrainlineGeometry::atRear) { + if (geom.GetArrowType() != VGrainlineData::atRear) { pt.setX(pt1.x() + dArrowLen * qCos(dAng + dArrowAng)); pt.setY(pt1.y() - dArrowLen * qSin(dAng + dArrowAng)); v << pt; @@ -280,7 +280,7 @@ void VLayoutPiece::SetGrainline(const VGrainlineGeometry& geom, const VContainer v << pt2; - if (geom.GetArrowType() != VGrainlineGeometry::atFront) + if (geom.GetArrowType() != VGrainlineData::atFront) { dAng += M_PI; diff --git a/src/libs/vlayout/vlayoutpiece.h b/src/libs/vlayout/vlayoutpiece.h index d96e0523f..dcb9eb9ee 100644 --- a/src/libs/vlayout/vlayoutpiece.h +++ b/src/libs/vlayout/vlayoutpiece.h @@ -78,7 +78,7 @@ public: void SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLabelData& geom, const QFont& font, qreal dSize, qreal dHeight); - void SetGrainline(const VGrainlineGeometry& geom, const VContainer& rPattern); + void SetGrainline(const VGrainlineData& geom, const VContainer& rPattern); QTransform GetMatrix() const; void SetMatrix(const QTransform &matrix); diff --git a/src/libs/vlayout/vlayoutpiece_p.h b/src/libs/vlayout/vlayoutpiece_p.h index 5997df368..d35e744f0 100644 --- a/src/libs/vlayout/vlayoutpiece_p.h +++ b/src/libs/vlayout/vlayoutpiece_p.h @@ -36,7 +36,7 @@ #include "../vpatterndb/vpiecelabeldata.h" #include "../vpatterndb/vpatternlabeldata.h" -#include "../vpatterndb/vgrainlinegeometry.h" +#include "../vpatterndb/vgrainlinedata.h" #include "../vmisc/diagnostic.h" #include "vlayoutpiecepath.h" @@ -120,7 +120,7 @@ public: /** @brief patternGeom pattern geometry */ VPatternLabelData patternGeom; /** @brief grainlineGeom grainline geometry */ - VGrainlineGeometry grainlineGeom; + VGrainlineData grainlineGeom; /** @brief m_tmDetail text manager for laying out detail info */ VTextManager m_tmDetail; /** @brief m_tmPattern text manager for laying out pattern info */ diff --git a/src/libs/vpatterndb/vgrainlinegeometry.cpp b/src/libs/vpatterndb/vgrainlinedata.cpp similarity index 82% rename from src/libs/vpatterndb/vgrainlinegeometry.cpp rename to src/libs/vpatterndb/vgrainlinedata.cpp index e1f3b6ccb..143270a53 100644 --- a/src/libs/vpatterndb/vgrainlinegeometry.cpp +++ b/src/libs/vpatterndb/vgrainlinedata.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** - ** @file vgrainlinegeometry.cpp + ** @file vgrainlinedata.cpp ** @author Bojan Kverh ** @date September 06, 2016 ** @@ -28,80 +28,80 @@ #include -#include "vgrainlinegeometry.h" +#include "vgrainlinedata.h" //--------------------------------------------------------------------------------------------------------------------- -VGrainlineGeometry::VGrainlineGeometry() +VGrainlineData::VGrainlineData() :m_ptPos(0, 0), m_qsLength(), m_qsRotation(), m_bVisible(false), m_eArrowType(atBoth) {} //--------------------------------------------------------------------------------------------------------------------- -QPointF VGrainlineGeometry::GetPos() const +QPointF VGrainlineData::GetPos() const { return m_ptPos; } //--------------------------------------------------------------------------------------------------------------------- -void VGrainlineGeometry::SetPos(const QPointF &ptPos) +void VGrainlineData::SetPos(const QPointF &ptPos) { m_ptPos = ptPos; } //--------------------------------------------------------------------------------------------------------------------- -QString VGrainlineGeometry::GetLength() const +QString VGrainlineData::GetLength() const { return m_qsLength; } //--------------------------------------------------------------------------------------------------------------------- -void VGrainlineGeometry::SetLength(const QString& qsLen) +void VGrainlineData::SetLength(const QString& qsLen) { m_qsLength = qsLen; } //--------------------------------------------------------------------------------------------------------------------- -QString VGrainlineGeometry::GetRotation() const +QString VGrainlineData::GetRotation() const { return m_qsRotation; } //--------------------------------------------------------------------------------------------------------------------- -void VGrainlineGeometry::SetRotation(const QString& qsRot) +void VGrainlineData::SetRotation(const QString& qsRot) { m_qsRotation = qsRot; } //--------------------------------------------------------------------------------------------------------------------- -bool VGrainlineGeometry::IsVisible() const +bool VGrainlineData::IsVisible() const { return m_bVisible; } //--------------------------------------------------------------------------------------------------------------------- -void VGrainlineGeometry::SetVisible(bool bVisible) +void VGrainlineData::SetVisible(bool bVisible) { m_bVisible = bVisible; } //--------------------------------------------------------------------------------------------------------------------- -VGrainlineGeometry::ArrowType VGrainlineGeometry::GetArrowType() const +VGrainlineData::ArrowType VGrainlineData::GetArrowType() const { return m_eArrowType; } //--------------------------------------------------------------------------------------------------------------------- -void VGrainlineGeometry::SetArrowType(ArrowType eAT) +void VGrainlineData::SetArrowType(ArrowType eAT) { m_eArrowType = eAT; } diff --git a/src/libs/vpatterndb/vgrainlinegeometry.h b/src/libs/vpatterndb/vgrainlinedata.h similarity index 94% rename from src/libs/vpatterndb/vgrainlinegeometry.h rename to src/libs/vpatterndb/vgrainlinedata.h index a220680f1..698a4bcb3 100644 --- a/src/libs/vpatterndb/vgrainlinegeometry.h +++ b/src/libs/vpatterndb/vgrainlinedata.h @@ -1,6 +1,6 @@ /************************************************************************ ** - ** @file vgrainlinegeometry.h + ** @file vgrainlinedata.h ** @author Bojan Kverh ** @date September 06, 2016 ** @@ -31,12 +31,13 @@ #include #include +#include /** - * @brief The VGrainlineGeometry class holds information about a grainline like + * @brief The VGrainlineData class holds information about a grainline like * position, size, rotation and visibility */ -class VGrainlineGeometry +class VGrainlineData { public: // denotes the type of arrow for the grainline @@ -47,7 +48,7 @@ public: atRear }; - VGrainlineGeometry(); + VGrainlineData(); // methods, which set and return values of different parameters QPointF GetPos() const; diff --git a/src/libs/vpatterndb/vpatterndb.pri b/src/libs/vpatterndb/vpatterndb.pri index 1075b6269..d3bf388cb 100644 --- a/src/libs/vpatterndb/vpatterndb.pri +++ b/src/libs/vpatterndb/vpatterndb.pri @@ -17,14 +17,14 @@ SOURCES += \ $$PWD/variables/vmeasurement.cpp \ $$PWD/variables/vvariable.cpp \ $$PWD/vformula.cpp \ - $$PWD/vgrainlinegeometry.cpp \ $$PWD/variables/vcurveclength.cpp \ $$PWD/variables/vellipticalarcradius.cpp \ $$PWD/vpiece.cpp \ $$PWD/vpiecenode.cpp \ $$PWD/vpiecepath.cpp \ $$PWD/vpiecelabeldata.cpp \ - $$PWD/vpatternlabeldata.cpp + $$PWD/vpatternlabeldata.cpp \ + $$PWD/vgrainlinedata.cpp win32-msvc*:SOURCES += $$PWD/stable.cpp @@ -55,7 +55,6 @@ HEADERS += \ $$PWD/variables/vvariable.h \ $$PWD/variables/vvariable_p.h \ $$PWD/vformula.h \ - $$PWD/vgrainlinegeometry.h \ $$PWD/variables/vcurveclength.h \ $$PWD/variables/vellipticalarcradius.h \ $$PWD/vpiece.h \ @@ -65,4 +64,5 @@ HEADERS += \ $$PWD/vpiecepath.h \ $$PWD/vpiecepath_p.h \ $$PWD/vpiecelabeldata.h \ - $$PWD/vpatternlabeldata.h + $$PWD/vpatternlabeldata.h \ + $$PWD/vgrainlinedata.h diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index 13abe5491..ef954c760 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -469,7 +469,7 @@ const VPatternLabelData &VPiece::GetPatternInfo() const * @brief VDetail::GetGrainlineGeometry full access to the grainline geometry object * @return reference to grainline geometry object */ -VGrainlineGeometry &VPiece::GetGrainlineGeometry() +VGrainlineData &VPiece::GetGrainlineGeometry() { return d->m_glGrainline; } @@ -479,7 +479,7 @@ VGrainlineGeometry &VPiece::GetGrainlineGeometry() * @brief VDetail::GetGrainlineGeometry returns the read-only reference to the grainline geometry object * @return reference to grainline geometry object */ -const VGrainlineGeometry &VPiece::GetGrainlineGeometry() const +const VGrainlineData &VPiece::GetGrainlineGeometry() const { return d->m_glGrainline; } diff --git a/src/libs/vpatterndb/vpiece.h b/src/libs/vpatterndb/vpiece.h index e20b1e644..31c7fe476 100644 --- a/src/libs/vpatterndb/vpiece.h +++ b/src/libs/vpatterndb/vpiece.h @@ -41,7 +41,7 @@ template class QSharedPointer; class VPiecePath; class VPatternLabelData; class VPieceLabelData; -class VGrainlineGeometry; +class VGrainlineData; class VContainer; class QPainterPath; class VPointF; @@ -105,8 +105,8 @@ public: VPatternLabelData& GetPatternInfo(); const VPatternLabelData& GetPatternInfo() const; - VGrainlineGeometry& GetGrainlineGeometry(); - const VGrainlineGeometry& GetGrainlineGeometry() const; + VGrainlineData& GetGrainlineGeometry(); + const VGrainlineData& GetGrainlineGeometry() const; private: QSharedDataPointer d; diff --git a/src/libs/vpatterndb/vpiece_p.h b/src/libs/vpatterndb/vpiece_p.h index 2d735ee42..229e3174b 100644 --- a/src/libs/vpatterndb/vpiece_p.h +++ b/src/libs/vpatterndb/vpiece_p.h @@ -38,7 +38,7 @@ #include "vpiecepath.h" #include "vpiecelabeldata.h" #include "vpatternlabeldata.h" -#include "vgrainlinegeometry.h" +#include "vgrainlinedata.h" QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Weffc++") @@ -99,7 +99,7 @@ public: VPatternLabelData m_piPatternInfo; /** @brief m_glGrainline grainline geometry object*/ - VGrainlineGeometry m_glGrainline; + VGrainlineData m_glGrainline; QString m_formulaWidth; diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index c4a62171a..2f860f7d1 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -1307,7 +1307,7 @@ VPiece DialogSeamAllowance::CreatePiece() const piece.GetGrainlineGeometry().SetVisible(ui->checkBoxGrainline->isChecked()); piece.GetGrainlineGeometry().SetRotation(GetFormulaFromUser(ui->lineEditRotFormula)); piece.GetGrainlineGeometry().SetLength(GetFormulaFromUser(ui->lineEditLenFormula)); - piece.GetGrainlineGeometry().SetArrowType(VGrainlineGeometry::ArrowType(ui->comboBoxArrow->currentIndex())); + piece.GetGrainlineGeometry().SetArrowType(VGrainlineData::ArrowType(ui->comboBoxArrow->currentIndex())); return piece; } diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/dialogseamallowance.h index 51b93374f..58d5f55b9 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.h @@ -33,7 +33,7 @@ #include "../vpatterndb/vpiece.h" #include "../vpatterndb/vpatternlabeldata.h" #include "../vpatterndb/vpiecelabeldata.h" -#include "../vpatterndb/vgrainlinegeometry.h" +#include "../vpatterndb/vgrainlinedata.h" namespace Ui { @@ -138,7 +138,7 @@ private: VPieceLabelData m_oldData; VPatternLabelData m_oldGeom; - VGrainlineGeometry m_oldGrainline; + VGrainlineData m_oldGrainline; int m_iRotBaseHeight; int m_iLenBaseHeight; int m_formulaBaseWidth; diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index fd52cb531..85a40b491 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -288,7 +288,7 @@ void VToolSeamAllowance::AddGrainline(VAbstractPattern *doc, QDomElement &domEle { // grainline QDomElement domData = doc->createElement(VAbstractPattern::TagGrainline); - const VGrainlineGeometry& glGeom = piece.GetGrainlineGeometry(); + const VGrainlineData& glGeom = piece.GetGrainlineGeometry(); doc->SetAttribute(domData, VAbstractPattern::AttrVisible, glGeom.IsVisible() == true ? trueStr : falseStr); doc->SetAttribute(domData, AttrMx, glGeom.GetPos().x()); doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y()); @@ -506,7 +506,7 @@ void VToolSeamAllowance::UpdatePatternInfo() void VToolSeamAllowance::UpdateGrainline() { const VPiece detail = VAbstractTool::data.GetPiece(id); - const VGrainlineGeometry& geom = detail.GetGrainlineGeometry(); + const VGrainlineData& geom = detail.GetGrainlineGeometry(); if (geom.IsVisible() == true) { diff --git a/src/libs/vtools/undocommands/savepieceoptions.cpp b/src/libs/vtools/undocommands/savepieceoptions.cpp index f4c059feb..9ac8a28f2 100644 --- a/src/libs/vtools/undocommands/savepieceoptions.cpp +++ b/src/libs/vtools/undocommands/savepieceoptions.cpp @@ -40,7 +40,7 @@ #include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/vpatternlabeldata.h" #include "../vpatterndb/vpiecelabeldata.h" -#include "../vpatterndb/vgrainlinegeometry.h" +#include "../vpatterndb/vgrainlinedata.h" #include "../tools/vtoolseamallowance.h" #include "vundocommand.h" diff --git a/src/libs/vwidgets/vgrainlineitem.cpp b/src/libs/vwidgets/vgrainlineitem.cpp index 954216651..c0c8f90d8 100644 --- a/src/libs/vwidgets/vgrainlineitem.cpp +++ b/src/libs/vwidgets/vgrainlineitem.cpp @@ -65,7 +65,7 @@ VGrainlineItem::VGrainlineItem(QGraphicsItem* pParent) m_ptFinish(), m_ptCenter(), m_dAngle(0), - m_eArrowType(VGrainlineGeometry::atBoth) + m_eArrowType(VGrainlineData::atBoth) { m_inactiveZ = 5; Reset(); @@ -107,7 +107,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption QPolygonF poly; QPointF ptA; qreal dArrLen = ARROW_LENGTH*m_dScale; - if (m_eArrowType != VGrainlineGeometry::atRear) + if (m_eArrowType != VGrainlineData::atRear) { // first arrow poly << pt1; @@ -119,7 +119,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption poly << ptA; pP->drawPolygon(poly); } - if (m_eArrowType != VGrainlineGeometry::atFront) + if (m_eArrowType != VGrainlineData::atFront) { // second arrow poly.clear(); @@ -188,7 +188,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption * @param dLength length of the grainline in user's units */ void VGrainlineItem::UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, - VGrainlineGeometry::ArrowType eAT) + VGrainlineData::ArrowType eAT) { m_dRotation = qDegreesToRadians(dRotation); m_dLength = dLength; diff --git a/src/libs/vwidgets/vgrainlineitem.h b/src/libs/vwidgets/vgrainlineitem.h index 613119033..8a0180fc6 100644 --- a/src/libs/vwidgets/vgrainlineitem.h +++ b/src/libs/vwidgets/vgrainlineitem.h @@ -30,7 +30,7 @@ #define VGRAINLINEITEM_H #include "vpieceitem.h" -#include "../vpatterndb/vgrainlinegeometry.h" +#include "../vpatterndb/vgrainlinedata.h" class VGrainlineItem : public VPieceItem { @@ -41,7 +41,7 @@ public: virtual void paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption, QWidget* pWidget) Q_DECL_OVERRIDE; void UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, - VGrainlineGeometry::ArrowType eAT); + VGrainlineData::ArrowType eAT); bool IsContained(const QPointF &pt, qreal dRot, qreal &dX, qreal &dY) const; void SetScale(qreal dScale); @@ -75,7 +75,7 @@ private: QPointF m_ptFinish; QPointF m_ptCenter; qreal m_dAngle; - VGrainlineGeometry::ArrowType m_eArrowType; + VGrainlineData::ArrowType m_eArrowType; }; #endif // VGRAINLINEITEM_H