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:
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)
@ -71,18 +60,18 @@ public:
virtual ~VPlaceLabelItemData();
QString width;
QString height;
QString angle;
QString visibilityTrigger;
PlaceLabelType type;
quint32 centerPoint;
QString width{};
QString height{};
QString angle{'0'};
QString visibilityTrigger{'1'};
PlaceLabelType type{PlaceLabelType::Button};
quint32 centerPoint{0};
qreal wValue;
qreal hValue;
qreal aValue;
qreal correctionAngle;
qreal isVisible;
qreal wValue{0};
qreal hValue{0};
qreal aValue{0};
qreal correctionAngle{0};
qreal isVisible{1};
private:
VPlaceLabelItemData &operator=(const VPlaceLabelItemData &) Q_DECL_EQ_DELETE;

View File

@ -43,35 +43,12 @@ class VPieceNodeData : public QSharedData
{
public:
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)
: m_id(id),
m_typeTool(typeTool),
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)
m_reverse(reverse)
{
if (m_typeTool == Tool::NodePoint)
{
@ -104,39 +81,39 @@ public:
friend QDataStream& operator>>(QDataStream& in, VPieceNodeData& p);
/** @brief id object id. */
quint32 m_id;
quint32 m_id{NULL_ID};
/** @brief typeTool type of tool */
Tool m_typeTool;
Tool m_typeTool{Tool::NodePoint};
/** @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
* 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. */
bool m_isPassmark;
bool m_isPassmark{false};
/** @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_formulaWidthAfter;
QString m_formulaWidthBefore{currentSeamAllowance};
QString m_formulaWidthAfter{currentSeamAllowance};
QString m_formulaPassmarkLength{};
PieceNodeAngle m_angleType;
PieceNodeAngle m_angleType{PieceNodeAngle::ByLength};
PassmarkLineType m_passmarkLineType;
PassmarkAngleType m_passmarkAngleType;
PassmarkLineType m_passmarkLineType{PassmarkLineType::OneLine};
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.
* 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.*/
bool m_checkUniqueness;
bool m_checkUniqueness{true};
bool m_manualPassmarkLength{false};

View File

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

View File

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

View File

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