Seamly2D
Code documentation
vcubicbezierpath.h
Go to the documentation of this file.
1 /******************************************************************************
2  * @file vcubicbezierpath.h
3  ** @author Douglas S Caskey
4  ** @date 21 Mar, 2023
5  **
6  ** @brief
7  ** @copyright
8  ** This source code is part of the Seamly2D project, a pattern making
9  ** program to create and model patterns of clothing.
10  ** Copyright (C) 2017-2023 Seamly2D project
11  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
12  **
13  ** Seamly2D is free software: you can redistribute it and/or modify
14  ** You should have received a copy of the GNU General Public License
15  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
16  **
17  *****************************************************************************/
18 
19 /************************************************************************
20  **
21  ** @file vcubicbezierpath.h
22  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
23  ** @date 16 3, 2016
24  **
25  ** @brief
26  ** @copyright
27  ** This source code is part of the Valentine project, a pattern making
28  ** program, whose allow create and modeling patterns of clothing.
29  ** Copyright (C) 2016 Seamly2D project
30  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
31  **
32  ** Seamly2D is free software: you can redistribute it and/or modify
33  ** it under the terms of the GNU General Public License as published by
34  ** the Free Software Foundation, either version 3 of the License, or
35  ** (at your option) any later version.
36  **
37  ** Seamly2D is distributed in the hope that it will be useful,
38  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
39  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40  ** GNU General Public License for more details.
41  **
42  ** You should have received a copy of the GNU General Public License
43  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
44  **
45  *************************************************************************/
46 
47 #ifndef VCUBICBEZIERPATH_H
48 #define VCUBICBEZIERPATH_H
49 
50 #include <qcompilerdetection.h>
51 #include <QCoreApplication>
52 #include <QPointF>
53 #include <QSharedDataPointer>
54 #include <QString>
55 #include <QTypeInfo>
56 #include <QVector>
57 #include <QtGlobal>
58 
60 #include "vgeometrydef.h"
61 #include "vpointf.h"
62 
64 
66 {
67  Q_DECLARE_TR_FUNCTIONS(VCubicBezierPath)
68 public:
69  explicit VCubicBezierPath(quint32 idObject = 0, Draw mode = Draw::Calculation);
70  VCubicBezierPath(const VCubicBezierPath &curve);
71  VCubicBezierPath(const QVector<VPointF> &points, quint32 idObject = 0,
72  Draw mode = Draw::Calculation);
73  VCubicBezierPath Rotate(const QPointF &originPoint, qreal degrees,
74  const QString &prefix = QString()) const;
75  VCubicBezierPath Flip(const QLineF &axis, const QString &prefix = QString()) const;
76  VCubicBezierPath Move(qreal length, qreal angle, const QString &prefix = QString()) const;
77  virtual ~VCubicBezierPath();
78 
80 
81 #ifdef Q_COMPILER_RVALUE_REFS
82  VCubicBezierPath &operator=(VCubicBezierPath &&curve) Q_DECL_NOTHROW;
83 #endif
84 
85  void Swap(VCubicBezierPath &curve) Q_DECL_NOTHROW;
86 
87  VPointF &operator[](int indx);
88 
89  const VPointF &at(int indx) const;
90 
91  void append(const VPointF &point);
92 
93  virtual qint32 CountSubSpl() const Q_DECL_OVERRIDE;
94  virtual qint32 CountPoints() const Q_DECL_OVERRIDE;
95  virtual void Clear() Q_DECL_OVERRIDE;
96  virtual VSpline GetSpline(qint32 index) const Q_DECL_OVERRIDE;
97  virtual qreal GetStartAngle () const Q_DECL_OVERRIDE;
98  virtual qreal GetEndAngle () const Q_DECL_OVERRIDE;
99 
100  virtual qreal GetC1Length() const Q_DECL_OVERRIDE;
101  virtual qreal GetC2Length() const Q_DECL_OVERRIDE;
102 
103  virtual QVector<VSplinePoint> GetSplinePath() const Q_DECL_OVERRIDE;
105 
106  static qint32 CountSubSpl(qint32 size);
107  static qint32 SubSplOffset(qint32 subSplIndex);
108  static qint32 SubSplPointsCount(qint32 countSubSpl);
109 
110  virtual VPointF FirstPoint() const Q_DECL_OVERRIDE;
111  virtual VPointF LastPoint() const Q_DECL_OVERRIDE;
112 
113 private:
114  QSharedDataPointer<VCubicBezierPathData> d;
115 };
116 
118 
119 #endif // VCUBICBEZIERPATH_H
virtual VPointF FirstPoint() const Q_DECL_OVERRIDE
void append(const VPointF &point)
static qint32 SubSplPointsCount(qint32 countSubSpl)
VCubicBezierPath(quint32 idObject=0, Draw mode=Draw::Calculation)
QVector< VPointF > GetCubicPath() const
virtual qint32 CountPoints() const Q_DECL_OVERRIDE
VCubicBezierPath & operator=(const VCubicBezierPath &curve)
virtual qreal GetC2Length() const Q_DECL_OVERRIDE
virtual qint32 CountSubSpl() const Q_DECL_OVERRIDE
virtual qreal GetC1Length() const Q_DECL_OVERRIDE
const VPointF & at(int indx) const
virtual VPointF LastPoint() const Q_DECL_OVERRIDE
VCubicBezierPath Flip(const QLineF &axis, const QString &prefix=QString()) const
virtual VSpline GetSpline(qint32 index) const Q_DECL_OVERRIDE
virtual QVector< VSplinePoint > GetSplinePath() const Q_DECL_OVERRIDE
QSharedDataPointer< VCubicBezierPathData > d
virtual qreal GetEndAngle() const Q_DECL_OVERRIDE
void Swap(VCubicBezierPath &curve) Q_DECL_NOTHROW
VCubicBezierPath Move(qreal length, qreal angle, const QString &prefix=QString()) const
virtual void Clear() Q_DECL_OVERRIDE
virtual qreal GetStartAngle() const Q_DECL_OVERRIDE
static qint32 SubSplOffset(qint32 subSplIndex)
VCubicBezierPath Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix=QString()) const
VPointF & operator[](int indx)
The VPointF class keep data of point.
Definition: vpointf.h:75
VSpline class that implements the spline.
Definition: vspline.h:75
Q_DECLARE_TYPEINFO(VCubicBezierPath, Q_MOVABLE_TYPE)
Draw
Definition: vgeometrydef.h:55
@ Calculation