2013-11-15 13:41:26 +01:00
|
|
|
/************************************************************************
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:50:05 +01:00
|
|
|
** @file varc.h
|
2014-04-30 07:38:52 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2013-11-15 13:50:05 +01:00
|
|
|
** @date November 15, 2013
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2013-11-15 13:41:26 +01:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
2013-09-18 21:16:19 +02:00
|
|
|
** 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.
|
|
|
|
**
|
2013-10-27 13:36:29 +01:00
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
2013-09-18 21:16:19 +02:00
|
|
|
** 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-11-15 13:41:26 +01:00
|
|
|
*************************************************************************/
|
2013-09-18 21:16:19 +02:00
|
|
|
|
2013-08-05 10:37:56 +02:00
|
|
|
#ifndef VARC_H
|
|
|
|
#define VARC_H
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QCoreApplication>
|
|
|
|
#include <QPointF>
|
|
|
|
#include <QSharedDataPointer>
|
|
|
|
#include <QString>
|
|
|
|
#include <QTypeInfo>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
2016-04-10 16:40:55 +02:00
|
|
|
#include "vabstractarc.h"
|
2013-12-29 17:48:57 +01:00
|
|
|
#include "vpointf.h"
|
2014-06-08 20:10:57 +02:00
|
|
|
|
2014-08-20 14:23:21 +02:00
|
|
|
class VArcData;
|
2013-08-05 10:37:56 +02:00
|
|
|
|
|
|
|
/**
|
2014-01-21 12:42:28 +01: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
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
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 ¢er, 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 ¢er, qreal radius, qreal f1, qreal f2);
|
|
|
|
VArc(qreal length, const QString &formulaLength, const VPointF ¢er, 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 ¢er, qreal radius, qreal f1);
|
2014-02-26 09:18:59 +01:00
|
|
|
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;
|
2014-08-20 14:23:21 +02:00
|
|
|
|
2023-07-13 16:49:20 +02:00
|
|
|
auto operator=(const VArc &arc) -> VArc &;
|
2017-04-19 12:27:17 +02:00
|
|
|
#ifdef Q_COMPILER_RVALUE_REFS
|
2023-07-13 16:49:20 +02:00
|
|
|
VArc(VArc &&arc) noexcept;
|
|
|
|
auto operator=(VArc &&arc) noexcept -> VArc &;
|
2017-04-19 12:27:17 +02:00
|
|
|
#endif
|
|
|
|
|
2022-05-20 16:08:32 +02:00
|
|
|
auto GetFormulaRadius() const -> QString;
|
|
|
|
void SetFormulaRadius(const QString &formula, qreal value);
|
|
|
|
auto GetRadius() const -> qreal;
|
2014-09-01 16:34:45 +02:00
|
|
|
|
2022-05-20 16:08:32 +02:00
|
|
|
auto GetLength() const -> qreal override;
|
2014-09-01 16:34:45 +02:00
|
|
|
|
2022-05-20 16:08:32 +02:00
|
|
|
auto GetP1() const -> QPointF;
|
|
|
|
auto GetP2() const -> QPointF;
|
2014-09-01 16:34:45 +02:00
|
|
|
|
2022-05-20 16:08:32 +02:00
|
|
|
auto GetPoints() const -> QVector<QPointF> override;
|
2014-09-01 16:34:45 +02:00
|
|
|
|
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
|
|
|
|
2023-11-22 12:59:50 +01:00
|
|
|
static auto OptimalApproximationScale(qreal radius, qreal f1, qreal f2, qreal tolerance) -> qreal;
|
|
|
|
|
2016-02-15 15:30:48 +01: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:
|
2014-08-20 14:23:21 +02:00
|
|
|
QSharedDataPointer<VArcData> d;
|
2015-06-09 12:21:10 +02:00
|
|
|
|
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
|
2015-11-25 19:56:17 +01:00
|
|
|
|
2013-08-05 10:37:56 +02:00
|
|
|
#endif // VARC_H
|