Refactoring.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-05-08 15:17:34 +03:00
parent db8ef33d79
commit 4192af8117
5 changed files with 42 additions and 100 deletions

View File

@ -41,17 +41,6 @@ class VPlaceLabelItemData : public QSharedData
{ {
public: public:
VPlaceLabelItemData() VPlaceLabelItemData()
: width(),
height(),
angle('0'),
visibilityTrigger('1'),
type(PlaceLabelType::Button),
centerPoint(0),
wValue(0),
hValue(0),
aValue(0),
correctionAngle(0),
isVisible(1)
{} {}
VPlaceLabelItemData(const VPlaceLabelItemData &item) VPlaceLabelItemData(const VPlaceLabelItemData &item)
@ -71,18 +60,18 @@ public:
virtual ~VPlaceLabelItemData(); virtual ~VPlaceLabelItemData();
QString width; QString width{};
QString height; QString height{};
QString angle; QString angle{'0'};
QString visibilityTrigger; QString visibilityTrigger{'1'};
PlaceLabelType type; PlaceLabelType type{PlaceLabelType::Button};
quint32 centerPoint; quint32 centerPoint{0};
qreal wValue; qreal wValue{0};
qreal hValue; qreal hValue{0};
qreal aValue; qreal aValue{0};
qreal correctionAngle; qreal correctionAngle{0};
qreal isVisible; qreal isVisible{1};
private: private:
VPlaceLabelItemData &operator=(const VPlaceLabelItemData &) Q_DECL_EQ_DELETE; VPlaceLabelItemData &operator=(const VPlaceLabelItemData &) Q_DECL_EQ_DELETE;

View File

@ -43,35 +43,12 @@ class VPieceNodeData : public QSharedData
{ {
public: public:
VPieceNodeData() VPieceNodeData()
: m_id(NULL_ID),
m_typeTool(Tool::NodePoint),
m_reverse(false),
m_excluded(false),
m_isPassmark(false),
m_isMainPathNode(true),
m_formulaWidthBefore(currentSeamAllowance),
m_formulaWidthAfter(currentSeamAllowance),
m_angleType(PieceNodeAngle::ByLength),
m_passmarkLineType(PassmarkLineType::OneLine),
m_passmarkAngleType(PassmarkAngleType::Straightforward),
m_isShowSecondPassmark(true),
m_checkUniqueness(true)
{} {}
VPieceNodeData(quint32 id, Tool typeTool, bool reverse) VPieceNodeData(quint32 id, Tool typeTool, bool reverse)
: m_id(id), : m_id(id),
m_typeTool(typeTool), m_typeTool(typeTool),
m_reverse(reverse), m_reverse(reverse)
m_excluded(false),
m_isPassmark(false),
m_isMainPathNode(true),
m_formulaWidthBefore(currentSeamAllowance),
m_formulaWidthAfter(currentSeamAllowance),
m_angleType(PieceNodeAngle::ByLength),
m_passmarkLineType(PassmarkLineType::OneLine),
m_passmarkAngleType(PassmarkAngleType::Straightforward),
m_isShowSecondPassmark(true),
m_checkUniqueness(true)
{ {
if (m_typeTool == Tool::NodePoint) if (m_typeTool == Tool::NodePoint)
{ {
@ -104,39 +81,39 @@ public:
friend QDataStream& operator>>(QDataStream& in, VPieceNodeData& p); friend QDataStream& operator>>(QDataStream& in, VPieceNodeData& p);
/** @brief id object id. */ /** @brief id object id. */
quint32 m_id; quint32 m_id{NULL_ID};
/** @brief typeTool type of tool */ /** @brief typeTool type of tool */
Tool m_typeTool; Tool m_typeTool{Tool::NodePoint};
/** @brief reverse true if need reverse points list for node. */ /** @brief reverse true if need reverse points list for node. */
bool m_reverse; bool m_reverse{false};
/** @brief m_excluded true if item excluded from main path. Excluded item is not visible and also will not has /** @brief m_excluded true if item excluded from main path. Excluded item is not visible and also will not has
* affect on main path. Also include to exist path items automatically setted excluded. */ * affect on main path. Also include to exist path items automatically setted excluded. */
bool m_excluded; bool m_excluded{false};
/** @brief m_isPassmark has sense only for points. If true to seam allowance should be added a passmark. */ /** @brief m_isPassmark has sense only for points. If true to seam allowance should be added a passmark. */
bool m_isPassmark; bool m_isPassmark{false};
/** @brief m_isMainPathNode need fin know if allowed for this passmakr to be double. */ /** @brief m_isMainPathNode need fin know if allowed for this passmakr to be double. */
bool m_isMainPathNode; bool m_isMainPathNode{true};
QString m_formulaWidthBefore; QString m_formulaWidthBefore{currentSeamAllowance};
QString m_formulaWidthAfter; QString m_formulaWidthAfter{currentSeamAllowance};
QString m_formulaPassmarkLength{}; QString m_formulaPassmarkLength{};
PieceNodeAngle m_angleType; PieceNodeAngle m_angleType{PieceNodeAngle::ByLength};
PassmarkLineType m_passmarkLineType; PassmarkLineType m_passmarkLineType{PassmarkLineType::OneLine};
PassmarkAngleType m_passmarkAngleType; PassmarkAngleType m_passmarkAngleType{PassmarkAngleType::Straightforward};
bool m_isShowSecondPassmark; bool m_isShowSecondPassmark{true};
/** @brief m_checkUniqueness need in cases where different points have the same coordinates, become one point. /** @brief m_checkUniqueness need in cases where different points have the same coordinates, become one point.
* By default the check enabled. Disable it only if in a path cannot be used just one point. For example if * By default the check enabled. Disable it only if in a path cannot be used just one point. For example if
* gradation change a piece shape and the seond point should be remaind.*/ * gradation change a piece shape and the seond point should be remaind.*/
bool m_checkUniqueness; bool m_checkUniqueness{true};
bool m_manualPassmarkLength{false}; bool m_manualPassmarkLength{false};

View File

@ -43,25 +43,10 @@ class VPiecePathData : public QSharedData
{ {
public: public:
VPiecePathData() VPiecePathData()
: m_nodes(),
m_type(PiecePathType::Unknown),
m_name(),
m_penType(Qt::SolidLine),
m_cut(false),
m_visibilityTrigger('1'),
m_firstToCuttingCountour(false),
m_lastToCuttingCountour(false)
{} {}
explicit VPiecePathData(PiecePathType type) explicit VPiecePathData(PiecePathType type)
: m_nodes(), : m_type(type)
m_type(type),
m_name(),
m_penType(Qt::SolidLine),
m_cut(false),
m_visibilityTrigger('1'),
m_firstToCuttingCountour(false),
m_lastToCuttingCountour(false)
{} {}
VPiecePathData(const VPiecePathData &path) VPiecePathData(const VPiecePathData &path)
@ -78,14 +63,14 @@ public:
~VPiecePathData(); ~VPiecePathData();
QVector<VPieceNode> m_nodes; QVector<VPieceNode> m_nodes{};
PiecePathType m_type; PiecePathType m_type{PiecePathType::Unknown};
QString m_name; QString m_name{};
Qt::PenStyle m_penType; Qt::PenStyle m_penType{Qt::SolidLine};
bool m_cut; bool m_cut{false};
QString m_visibilityTrigger; QString m_visibilityTrigger{'1'};
bool m_firstToCuttingCountour; bool m_firstToCuttingCountour{false};
bool m_lastToCuttingCountour; bool m_lastToCuttingCountour{false};
private: private:
VPiecePathData &operator=(const VPiecePathData &) Q_DECL_EQ_DELETE; VPiecePathData &operator=(const VPiecePathData &) Q_DECL_EQ_DELETE;

View File

@ -38,21 +38,14 @@ class DialogTool;
struct VToolPlaceLabelInitData : VAbstractNodeInitData struct VToolPlaceLabelInitData : VAbstractNodeInitData
{ {
VToolPlaceLabelInitData() VToolPlaceLabelInitData()
: VAbstractNodeInitData(),
width('0'),
height('0'),
angle('0'),
type(PlaceLabelType::Button),
centerPoint(NULL_ID),
visibilityTrigger('1')
{} {}
QString width; QString width{'0'};
QString height; QString height{'0'};
QString angle; QString angle{'0'};
PlaceLabelType type; PlaceLabelType type{PlaceLabelType::Button};
quint32 centerPoint; quint32 centerPoint{NULL_ID};
QString visibilityTrigger; QString visibilityTrigger{'1'};
}; };
class VToolPlaceLabel : public VAbstractNode class VToolPlaceLabel : public VAbstractNode

View File

@ -44,16 +44,14 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VScenePoint::VScenePoint(QGraphicsItem *parent) VScenePoint::VScenePoint(QGraphicsItem *parent)
: QGraphicsEllipseItem(parent), : QGraphicsEllipseItem(parent),
m_namePoint(nullptr), m_namePoint(new VGraphicsSimpleTextItem(this)),
m_lineName(nullptr), m_lineName(new VScaledLine(this)),
m_onlyPoint(false), m_onlyPoint(false),
m_isHovered(false), m_isHovered(false),
m_showLabel(true), m_showLabel(true),
m_baseColor(Qt::black), m_baseColor(Qt::black),
m_selectedFromChild(false) m_selectedFromChild(false)
{ {
m_namePoint = new VGraphicsSimpleTextItem(this);
m_lineName = new VScaledLine(this);
m_lineName->SetBoldLine(false); m_lineName->SetBoldLine(false);
m_lineName->setLine(QLineF(0, 0, 1, 0)); m_lineName->setLine(QLineF(0, 0, 1, 0));
m_lineName->setVisible(false); m_lineName->setVisible(false);