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
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2016-03-16 19:07:50 +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 VCUBICBEZIERPATH_H
|
|
|
|
#define VCUBICBEZIERPATH_H
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#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"
|
|
|
|
#include "vpointf.h"
|
|
|
|
|
|
|
|
class VCubicBezierPathData;
|
|
|
|
|
2021-09-25 11:57:15 +02:00
|
|
|
class VCubicBezierPath final : public VAbstractCubicBezierPath
|
2016-03-16 19:07:50 +01:00
|
|
|
{
|
2022-08-12 17:50:13 +02:00
|
|
|
Q_DECLARE_TR_FUNCTIONS(VCubicBezierPath) // NOLINT
|
2023-07-13 16:49:20 +02:00
|
|
|
|
2016-03-16 19:07:50 +01:00
|
|
|
public:
|
|
|
|
explicit VCubicBezierPath(quint32 idObject = 0, Draw mode = Draw::Calculation);
|
|
|
|
VCubicBezierPath(const VCubicBezierPath &curve);
|
2023-07-15 09:58:28 +02:00
|
|
|
explicit VCubicBezierPath(const QVector<VPointF> &points, quint32 idObject = 0, Draw mode = Draw::Calculation);
|
2023-05-03 13:07:02 +02:00
|
|
|
auto Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix = QString()) const -> VCubicBezierPath;
|
|
|
|
auto Flip(const QLineF &axis, const QString &prefix = QString()) const -> VCubicBezierPath;
|
|
|
|
auto Move(qreal length, qreal angle, const QString &prefix = QString()) const -> VCubicBezierPath;
|
2023-07-15 09:58:28 +02:00
|
|
|
~VCubicBezierPath() override;
|
2016-03-16 19:07:50 +01:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto operator=(const VCubicBezierPath &curve) -> VCubicBezierPath &;
|
2017-04-19 12:27:17 +02:00
|
|
|
#ifdef Q_COMPILER_RVALUE_REFS
|
2023-07-13 16:49:20 +02:00
|
|
|
VCubicBezierPath(VCubicBezierPath &&curve) noexcept;
|
|
|
|
auto operator=(VCubicBezierPath &&curve) noexcept -> VCubicBezierPath &;
|
2017-04-19 12:27:17 +02:00
|
|
|
#endif
|
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto operator[](vsizetype indx) -> VPointF &;
|
2016-03-16 19:07:50 +01:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto at(vsizetype indx) const -> const VPointF &;
|
2016-03-16 19:07:50 +01:00
|
|
|
|
2023-07-13 16:49:20 +02:00
|
|
|
void append(const VPointF &point);
|
2016-03-16 19:07:50 +01:00
|
|
|
|
2023-07-15 09:58:28 +02:00
|
|
|
auto CountSubSpl() const -> vsizetype override;
|
|
|
|
auto CountPoints() const -> vsizetype override;
|
|
|
|
void Clear() override;
|
|
|
|
auto GetSpline(vsizetype index) const -> VSpline override;
|
|
|
|
auto GetStartAngle() const -> qreal override;
|
|
|
|
auto GetEndAngle() const -> qreal override;
|
2016-03-16 19:07:50 +01:00
|
|
|
|
2023-07-15 09:58:28 +02:00
|
|
|
auto GetC1Length() const -> qreal override;
|
|
|
|
auto GetC2Length() const -> qreal override;
|
2016-09-24 19:44:06 +02:00
|
|
|
|
2023-07-15 09:58:28 +02:00
|
|
|
auto GetSplinePath() const -> QVector<VSplinePoint> override;
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetCubicPath() const -> QVector<VPointF>;
|
|
|
|
|
|
|
|
static auto CountSubSpl(vsizetype size) -> vsizetype;
|
|
|
|
static auto SubSplOffset(vsizetype subSplIndex) -> vsizetype;
|
|
|
|
static auto SubSplPointsCount(vsizetype countSubSpl) -> vsizetype;
|
2016-03-19 15:20:09 +01:00
|
|
|
|
2016-03-16 19:07:50 +01:00
|
|
|
protected:
|
2023-07-15 09:58:28 +02:00
|
|
|
auto FirstPoint() const -> VPointF override;
|
|
|
|
auto LastPoint() const -> VPointF override;
|
2023-05-03 13:07:02 +02:00
|
|
|
|
2016-03-16 19:07:50 +01:00
|
|
|
private:
|
|
|
|
QSharedDataPointer<VCubicBezierPathData> d;
|
|
|
|
};
|
|
|
|
|
2022-08-12 17:50:13 +02:00
|
|
|
Q_DECLARE_TYPEINFO(VCubicBezierPath, Q_MOVABLE_TYPE); // NOLINT
|
2016-03-16 19:07:50 +01:00
|
|
|
|
|
|
|
#endif // VCUBICBEZIERPATH_H
|