1 /************************************************************************ 2 ** 3 ** @file vsplinepoint.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 VSPLINEPOINT_H 30 #define VSPLINEPOINT_H 31 32 #include <QMetaType> 33 #include <QSharedDataPointer> 34 #include <QString> 35 #include <QTypeInfo> 36 #include <QtGlobal> 37 38 #include "vpointf.h" 39 40 class VFSplinePointData; 41 42 /** 43 * @brief The VFSplinePoint class keep information about point in spline path. Each point have two angles and two 44 * coefficient. Point represent at the same time first and last point of a spline. 45 */ 46 class VFSplinePoint 47 { 48 public: 49 VFSplinePoint(); 50 VFSplinePoint(const VPointF &pSpline, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2); 51 VFSplinePoint(const VFSplinePoint &point); 52 ~VFSplinePoint(); 53 54 VFSplinePoint &operator=(const VFSplinePoint &point); 55 #ifdef Q_COMPILER_RVALUE_REFS 56 VFSplinePoint(const VFSplinePoint &&point) Q_DECL_NOTHROW; 57 VFSplinePoint &operator=(VFSplinePoint &&point) Q_DECL_NOTHROW; 58 #endif 59 60 VPointF P() const; 61 void SetP(const VPointF &value); 62 qreal Angle1() const; 63 void SetAngle1(const qreal &value); 64 void SetAngle2(const qreal &value); 65 qreal Angle2() const; 66 qreal KAsm1() const; 67 void SetKAsm1(const qreal &value); 68 qreal KAsm2() const; 69 void SetKAsm2(const qreal &value); 70 protected: 71 QSharedDataPointer<VFSplinePointData> d; 72 }; 73 74 Q_DECLARE_METATYPE(VFSplinePoint) 75 Q_DECLARE_TYPEINFO(VFSplinePoint, Q_MOVABLE_TYPE); 76 77 class VSplinePointData; 78 79 /** 80 * @brief The VSplinePoint class keep information about point in spline path. Each point have two angles and two 81 * lengths. Point represent at the same time first and last point of a spline. 82 */ 83 class VSplinePoint 84 { 85 public: 86 VSplinePoint(); 87 VSplinePoint(const VPointF &pSpline, qreal angle1, const QString &angle1F, qreal angle2, const QString &angle2F, 88 qreal length1, const QString &length1F, qreal length2, const QString &length2F); 89 VSplinePoint(const VSplinePoint &point); 90 ~VSplinePoint(); 91 92 VSplinePoint &operator=(const VSplinePoint &point); 93 #ifdef Q_COMPILER_RVALUE_REFS 94 VSplinePoint(const VSplinePoint &&point) Q_DECL_NOTHROW; 95 VSplinePoint &operator=(VSplinePoint &&point) Q_DECL_NOTHROW; 96 #endif 97 98 VPointF P() const; 99 void SetP(const VPointF &value); 100 101 qreal Angle1() const; 102 QString Angle1Formula() const; 103 void SetAngle1(const qreal &value, const QString &angle1F); 104 105 qreal Angle2() const; 106 QString Angle2Formula() const; 107 void SetAngle2(const qreal &value, const QString &angle2F); 108 109 qreal Length1() const; 110 QString Length1Formula() const; 111 void SetLength1(const qreal &value, const QString &length1F); 112 113 qreal Length2() const; 114 QString Length2Formula() const; 115 void SetLength2(const qreal &value, const QString &length2F); 116 117 bool IsMovable() const; 118 119 QJsonObject ToJson() const; 120 protected: 121 QSharedDataPointer<VSplinePointData> d; 122 }; 123 124 Q_DECLARE_METATYPE(VSplinePoint) 125 Q_DECLARE_TYPEINFO(VSplinePoint, Q_MOVABLE_TYPE); 126 127 #endif // VSPLINEPOINT_H 128