2016-03-08 18:48:10 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vcubicbezier.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 8 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-08 18:48:10 +01:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2016 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2016-03-08 18:48:10 +01:00
|
|
|
**
|
|
|
|
** 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 VCUBICBEZIER_H
|
|
|
|
#define VCUBICBEZIER_H
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <qcompilerdetection.h>
|
|
|
|
#include <QPointF>
|
|
|
|
#include <QSharedDataPointer>
|
|
|
|
#include <QString>
|
|
|
|
#include <QTypeInfo>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
2016-03-08 18:48:10 +01:00
|
|
|
#include "vabstractcubicbezier.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "vgeometrydef.h"
|
2016-03-08 18:48:10 +01:00
|
|
|
#include "vpointf.h"
|
|
|
|
|
|
|
|
class VCubicBezierData;
|
|
|
|
|
2021-09-25 11:42:28 +02:00
|
|
|
class VCubicBezier final : public VAbstractCubicBezier
|
2016-03-08 18:48:10 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
VCubicBezier();
|
|
|
|
VCubicBezier(const VCubicBezier &curve);
|
|
|
|
VCubicBezier(const VPointF &p1, const VPointF &p2, const VPointF &p3, const VPointF &p4, quint32 idObject = 0,
|
|
|
|
Draw mode = Draw::Calculation);
|
2016-04-10 13:40:04 +02:00
|
|
|
VCubicBezier Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix = QString()) const;
|
2016-09-10 20:40:30 +02:00
|
|
|
VCubicBezier Flip(const QLineF &axis, const QString &prefix = QString()) const;
|
2016-10-04 16:34:37 +02:00
|
|
|
VCubicBezier Move(qreal length, qreal angle, const QString &prefix = QString()) const;
|
2016-03-10 14:55:04 +01:00
|
|
|
virtual ~VCubicBezier();
|
2016-03-08 18:48:10 +01:00
|
|
|
|
2017-04-19 12:27:17 +02:00
|
|
|
VCubicBezier &operator=(const VCubicBezier &curve);
|
|
|
|
#ifdef Q_COMPILER_RVALUE_REFS
|
2019-12-30 16:13:18 +01:00
|
|
|
VCubicBezier(const VCubicBezier &&curve) Q_DECL_NOTHROW;
|
2019-12-30 12:00:57 +01:00
|
|
|
VCubicBezier &operator=(VCubicBezier &&curve) Q_DECL_NOTHROW;
|
2017-04-19 12:27:17 +02:00
|
|
|
#endif
|
|
|
|
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual VPointF GetP1() const override;
|
2016-03-08 18:48:10 +01:00
|
|
|
void SetP1(const VPointF &p);
|
|
|
|
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual VPointF GetP2() const override;
|
2016-03-08 18:48:10 +01:00
|
|
|
void SetP2(const VPointF &p);
|
|
|
|
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual VPointF GetP3() const override;
|
2016-03-08 18:48:10 +01:00
|
|
|
void SetP3(const VPointF &p);
|
|
|
|
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual VPointF GetP4() const override;
|
2016-03-08 18:48:10 +01:00
|
|
|
void SetP4(const VPointF &p);
|
|
|
|
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual qreal GetStartAngle() const override;
|
|
|
|
virtual qreal GetEndAngle() const override;
|
|
|
|
virtual qreal GetLength() const override;
|
|
|
|
virtual QVector<QPointF> GetPoints() const override;
|
2016-03-08 18:48:10 +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
|
|
|
|
2016-03-10 17:09:38 +01:00
|
|
|
protected:
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual QPointF GetControlPoint1() const override;
|
|
|
|
virtual QPointF GetControlPoint2() const override;
|
2022-02-03 14:48:52 +01:00
|
|
|
auto GetRealLength() const -> qreal override;
|
2016-03-10 17:09:38 +01:00
|
|
|
|
2016-03-08 18:48:10 +01:00
|
|
|
private:
|
|
|
|
QSharedDataPointer<VCubicBezierData> d;
|
|
|
|
};
|
|
|
|
|
|
|
|
Q_DECLARE_TYPEINFO(VCubicBezier, Q_MOVABLE_TYPE);
|
|
|
|
|
|
|
|
#endif // VCUBICBEZIER_H
|