Seamly2D
Code documentation
vabstractarc.h
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * Copyright (C) 2017 Seamly, LLC *
4  * *
5  * https://github.com/fashionfreedom/seamly2d *
6  * *
7  ***************************************************************************
8  **
9  ** Seamly2D is free software: you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation, either version 3 of the License, or
12  ** (at your option) any later version.
13  **
14  ** Seamly2D is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** You should have received a copy of the GNU General Public License
20  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
21  **
22  **************************************************************************
23 
24  ************************************************************************
25  **
26  ** @file vabstractarc.h
27  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
28  ** @date 10 4, 2016
29  **
30  ** @brief
31  ** @copyright
32  ** This source code is part of the Valentine project, a pattern making
33  ** program, whose allow create and modeling patterns of clothing.
34  ** Copyright (C) 2016 Seamly2D project
35  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
36  **
37  ** Seamly2D is free software: you can redistribute it and/or modify
38  ** it under the terms of the GNU General Public License as published by
39  ** the Free Software Foundation, either version 3 of the License, or
40  ** (at your option) any later version.
41  **
42  ** Seamly2D is distributed in the hope that it will be useful,
43  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
44  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45  ** GNU General Public License for more details.
46  **
47  ** You should have received a copy of the GNU General Public License
48  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
49  **
50  *************************************************************************/
51 
52 #ifndef VABSTRACTARC_H
53 #define VABSTRACTARC_H
54 
55 #include <qcompilerdetection.h>
56 #include <QSharedDataPointer>
57 #include <QString>
58 #include <QtGlobal>
59 
60 #include "../ifc/ifcdef.h"
61 #include "vabstractcurve.h"
62 #include "vgeometrydef.h"
63 
64 class VAbstractArcData;
65 class VPointF;
66 
68 {
69 public:
70  explicit VAbstractArc(const GOType &type, const quint32 &idObject = NULL_ID,
71  const Draw &mode = Draw::Calculation);
72 
73  VAbstractArc (const GOType &type, const VPointF &center, qreal f1, const QString &formulaF1,
74  qreal f2, const QString &formulaF2, quint32 idObject = 0,
75  Draw mode = Draw::Calculation);
76 
77  VAbstractArc (const GOType &type, const VPointF &center, qreal f1, qreal f2, quint32 idObject = 0,
78  Draw mode = Draw::Calculation);
79 
80  VAbstractArc (const GOType &type, const QString &formulaLength, const VPointF &center, qreal f1,
81  const QString &formulaF1, quint32 idObject = 0, Draw mode = Draw::Calculation);
82 
83  VAbstractArc (const GOType &type, const VPointF &center, qreal f1, quint32 idObject = 0,
84  Draw mode = Draw::Calculation);
85 
86  explicit VAbstractArc(const VAbstractArc &arc);
87  virtual ~VAbstractArc();
88 
90 #ifdef Q_COMPILER_RVALUE_REFS
91  VAbstractArc &operator=(VAbstractArc &&arc) Q_DECL_NOTHROW ;
92 #endif
93 
94  void Swap(VAbstractArc &arc) Q_DECL_NOTHROW;
95 
96  QString GetFormulaF1 () const;
97  void SetFormulaF1 (const QString &formula, qreal value);
98  virtual qreal GetStartAngle () const Q_DECL_OVERRIDE;
99 
100  QString GetFormulaF2 () const;
101  void SetFormulaF2 (const QString &formula, qreal value);
102  virtual qreal GetEndAngle () const Q_DECL_OVERRIDE;
103 
104  virtual VPointF GetCenter () const;
105  void SetCenter (const VPointF &point);
106 
107  QString GetFormulaLength () const;
108  void SetFormulaLength (const QString &formula, qreal value);
109 
110  virtual void setId(const quint32 &id) Q_DECL_OVERRIDE;
111  virtual QString NameForHistory(const QString &toolName) const Q_DECL_OVERRIDE;
112 
113  bool IsFlipped() const;
114  qreal AngleArc() const;
115 
116 protected:
117  void SetFlipped(bool value);
118  virtual void FindF2(qreal length)=0;
119  void SetFormulaLength(const QString &formula);
120 
121 private:
122  QSharedDataPointer<VAbstractArcData> d;
123 };
124 
125 #endif // VABSTRACTARC_H
qreal AngleArc() const
QSharedDataPointer< VAbstractArcData > d
Definition: vabstractarc.h:122
VAbstractArc(const GOType &type, const quint32 &idObject=null_id, const Draw &mode=Draw::Calculation)
void Swap(VAbstractArc &arc) Q_DECL_NOTHROW
virtual VPointF GetCenter() const
virtual QString NameForHistory(const QString &toolName) const Q_DECL_OVERRIDE
QString GetFormulaF1() const
VAbstractArc & operator=(const VAbstractArc &arc)
QString GetFormulaLength() const
void SetCenter(const VPointF &point)
virtual void FindF2(qreal length)=0
QString GetFormulaF2() const
virtual void setId(const quint32 &id) Q_DECL_OVERRIDE
setId set id object.
void SetFormulaF2(const QString &formula, qreal value)
void SetFormulaLength(const QString &formula, qreal value)
virtual qreal GetEndAngle() const Q_DECL_OVERRIDE
virtual qreal GetStartAngle() const Q_DECL_OVERRIDE
void SetFormulaF1(const QString &formula, qreal value)
virtual ~VAbstractArc()
bool IsFlipped() const
void SetFlipped(bool value)
The VPointF class keep data of point.
Definition: vpointf.h:75
#define NULL_ID
Definition: ifcdef.h:76
GOType
Definition: vgeometrydef.h:56
Draw
Definition: vgeometrydef.h:55
@ Calculation