1 /************************************************************************ 2 ** 3 ** @file vistoolcubicbezierpath.h 4 ** @author Roman Telezhynskyi <dismine(at)gmail.com> 5 ** @date 18 3, 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 VISTOOLCUBICBEZIERPATH_H 30 #define VISTOOLCUBICBEZIERPATH_H 31 32 #include <qcompilerdetection.h> 33 #include <QGraphicsItem> 34 #include <QMetaObject> 35 #include <QObject> 36 #include <QString> 37 #include <QVector> 38 #include <QtGlobal> 39 40 #include "../vgeometry/vcubicbezierpath.h" 41 #include "../vmisc/def.h" 42 #include "vispath.h" 43 44 class VisToolCubicBezierPath : public VisPath 45 { 46 Q_OBJECT 47 public: 48 explicit VisToolCubicBezierPath(const VContainer *data, QGraphicsItem *parent = nullptr); 49 virtual ~VisToolCubicBezierPath(); 50 51 virtual void RefreshGeometry() override; 52 53 void setPath(const VCubicBezierPath &value); 54 VCubicBezierPath getPath(); 55 type()56 virtual int type() const override {return Type;} 57 enum { Type = UserType + static_cast<int>(Vis::ToolCubicBezierPath)}; 58 protected: 59 Q_DISABLE_COPY(VisToolCubicBezierPath) 60 QVector<VScaledEllipse *> mainPoints; 61 QVector<VScaledEllipse *> ctrlPoints; 62 QVector<VScaledLine *> lines; 63 VCurvePathItem *newCurveSegment; 64 VCubicBezierPath path; 65 VScaledLine *helpLine1; 66 VScaledLine *helpLine2; 67 68 private: 69 VScaledEllipse *getPoint(QVector<VScaledEllipse *> &points, quint32 i, qreal z = 0); 70 VScaledLine *getLine(quint32 i); 71 void Creating(const QVector<VPointF> &pathPoints , int pointsLeft); 72 void RefreshToolTip(); 73 }; 74 75 #endif // VISTOOLCUBICBEZIERPATH_H 76