Refactoring. Rename class VGrainlineGeometry to VGrainlineData.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-02-23 11:33:17 +02:00
parent 4e3ee3eefd
commit a287913500
17 changed files with 53 additions and 52 deletions

View File

@ -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 <QFileDialog>

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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 */

View File

@ -1,6 +1,6 @@
/************************************************************************
**
** @file vgrainlinegeometry.cpp
** @file vgrainlinedata.cpp
** @author Bojan Kverh
** @date September 06, 2016
**
@ -28,80 +28,80 @@
#include <QPointF>
#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;
}

View File

@ -1,6 +1,6 @@
/************************************************************************
**
** @file vgrainlinegeometry.h
** @file vgrainlinedata.h
** @author Bojan Kverh
** @date September 06, 2016
**
@ -31,12 +31,13 @@
#include <QtGlobal>
#include <QString>
#include <QPointF>
/**
* @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;

View File

@ -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

View File

@ -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;
}

View File

@ -41,7 +41,7 @@ template <class T>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<VPieceData> d;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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)
{

View File

@ -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"

View File

@ -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;

View File

@ -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