Refactoring. Rename ArrowType enum class.
--HG-- branch : develop
This commit is contained in:
parent
21d6a85678
commit
b3f236dbb5
|
@ -1100,7 +1100,7 @@ VGrainlineData VPattern::ParsePieceGrainline(const QDomElement &domElement, VGra
|
||||||
gGeometry.SetVisible(GetParametrBool(domElement, AttrVisible, falseStr));
|
gGeometry.SetVisible(GetParametrBool(domElement, AttrVisible, falseStr));
|
||||||
gGeometry.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')),
|
gGeometry.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')),
|
||||||
GetParametrDouble(domElement, AttrMy, 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 topPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrTopPin, NULL_ID_STR);
|
||||||
const quint32 bottomPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrBottomPin, NULL_ID_STR);
|
const quint32 bottomPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrBottomPin, NULL_ID_STR);
|
||||||
|
|
|
@ -2004,7 +2004,7 @@ QVector<QPointF> VAbstractPiece::GrainlinePoints(const VGrainlineData &geom, con
|
||||||
QVector<QPointF> v;
|
QVector<QPointF> v;
|
||||||
v << pt1;
|
v << pt1;
|
||||||
|
|
||||||
if (geom.GetArrowType() != ArrowType::atFront)
|
if (geom.GetArrowType() != GrainlineArrowDirection::atFront)
|
||||||
{
|
{
|
||||||
v << QPointF(pt1.x() + dArrowLen * qCos(rotation + dArrowAng),
|
v << QPointF(pt1.x() + dArrowLen * qCos(rotation + dArrowAng),
|
||||||
pt1.y() - dArrowLen * qSin(rotation + dArrowAng));
|
pt1.y() - dArrowLen * qSin(rotation + dArrowAng));
|
||||||
|
@ -2015,7 +2015,7 @@ QVector<QPointF> VAbstractPiece::GrainlinePoints(const VGrainlineData &geom, con
|
||||||
|
|
||||||
v << pt2;
|
v << pt2;
|
||||||
|
|
||||||
if (geom.GetArrowType() != ArrowType::atRear)
|
if (geom.GetArrowType() != GrainlineArrowDirection::atRear)
|
||||||
{
|
{
|
||||||
rotation += M_PI;
|
rotation += M_PI;
|
||||||
|
|
||||||
|
|
|
@ -773,7 +773,7 @@ qreal VLayoutPiece::GrainlineAngle() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
ArrowType VLayoutPiece::GrainlineArrowType() const
|
GrainlineArrowDirection VLayoutPiece::GrainlineArrowType() const
|
||||||
{
|
{
|
||||||
return d->grainlineArrowType;
|
return d->grainlineArrowType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ public:
|
||||||
QVector<QPointF> GetGrainline() const;
|
QVector<QPointF> GetGrainline() const;
|
||||||
bool IsGrainlineEnabled() const;
|
bool IsGrainlineEnabled() const;
|
||||||
qreal GrainlineAngle() const;
|
qreal GrainlineAngle() const;
|
||||||
ArrowType GrainlineArrowType() const;
|
GrainlineArrowDirection GrainlineArrowType() const;
|
||||||
|
|
||||||
QTransform GetMatrix() const;
|
QTransform GetMatrix() const;
|
||||||
void SetMatrix(const QTransform &matrix);
|
void SetMatrix(const QTransform &matrix);
|
||||||
|
|
|
@ -117,7 +117,7 @@ public:
|
||||||
/** @brief grainlineInfo line */
|
/** @brief grainlineInfo line */
|
||||||
QVector<QPointF> grainlinePoints{};
|
QVector<QPointF> grainlinePoints{};
|
||||||
|
|
||||||
ArrowType grainlineArrowType{ArrowType::atFront};
|
GrainlineArrowDirection grainlineArrowType{GrainlineArrowDirection::atFront};
|
||||||
qreal grainlineAngle{0};
|
qreal grainlineAngle{0};
|
||||||
bool grainlineEnabled{false};
|
bool grainlineEnabled{false};
|
||||||
|
|
||||||
|
|
|
@ -468,8 +468,8 @@ void VPosition::FollowGrainline()
|
||||||
|
|
||||||
const qreal angle = detailGrainline.angleTo(FabricGrainline());
|
const qreal angle = detailGrainline.angleTo(FabricGrainline());
|
||||||
|
|
||||||
if (m_data.detail.GrainlineArrowType() == ArrowType::atBoth ||
|
if (m_data.detail.GrainlineArrowType() == GrainlineArrowDirection::atBoth ||
|
||||||
m_data.detail.GrainlineArrowType() == ArrowType::atFront)
|
m_data.detail.GrainlineArrowType() == GrainlineArrowDirection::atFront)
|
||||||
{
|
{
|
||||||
RotateOnAngle(angle);
|
RotateOnAngle(angle);
|
||||||
}
|
}
|
||||||
|
@ -479,8 +479,8 @@ void VPosition::FollowGrainline()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_data.detail.GrainlineArrowType() == ArrowType::atBoth ||
|
if (m_data.detail.GrainlineArrowType() == GrainlineArrowDirection::atBoth ||
|
||||||
m_data.detail.GrainlineArrowType() == ArrowType::atRear)
|
m_data.detail.GrainlineArrowType() == GrainlineArrowDirection::atRear)
|
||||||
{
|
{
|
||||||
RotateOnAngle(angle+180);
|
RotateOnAngle(angle+180);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
// denotes the type of arrow for the grainline
|
// denotes the type of arrow for the grainline
|
||||||
enum class ArrowType : qint8
|
enum class GrainlineArrowDirection : qint8
|
||||||
{
|
{
|
||||||
atBoth,
|
atBoth,
|
||||||
atFront,
|
atFront,
|
||||||
|
|
|
@ -100,13 +100,13 @@ void VGrainlineData::SetRotation(const QString& qsRot)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
ArrowType VGrainlineData::GetArrowType() const
|
GrainlineArrowDirection VGrainlineData::GetArrowType() const
|
||||||
{
|
{
|
||||||
return d->m_eArrowType;
|
return d->m_eArrowType;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VGrainlineData::SetArrowType(ArrowType eAT)
|
void VGrainlineData::SetArrowType(GrainlineArrowDirection eAT)
|
||||||
{
|
{
|
||||||
d->m_eArrowType = eAT;
|
d->m_eArrowType = eAT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,8 @@ public:
|
||||||
QString GetRotation() const;
|
QString GetRotation() const;
|
||||||
void SetRotation(const QString& qsRot);
|
void SetRotation(const QString& qsRot);
|
||||||
|
|
||||||
ArrowType GetArrowType() const;
|
GrainlineArrowDirection GetArrowType() const;
|
||||||
void SetArrowType(ArrowType eAT);
|
void SetArrowType(GrainlineArrowDirection eAT);
|
||||||
|
|
||||||
quint32 CenterPin() const;
|
quint32 CenterPin() const;
|
||||||
void SetCenterPin(quint32 centerPin);
|
void SetCenterPin(quint32 centerPin);
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
VGrainlineDataPrivate()
|
VGrainlineDataPrivate()
|
||||||
: m_qsLength(),
|
: m_qsLength(),
|
||||||
m_dRotation(),
|
m_dRotation(),
|
||||||
m_eArrowType(ArrowType::atBoth),
|
m_eArrowType(GrainlineArrowDirection::atBoth),
|
||||||
m_centerPin(NULL_ID),
|
m_centerPin(NULL_ID),
|
||||||
m_topPin(NULL_ID),
|
m_topPin(NULL_ID),
|
||||||
m_bottomPin(NULL_ID)
|
m_bottomPin(NULL_ID)
|
||||||
|
@ -71,7 +71,7 @@ public:
|
||||||
/** @brief m_dRotation formula to calculate the rotation of grainline in [degrees] */
|
/** @brief m_dRotation formula to calculate the rotation of grainline in [degrees] */
|
||||||
QString m_dRotation;
|
QString m_dRotation;
|
||||||
/** @brief m_eArrowType type of arrow on the grainline */
|
/** @brief m_eArrowType type of arrow on the grainline */
|
||||||
ArrowType m_eArrowType;
|
GrainlineArrowDirection m_eArrowType;
|
||||||
/** @brief m_centerPin center pin id */
|
/** @brief m_centerPin center pin id */
|
||||||
quint32 m_centerPin;
|
quint32 m_centerPin;
|
||||||
/** @brief m_topPin top pin id */
|
/** @brief m_topPin top pin id */
|
||||||
|
|
|
@ -2506,7 +2506,8 @@ VPiece DialogSeamAllowance::CreatePiece() const
|
||||||
}
|
}
|
||||||
|
|
||||||
piece.GetGrainlineGeometry().SetVisible(uiTabGrainline->groupBoxGrainline->isChecked());
|
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)
|
if (not flagGPin)
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,7 +68,7 @@ VGrainlineItem::VGrainlineItem(QGraphicsItem* pParent)
|
||||||
m_ptFinish(),
|
m_ptFinish(),
|
||||||
m_ptCenter(),
|
m_ptCenter(),
|
||||||
m_dAngle(0),
|
m_dAngle(0),
|
||||||
m_eArrowType(ArrowType::atBoth),
|
m_eArrowType(GrainlineArrowDirection::atBoth),
|
||||||
m_penWidth(LINE_PEN_WIDTH)
|
m_penWidth(LINE_PEN_WIDTH)
|
||||||
{
|
{
|
||||||
setAcceptHoverEvents(true);
|
setAcceptHoverEvents(true);
|
||||||
|
@ -116,12 +116,12 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption
|
||||||
|
|
||||||
m_dScale = GetScale();
|
m_dScale = GetScale();
|
||||||
qreal dArrLen = ARROW_LENGTH*m_dScale;
|
qreal dArrLen = ARROW_LENGTH*m_dScale;
|
||||||
if (m_eArrowType != ArrowType::atRear)
|
if (m_eArrowType != GrainlineArrowDirection::atRear)
|
||||||
{
|
{
|
||||||
// first arrow
|
// first arrow
|
||||||
pP->drawPolygon(FirstArrow(dArrLen));
|
pP->drawPolygon(FirstArrow(dArrLen));
|
||||||
}
|
}
|
||||||
if (m_eArrowType != ArrowType::atFront)
|
if (m_eArrowType != GrainlineArrowDirection::atFront)
|
||||||
{
|
{
|
||||||
// second arrow
|
// second arrow
|
||||||
pP->drawPolygon(SecondArrow(dArrLen));
|
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 dRotation rotation of the grainline in [degrees]
|
||||||
* @param dLength length of the grainline in user's units
|
* @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_dRotation = qDegreesToRadians(dRotation);
|
||||||
m_dLength = dLength;
|
m_dLength = dLength;
|
||||||
|
@ -691,7 +691,7 @@ QPainterPath VGrainlineItem::MainShape() const
|
||||||
path.closeSubpath();
|
path.closeSubpath();
|
||||||
|
|
||||||
const qreal dArrLen = ARROW_LENGTH*GetScale();
|
const qreal dArrLen = ARROW_LENGTH*GetScale();
|
||||||
if (m_eArrowType != ArrowType::atRear)
|
if (m_eArrowType != GrainlineArrowDirection::atRear)
|
||||||
{
|
{
|
||||||
// first arrow
|
// first arrow
|
||||||
QPainterPath polyPath;
|
QPainterPath polyPath;
|
||||||
|
@ -700,7 +700,7 @@ QPainterPath VGrainlineItem::MainShape() const
|
||||||
path.closeSubpath();
|
path.closeSubpath();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_eArrowType != ArrowType::atFront)
|
if (m_eArrowType != GrainlineArrowDirection::atFront)
|
||||||
{
|
{
|
||||||
// second arrow
|
// second arrow
|
||||||
QPainterPath polyPath;
|
QPainterPath polyPath;
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
virtual QPainterPath shape() const override;
|
virtual QPainterPath shape() const override;
|
||||||
|
|
||||||
virtual void paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption, QWidget* pWidget) 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;}
|
virtual int type() const override {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::GrainlineItem)};
|
enum { Type = UserType + static_cast<int>(Vis::GrainlineItem)};
|
||||||
|
@ -83,7 +83,7 @@ private:
|
||||||
QPointF m_ptFinish;
|
QPointF m_ptFinish;
|
||||||
QPointF m_ptCenter;
|
QPointF m_ptCenter;
|
||||||
qreal m_dAngle;
|
qreal m_dAngle;
|
||||||
ArrowType m_eArrowType;
|
GrainlineArrowDirection m_eArrowType;
|
||||||
int m_penWidth;
|
int m_penWidth;
|
||||||
|
|
||||||
qreal GetScale() const;
|
qreal GetScale() const;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user