1 /************************************************************************
2  **
3  **  @file   VAbstractArcData.h
4  **  @author Roman Telezhynskyi <dismine(at)gmail.com>
5  **  @date   10 4, 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 VABSTRACTARC_P_H
30 #define VABSTRACTARC_P_H
31 
32 #include <QSharedData>
33 #include "vgeometrydef.h"
34 #include "../vmisc/vabstractapplication.h"
35 #include "../vmisc/diagnostic.h"
36 #include "vpointf.h"
37 
38 QT_WARNING_PUSH
39 QT_WARNING_DISABLE_GCC("-Weffc++")
40 QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
41 
42 class VAbstractArcData : public QSharedData
43 {
44 public:
45     VAbstractArcData();
46     VAbstractArcData(const VPointF &center, qreal f1, const QString &formulaF1, qreal f2, const QString &formulaF2);
47     VAbstractArcData(const QString &formulaLength, const VPointF &center, qreal f1, const QString &formulaF1);
48     VAbstractArcData(const VPointF &center, qreal f1);
49     VAbstractArcData(const VPointF &center, qreal f1, qreal f2);
50     VAbstractArcData(const VAbstractArcData &arc);
51     virtual ~VAbstractArcData();
52 
53     /** @brief f1 start angle in degree. */
54     qreal   f1;
55 
56     /** @brief formulaF1 formula for start angle. */
57     QString formulaF1;
58 
59     /** @brief f2 end angle in degree. */
60     qreal   f2;
61 
62     /** @brief formulaF2 formula for end angle. */
63     QString formulaF2;
64 
65     /** @brief center center point of arc. */
66     VPointF center;
67 
68     bool    isFlipped;
69 
70     QString formulaLength;
71 
72 private:
73     Q_DISABLE_ASSIGN(VAbstractArcData)
74 };
75 
76 //---------------------------------------------------------------------------------------------------------------------
VAbstractArcData()77 VAbstractArcData::VAbstractArcData()
78     : f1(0),
79       formulaF1(),
80       f2(0),
81       formulaF2(),
82       center(),
83       isFlipped(false),
84       formulaLength()
85 {}
86 
87 //---------------------------------------------------------------------------------------------------------------------
VAbstractArcData(const VPointF & center,qreal f1,const QString & formulaF1,qreal f2,const QString & formulaF2)88 VAbstractArcData::VAbstractArcData(const VPointF &center, qreal f1, const QString &formulaF1, qreal f2,
89                                    const QString &formulaF2)
90     : f1(f1),
91       formulaF1(formulaF1),
92       f2(f2),
93       formulaF2(formulaF2),
94       center(center),
95       isFlipped(false),
96       formulaLength()
97 {}
98 
99 //---------------------------------------------------------------------------------------------------------------------
VAbstractArcData(const QString & formulaLength,const VPointF & center,qreal f1,const QString & formulaF1)100 VAbstractArcData::VAbstractArcData(const QString &formulaLength, const VPointF &center, qreal f1,
101                                    const QString &formulaF1)
102     : f1(f1),
103       formulaF1(formulaF1),
104       f2(0),
105       formulaF2('0'),
106       center(center),
107       isFlipped(false),
108       formulaLength(formulaLength)
109 {}
110 
111 //---------------------------------------------------------------------------------------------------------------------
VAbstractArcData(const VPointF & center,qreal f1)112 VAbstractArcData::VAbstractArcData(const VPointF &center, qreal f1)
113     : f1(f1),
114       formulaF1(QString().number(f1)),
115       f2(0),
116       formulaF2('0'),
117       center(center),
118       isFlipped(false),
119       formulaLength()
120 {}
121 
122 //---------------------------------------------------------------------------------------------------------------------
VAbstractArcData(const VPointF & center,qreal f1,qreal f2)123 VAbstractArcData::VAbstractArcData(const VPointF &center, qreal f1, qreal f2)
124     : f1(f1),
125       formulaF1(QString().number(f1)),
126       f2(f2),
127       formulaF2(QString().number(f2)),
128       center(center),
129       isFlipped(false),
130       formulaLength()
131 {}
132 
133 //---------------------------------------------------------------------------------------------------------------------
VAbstractArcData(const VAbstractArcData & arc)134 VAbstractArcData::VAbstractArcData(const VAbstractArcData &arc)
135     : QSharedData(arc),
136       f1(arc.f1),
137       formulaF1(arc.formulaF1),
138       f2(arc.f2),
139       formulaF2(arc.formulaF2),
140       center(arc.center),
141       isFlipped(arc.isFlipped),
142       formulaLength(arc.formulaLength)
143 {}
144 
145 //---------------------------------------------------------------------------------------------------------------------
~VAbstractArcData()146 VAbstractArcData::~VAbstractArcData()
147 {}
148 
149 QT_WARNING_POP
150 
151 #endif // VABSTRACTARCDATA_H
152