1 /************************************************************************
2  **
3  **  @file
4  **  @author Roman Telezhynskyi <dismine(at)gmail.com>
5  **  @date   3 11, 2016
6  **
7  **  @brief
8  **  @copyright
9  **  This source code is part of the Valentina project, a pattern making
10  **  program, whose allow create and modeling patterns of clothing.
11  **  Copyright (C) 2016 Valentina project
12  **  <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
13  **
14  **  Valentina is free software: you can redistribute it and/or modify
15  **  it under the terms of the GNU General Public License as published by
16  **  the Free Software Foundation, either version 3 of the License, or
17  **  (at your option) any later version.
18  **
19  **  Valentina is distributed in the hope that it will be useful,
20  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  **  GNU General Public License for more details.
23  **
24  **  You should have received a copy of the GNU General Public License
25  **  along with Valentina.  If not, see <http://www.gnu.org/licenses/>.
26  **
27  *************************************************************************/
28 
29 #ifndef VPIECENODE_H
30 #define VPIECENODE_H
31 
32 #include <QtGlobal>
33 #include <QSharedDataPointer>
34 #include <QMetaType>
35 
36 #include "../vmisc/def.h"
37 
38 class VPieceNodeData;
39 class VContainer;
40 
41 class VPieceNode
42 {
43 public:
44     VPieceNode();
45     VPieceNode(quint32 id, Tool typeTool, bool reverse = false);
46     VPieceNode(const VPieceNode &node);
47 
48     ~VPieceNode();
49 
50     VPieceNode &operator=(const VPieceNode &node);
51 #ifdef Q_COMPILER_RVALUE_REFS
52     VPieceNode(const VPieceNode &&node) Q_DECL_NOTHROW;
53     VPieceNode &operator=(VPieceNode &&node) Q_DECL_NOTHROW;
54 #endif
55 
56     friend QDataStream& operator<<(QDataStream& out, const VPieceNode& p);
57     friend QDataStream& operator>>(QDataStream& in, VPieceNode& p);
58 
59     quint32 GetId() const;
60     void    SetId(quint32 id);
61 
62     Tool GetTypeTool() const;
63     void SetTypeTool(Tool value);
64 
65     bool GetReverse() const;
66     void SetReverse(bool reverse);
67 
68     bool IsExcluded() const;
69     void SetExcluded(bool exclude);
70 
71     qreal GetSABefore(const VContainer *data) const;
72     qreal GetSABefore(const VContainer *data, Unit unit) const;
73 
74     QString GetFormulaSABefore() const;
75     void    SetFormulaSABefore(const QString &formula);
76 
77     qreal GetSAAfter(const VContainer *data) const;
78     qreal GetSAAfter(const VContainer *data, Unit unit) const;
79 
80     QString GetFormulaSAAfter() const;
81     void    SetFormulaSAAfter(const QString &formula);
82 
83     QString GetFormulaPassmarkLength() const;
84     void    SetFormulaPassmarkLength(const QString &formula);
85 
86     qreal GetPassmarkLength(const VContainer *data, Unit unit) const;
87 
88     PieceNodeAngle GetAngleType() const;
89     void           SetAngleType(PieceNodeAngle type);
90 
91     bool IsPassmark() const;
92     void SetPassmark(bool passmark);
93 
94     bool IsMainPathNode() const;
95     void SetMainPathNode(bool value);
96 
97     PassmarkLineType GetPassmarkLineType() const;
98     void             SetPassmarkLineType(PassmarkLineType lineType);
99 
100     PassmarkAngleType GetPassmarkAngleType() const;
101     void              SetPassmarkAngleType(PassmarkAngleType angleType);
102 
103     bool IsShowSecondPassmark() const;
104     void SetShowSecondPassmark(bool value);
105 
106     bool IsCheckUniqueness() const;
107     void SetCheckUniqueness(bool value);
108 
109     bool IsManualPassmarkLength() const;
110     void SetManualPassmarkLength(bool value);
111 private:
112     QSharedDataPointer<VPieceNodeData> d;
113 };
114 
115 Q_DECLARE_METATYPE(VPieceNode)
116 Q_DECLARE_TYPEINFO(VPieceNode, Q_MOVABLE_TYPE);
117 
118 #endif // VPIECENODE_H
119