Seamly2D
Code documentation
vabstractcubicbezierpath.h
Go to the documentation of this file.
1 /******************************************************************************
2  * @file vabstractcubicbezierpath.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 vabstractcubicbezierpath.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 VABSTRACTCUBICBEZIERPATH_H
48 #define VABSTRACTCUBICBEZIERPATH_H
49 
50 #include <qcompilerdetection.h>
51 #include <QCoreApplication>
52 #include <QPointF>
53 #include <QString>
54 #include <QVector>
55 #include <QtGlobal>
56 
57 #include "vabstractbezier.h"
58 #include "vgeometrydef.h"
59 
60 class VPointF;
61 class VSpline;
62 class VSplinePoint;
63 
65 {
66  Q_DECLARE_TR_FUNCTIONS(VAbstractCubicBezierPath)
67 
68 public:
69  VAbstractCubicBezierPath(const GOType &type, const quint32 &idObject = NULL_ID,
70  const Draw &mode = Draw::Calculation);
73 
74  virtual ~VAbstractCubicBezierPath();
75 
76  virtual qint32 CountSubSpl() const =0;
77  virtual qint32 CountPoints() const =0;
78  virtual void Clear() =0;
79  virtual VSpline GetSpline(qint32 index) const =0;
81 
82  virtual QPainterPath GetPath() const Q_DECL_OVERRIDE;
83  virtual QVector<QPointF> getPoints() const Q_DECL_OVERRIDE;
84  virtual qreal GetLength() const Q_DECL_OVERRIDE;
85 
86  virtual QVector<DirectionArrow> DirectionArrows() const Q_DECL_OVERRIDE;
87 
88  int Segment(const QPointF &p) const;
89 
90  QPointF CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2,
91  QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3) const;
92 
93  virtual QString NameForHistory(const QString &toolName) const Q_DECL_OVERRIDE;
94 
95  virtual VPointF FirstPoint() const =0;
96  virtual VPointF LastPoint() const =0;
97 
98 protected:
99  virtual void CreateName() Q_DECL_OVERRIDE;
100 };
101 
102 #endif // VABSTRACTCUBICBEZIERPATH_H
virtual VPointF FirstPoint() const =0
virtual QVector< VSplinePoint > GetSplinePath() const =0
virtual qreal GetLength() const Q_DECL_OVERRIDE
GetLength return length of spline path.
QPointF CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3) const
CutSplinePath cut spline path into two. This method don't return two spline path. You must create spl...
virtual QVector< QPointF > getPoints() const Q_DECL_OVERRIDE
GetPathPoints return list of points what located on path.
VAbstractCubicBezierPath & operator=(const VAbstractCubicBezierPath &curve)
virtual QString NameForHistory(const QString &toolName) const Q_DECL_OVERRIDE
NameForHistory helps to create name for dialog History.
virtual qint32 CountSubSpl() const =0
VAbstractCubicBezierPath(const GOType &type, const quint32 &idObject=null_id, const Draw &mode=Draw::Calculation)
int Segment(const QPointF &p) const
virtual void CreateName() Q_DECL_OVERRIDE
virtual void Clear()=0
virtual qint32 CountPoints() const =0
virtual QPainterPath GetPath() const Q_DECL_OVERRIDE
GetPath return QPainterPath which reprezent spline path.
virtual QVector< DirectionArrow > DirectionArrows() const Q_DECL_OVERRIDE
virtual VSpline GetSpline(qint32 index) const =0
virtual VPointF LastPoint() const =0
The VPointF class keep data of point.
Definition: vpointf.h:75
The VSplinePoint class keep information about point in spline path. Each point have two angles and tw...
Definition: vsplinepoint.h:108
VSpline class that implements the spline.
Definition: vspline.h:75
#define NULL_ID
Definition: ifcdef.h:76
QPair< QLineF, QLineF > DirectionArrow
GOType
Definition: vgeometrydef.h:56
Draw
Definition: vgeometrydef.h:55
@ Calculation