2016-03-16 19:07:50 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vcubicbezierpath.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 16 3, 2016
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2016-03-16 19:07:50 +01:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2016 Valentina project
|
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
|
|
**
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef VCUBICBEZIERPATH_H
|
|
|
|
#define VCUBICBEZIERPATH_H
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <qcompilerdetection.h>
|
|
|
|
#include <QCoreApplication>
|
|
|
|
#include <QPointF>
|
|
|
|
#include <QSharedDataPointer>
|
|
|
|
#include <QString>
|
|
|
|
#include <QTypeInfo>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
2016-03-16 19:07:50 +01:00
|
|
|
#include "vabstractcubicbezierpath.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "vgeometrydef.h"
|
2016-03-16 19:07:50 +01:00
|
|
|
#include "vpointf.h"
|
|
|
|
|
|
|
|
class VCubicBezierPathData;
|
|
|
|
|
|
|
|
class VCubicBezierPath : public VAbstractCubicBezierPath
|
|
|
|
{
|
|
|
|
Q_DECLARE_TR_FUNCTIONS(VCubicBezierPath)
|
|
|
|
public:
|
|
|
|
explicit VCubicBezierPath(quint32 idObject = 0, Draw mode = Draw::Calculation);
|
|
|
|
VCubicBezierPath(const VCubicBezierPath &curve);
|
|
|
|
VCubicBezierPath(const QVector<VPointF> &points, quint32 idObject = 0, Draw mode = Draw::Calculation);
|
2016-04-10 13:40:04 +02:00
|
|
|
VCubicBezierPath Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix = QString()) const;
|
2016-09-10 20:40:30 +02:00
|
|
|
VCubicBezierPath Flip(const QLineF &axis, const QString &prefix = QString()) const;
|
2016-10-04 16:34:37 +02:00
|
|
|
VCubicBezierPath Move(qreal length, qreal angle, const QString &prefix = QString()) const;
|
2016-03-16 19:07:50 +01:00
|
|
|
virtual ~VCubicBezierPath();
|
|
|
|
|
2017-04-19 12:27:17 +02:00
|
|
|
VCubicBezierPath &operator=(const VCubicBezierPath &curve);
|
|
|
|
#ifdef Q_COMPILER_RVALUE_REFS
|
2019-12-30 16:13:18 +01:00
|
|
|
VCubicBezierPath(const VCubicBezierPath &&curve) Q_DECL_NOTHROW;
|
2019-12-30 12:00:57 +01:00
|
|
|
VCubicBezierPath &operator=(VCubicBezierPath &&curve) Q_DECL_NOTHROW;
|
2017-04-19 12:27:17 +02:00
|
|
|
#endif
|
|
|
|
|
2016-03-16 19:07:50 +01:00
|
|
|
VPointF &operator[](int indx);
|
|
|
|
|
|
|
|
const VPointF &at(int indx) const;
|
|
|
|
|
|
|
|
void append(const VPointF &point);
|
|
|
|
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual qint32 CountSubSpl() const override;
|
|
|
|
virtual qint32 CountPoints() const override;
|
|
|
|
virtual void Clear() override;
|
|
|
|
virtual VSpline GetSpline(qint32 index) const override;
|
|
|
|
virtual qreal GetStartAngle () const override;
|
|
|
|
virtual qreal GetEndAngle () const override;
|
2016-03-16 19:07:50 +01:00
|
|
|
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual qreal GetC1Length() const override;
|
|
|
|
virtual qreal GetC2Length() const override;
|
2016-09-24 19:44:06 +02:00
|
|
|
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual QVector<VSplinePoint> GetSplinePath() const override;
|
2016-03-22 16:14:53 +01:00
|
|
|
QVector<VPointF> GetCubicPath() const;
|
2016-03-19 15:20:09 +01:00
|
|
|
|
|
|
|
static qint32 CountSubSpl(qint32 size);
|
|
|
|
static qint32 SubSplOffset(qint32 subSplIndex);
|
|
|
|
static qint32 SubSplPointsCount(qint32 countSubSpl);
|
2016-03-16 19:07:50 +01:00
|
|
|
protected:
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual VPointF FirstPoint() const override;
|
|
|
|
virtual VPointF LastPoint() const override;
|
2016-03-16 19:07:50 +01:00
|
|
|
private:
|
|
|
|
QSharedDataPointer<VCubicBezierPathData> d;
|
|
|
|
};
|
|
|
|
|
|
|
|
Q_DECLARE_TYPEINFO(VCubicBezierPath, Q_MOVABLE_TYPE);
|
|
|
|
|
|
|
|
#endif // VCUBICBEZIERPATH_H
|