Refactoring. Rename ArrowType enum class.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2020-01-07 13:54:23 +02:00
parent 21d6a85678
commit b3f236dbb5
13 changed files with 27 additions and 26 deletions

View File

@ -1100,7 +1100,7 @@ VGrainlineData VPattern::ParsePieceGrainline(const QDomElement &domElement, VGra
gGeometry.SetVisible(GetParametrBool(domElement, AttrVisible, falseStr));
gGeometry.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')),
GetParametrDouble(domElement, AttrMy, QChar('0'))));
gGeometry.SetArrowType(static_cast<ArrowType>(GetParametrUInt(domElement, AttrArrows, QChar('0'))));
gGeometry.SetArrowType(static_cast<GrainlineArrowDirection>(GetParametrUInt(domElement, AttrArrows, QChar('0'))));
const quint32 topPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrTopPin, NULL_ID_STR);
const quint32 bottomPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrBottomPin, NULL_ID_STR);

View File

@ -2004,7 +2004,7 @@ QVector<QPointF> VAbstractPiece::GrainlinePoints(const VGrainlineData &geom, con
QVector<QPointF> v;
v << pt1;
if (geom.GetArrowType() != ArrowType::atFront)
if (geom.GetArrowType() != GrainlineArrowDirection::atFront)
{
v << QPointF(pt1.x() + dArrowLen * qCos(rotation + dArrowAng),
pt1.y() - dArrowLen * qSin(rotation + dArrowAng));
@ -2015,7 +2015,7 @@ QVector<QPointF> VAbstractPiece::GrainlinePoints(const VGrainlineData &geom, con
v << pt2;
if (geom.GetArrowType() != ArrowType::atRear)
if (geom.GetArrowType() != GrainlineArrowDirection::atRear)
{
rotation += M_PI;

View File

@ -773,7 +773,7 @@ qreal VLayoutPiece::GrainlineAngle() const
}
//---------------------------------------------------------------------------------------------------------------------
ArrowType VLayoutPiece::GrainlineArrowType() const
GrainlineArrowDirection VLayoutPiece::GrainlineArrowType() const
{
return d->grainlineArrowType;
}

View File

@ -108,7 +108,7 @@ public:
QVector<QPointF> GetGrainline() const;
bool IsGrainlineEnabled() const;
qreal GrainlineAngle() const;
ArrowType GrainlineArrowType() const;
GrainlineArrowDirection GrainlineArrowType() const;
QTransform GetMatrix() const;
void SetMatrix(const QTransform &matrix);

View File

@ -117,7 +117,7 @@ public:
/** @brief grainlineInfo line */
QVector<QPointF> grainlinePoints{};
ArrowType grainlineArrowType{ArrowType::atFront};
GrainlineArrowDirection grainlineArrowType{GrainlineArrowDirection::atFront};
qreal grainlineAngle{0};
bool grainlineEnabled{false};

View File

@ -468,8 +468,8 @@ void VPosition::FollowGrainline()
const qreal angle = detailGrainline.angleTo(FabricGrainline());
if (m_data.detail.GrainlineArrowType() == ArrowType::atBoth ||
m_data.detail.GrainlineArrowType() == ArrowType::atFront)
if (m_data.detail.GrainlineArrowType() == GrainlineArrowDirection::atBoth ||
m_data.detail.GrainlineArrowType() == GrainlineArrowDirection::atFront)
{
RotateOnAngle(angle);
}
@ -479,8 +479,8 @@ void VPosition::FollowGrainline()
return;
}
if (m_data.detail.GrainlineArrowType() == ArrowType::atBoth ||
m_data.detail.GrainlineArrowType() == ArrowType::atRear)
if (m_data.detail.GrainlineArrowType() == GrainlineArrowDirection::atBoth ||
m_data.detail.GrainlineArrowType() == GrainlineArrowDirection::atRear)
{
RotateOnAngle(angle+180);
}

View File

@ -33,7 +33,7 @@
#include <QString>
// denotes the type of arrow for the grainline
enum class ArrowType : qint8
enum class GrainlineArrowDirection : qint8
{
atBoth,
atFront,

View File

@ -100,13 +100,13 @@ void VGrainlineData::SetRotation(const QString& qsRot)
}
//---------------------------------------------------------------------------------------------------------------------
ArrowType VGrainlineData::GetArrowType() const
GrainlineArrowDirection VGrainlineData::GetArrowType() const
{
return d->m_eArrowType;
}
//---------------------------------------------------------------------------------------------------------------------
void VGrainlineData::SetArrowType(ArrowType eAT)
void VGrainlineData::SetArrowType(GrainlineArrowDirection eAT)
{
d->m_eArrowType = eAT;
}

View File

@ -62,8 +62,8 @@ public:
QString GetRotation() const;
void SetRotation(const QString& qsRot);
ArrowType GetArrowType() const;
void SetArrowType(ArrowType eAT);
GrainlineArrowDirection GetArrowType() const;
void SetArrowType(GrainlineArrowDirection eAT);
quint32 CenterPin() const;
void SetCenterPin(quint32 centerPin);

View File

@ -48,7 +48,7 @@ public:
VGrainlineDataPrivate()
: m_qsLength(),
m_dRotation(),
m_eArrowType(ArrowType::atBoth),
m_eArrowType(GrainlineArrowDirection::atBoth),
m_centerPin(NULL_ID),
m_topPin(NULL_ID),
m_bottomPin(NULL_ID)
@ -71,7 +71,7 @@ public:
/** @brief m_dRotation formula to calculate the rotation of grainline in [degrees] */
QString m_dRotation;
/** @brief m_eArrowType type of arrow on the grainline */
ArrowType m_eArrowType;
GrainlineArrowDirection m_eArrowType;
/** @brief m_centerPin center pin id */
quint32 m_centerPin;
/** @brief m_topPin top pin id */

View File

@ -2506,7 +2506,8 @@ VPiece DialogSeamAllowance::CreatePiece() const
}
piece.GetGrainlineGeometry().SetVisible(uiTabGrainline->groupBoxGrainline->isChecked());
piece.GetGrainlineGeometry().SetArrowType(static_cast<ArrowType>(uiTabGrainline->comboBoxArrow->currentIndex()));
piece.GetGrainlineGeometry().SetArrowType(
static_cast<GrainlineArrowDirection>(uiTabGrainline->comboBoxArrow->currentIndex()));
if (not flagGPin)
{

View File

@ -68,7 +68,7 @@ VGrainlineItem::VGrainlineItem(QGraphicsItem* pParent)
m_ptFinish(),
m_ptCenter(),
m_dAngle(0),
m_eArrowType(ArrowType::atBoth),
m_eArrowType(GrainlineArrowDirection::atBoth),
m_penWidth(LINE_PEN_WIDTH)
{
setAcceptHoverEvents(true);
@ -116,12 +116,12 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption
m_dScale = GetScale();
qreal dArrLen = ARROW_LENGTH*m_dScale;
if (m_eArrowType != ArrowType::atRear)
if (m_eArrowType != GrainlineArrowDirection::atRear)
{
// first arrow
pP->drawPolygon(FirstArrow(dArrLen));
}
if (m_eArrowType != ArrowType::atFront)
if (m_eArrowType != GrainlineArrowDirection::atFront)
{
// second arrow
pP->drawPolygon(SecondArrow(dArrLen));
@ -181,7 +181,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption
* @param dRotation rotation of the grainline in [degrees]
* @param dLength length of the grainline in user's units
*/
void VGrainlineItem::UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, ArrowType eAT)
void VGrainlineItem::UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, GrainlineArrowDirection eAT)
{
m_dRotation = qDegreesToRadians(dRotation);
m_dLength = dLength;
@ -691,7 +691,7 @@ QPainterPath VGrainlineItem::MainShape() const
path.closeSubpath();
const qreal dArrLen = ARROW_LENGTH*GetScale();
if (m_eArrowType != ArrowType::atRear)
if (m_eArrowType != GrainlineArrowDirection::atRear)
{
// first arrow
QPainterPath polyPath;
@ -700,7 +700,7 @@ QPainterPath VGrainlineItem::MainShape() const
path.closeSubpath();
}
if (m_eArrowType != ArrowType::atFront)
if (m_eArrowType != GrainlineArrowDirection::atFront)
{
// second arrow
QPainterPath polyPath;

View File

@ -43,7 +43,7 @@ public:
virtual QPainterPath shape() const override;
virtual void paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption, QWidget* pWidget) override;
void UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, ArrowType eAT);
void UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, GrainlineArrowDirection eAT);
virtual int type() const override {return Type;}
enum { Type = UserType + static_cast<int>(Vis::GrainlineItem)};
@ -83,7 +83,7 @@ private:
QPointF m_ptFinish;
QPointF m_ptCenter;
qreal m_dAngle;
ArrowType m_eArrowType;
GrainlineArrowDirection m_eArrowType;
int m_penWidth;
qreal GetScale() const;