valentina/src/libs/vgeometry/varc.h

103 lines
3.6 KiB
C
Raw Normal View History

/************************************************************************
**
** @file varc.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date November 15, 2013
**
** @brief
** @copyright
** This source code is part of the Valentina project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2015 Valentina project
** <https://gitlab.com/smart-pattern/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/>.
**
*************************************************************************/
2013-08-05 10:37:56 +02:00
#ifndef VARC_H
#define VARC_H
#include <QCoreApplication>
#include <QPointF>
#include <QSharedDataPointer>
#include <QString>
#include <QTypeInfo>
#include <QVector>
#include <QtGlobal>
#include "vabstractarc.h"
#include "vpointf.h"
class VArcData;
2013-08-05 10:37:56 +02:00
/**
* @brief VArc class for anticlockwise arc.
2013-08-05 10:37:56 +02:00
*/
2021-09-25 11:42:28 +02:00
class VArc final : public VAbstractArc
{
2022-05-20 16:08:32 +02:00
Q_DECLARE_TR_FUNCTIONS(VArc) // NOLINT
2023-07-13 16:49:20 +02:00
2013-08-05 10:37:56 +02:00
public:
2022-05-20 16:08:32 +02:00
VArc();
VArc(const VPointF &center, qreal radius, const QString &formulaRadius, qreal f1, const QString &formulaF1,
qreal f2, const QString &formulaF2, quint32 idObject = 0, Draw mode = Draw::Calculation);
VArc(const VPointF &center, qreal radius, qreal f1, qreal f2);
VArc(qreal length, const QString &formulaLength, const VPointF &center, qreal radius, const QString &formulaRadius,
2023-07-13 16:49:20 +02:00
qreal f1, const QString &formulaF1, quint32 idObject = 0, Draw mode = Draw::Calculation);
2022-05-20 16:08:32 +02:00
VArc(qreal length, const VPointF &center, qreal radius, qreal f1);
VArc(const VArc &arc);
2022-05-20 16:08:32 +02:00
auto Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix = QString()) const -> VArc;
auto Flip(const QLineF &axis, const QString &prefix = QString()) const -> VArc;
auto Move(qreal length, qreal angle, const QString &prefix = QString()) const -> VArc;
~VArc() override;
2023-07-13 16:49:20 +02:00
auto operator=(const VArc &arc) -> VArc &;
#ifdef Q_COMPILER_RVALUE_REFS
2023-07-13 16:49:20 +02:00
VArc(VArc &&arc) noexcept;
auto operator=(VArc &&arc) noexcept -> VArc &;
#endif
2022-05-20 16:08:32 +02:00
auto GetFormulaRadius() const -> QString;
void SetFormulaRadius(const QString &formula, qreal value);
auto GetRadius() const -> qreal;
2022-05-20 16:08:32 +02:00
auto GetLength() const -> qreal override;
2022-05-20 16:08:32 +02:00
auto GetP1() const -> QPointF;
auto GetP2() const -> QPointF;
2022-05-20 16:08:32 +02:00
auto GetPoints() const -> QVector<QPointF> override;
2022-05-20 16:08:32 +02:00
auto CutArc(qreal length, VArc &arc1, VArc &arc2, const QString &pointName) const -> QPointF;
auto CutArc(qreal length, const QString &pointName) const -> QPointF;
2023-07-13 16:49:20 +02:00
protected:
2022-05-20 16:08:32 +02:00
void CreateName() override;
void CreateAlias() override;
void FindF2(qreal length) override;
2023-07-13 16:49:20 +02:00
2013-08-05 10:37:56 +02:00
private:
QSharedDataPointer<VArcData> d;
2022-05-20 16:08:32 +02:00
auto MaxLength() const -> qreal;
auto CutPoint(qreal length, qreal fullLength, const QString &pointName) const -> QLineF;
auto CutPointFlipped(qreal length, qreal fullLength, const QString &pointName) const -> QLineF;
2013-08-05 10:37:56 +02:00
};
2022-05-20 14:49:15 +02:00
Q_DECLARE_TYPEINFO(VArc, Q_MOVABLE_TYPE); // NOLINT
2013-08-05 10:37:56 +02:00
#endif // VARC_H