1 /************************************************************************
2  **
3  **  @file   vnodedetail.h
4  **  @author Roman Telezhynskyi <dismine(at)gmail.com>
5  **  @date   November 15, 2013
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) 2013-2015 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 VNODEDETAIL_H
30 #define VNODEDETAIL_H
31 
32 #include <QMetaType>
33 #include <QSharedDataPointer>
34 #include <QTypeInfo>
35 #include <QtGlobal>
36 
37 #include "../vmisc/def.h"
38 
39 class VNodeDetailData;
40 class VPieceNode;
41 class VContainer;
42 
43 /**
44  * @brief The VNodeDetail class keep information about detail node.
45  */
46 class VNodeDetail
47 {
48 public:
49     /**
50      * @brief VNodeDetail default constructor.
51      */
52     VNodeDetail();
53     /**
54      * @brief VNodeDetail constructor.
55      * @param id object id
56      * @param typeTool type tool
57      * @param typeNode type node
58      * @param mx object bias x axis
59      * @param my object bias y axis
60      */
61     VNodeDetail(quint32 id, Tool typeTool, NodeDetail typeNode, qreal mx = 0, qreal my = 0, bool reverse = false);
62     /**
63      * @brief VNodeDetail copy constructor
64      * @param node node
65      */
66     VNodeDetail(const VNodeDetail &node);
67 
68     ~VNodeDetail();
69 
70     /**
71      * @brief operator = assignment operator
72      * @param node node
73      * @return node
74      */
75     VNodeDetail &operator=(const VNodeDetail &node);
76 #ifdef Q_COMPILER_RVALUE_REFS
77     VNodeDetail(const VNodeDetail &&node) Q_DECL_NOTHROW;
78     VNodeDetail &operator=(VNodeDetail &&node) Q_DECL_NOTHROW;
79 #endif
80 
81     /**
82      * @brief getId return object id.
83      * @return id.
84      */
85     quint32     getId() const;
86     /**
87      * @brief setId set object id.
88      * @param value object id.
89      */
90     void        setId(const quint32 &value);
91     /**
92      * @brief getTypeTool return tool type.
93      * @return tool type.
94      */
95     Tool getTypeTool() const;
96     /**
97      * @brief setTypeTool set tool type.
98      * @param value tool type.
99      */
100     void        setTypeTool(const Tool &value);
101     /**
102      * @brief getTypeNode return node type.
103      * @return node type.
104      */
105     NodeDetail getTypeNode() const;
106     /**
107      * @brief setTypeNode set node type.
108      * @param value node type.
109      */
110     void        setTypeNode(const NodeDetail &value);
111     /**
112      * @brief getMx return object bias x axis.
113      * @return bias x axis.
114      */
115     qreal       getMx() const;
116     /**
117      * @brief setMx set object bias x axis.
118      * @param value bias x axis.
119      */
120     void        setMx(const qreal &value);
121     /**
122      * @brief getMy return object bias y axis.
123      * @return bias y axis.
124      */
125     qreal       getMy() const;
126     /**
127      * @brief setMy set object bias y axis.
128      * @param value bias y axis.
129      */
130     void        setMy(const qreal &value);
131 
132     bool        getReverse() const;
133     void        setReverse(bool reverse);
134 
135     static QVector<VPieceNode> Convert(const VContainer *data, const QVector<VNodeDetail> &nodes, qreal width,
136                                        bool closed);
137 private:
138     QSharedDataPointer<VNodeDetailData> d;
139 };
140 
141 Q_DECLARE_METATYPE(VNodeDetail)
142 Q_DECLARE_TYPEINFO(VNodeDetail, Q_MOVABLE_TYPE);
143 
144 #endif // VNODEDETAIL_H
145