2016-02-10 05:59:29 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vellipticalarc.h
|
|
|
|
** @author Valentina Zhuravska <zhuravska19(at)gmail.com>
|
|
|
|
** @date February 1, 2016
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2013-2015 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 VELLIPTICALARC_H
|
|
|
|
#define VELLIPTICALARC_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-04-10 16:40:55 +02:00
|
|
|
#include "vabstractarc.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "vgeometrydef.h"
|
2016-02-10 05:59:29 +01:00
|
|
|
#include "vpointf.h"
|
|
|
|
|
|
|
|
class VEllipticalArcData;
|
|
|
|
|
2016-04-10 16:40:55 +02:00
|
|
|
class VEllipticalArc : public VAbstractArc
|
2016-02-10 05:59:29 +01:00
|
|
|
{
|
|
|
|
Q_DECLARE_TR_FUNCTIONS(VEllipticalArc)
|
|
|
|
public:
|
|
|
|
VEllipticalArc();
|
2016-04-10 13:40:04 +02:00
|
|
|
VEllipticalArc (const VPointF ¢er, qreal radius1, qreal radius2, const QString &formulaRadius1,
|
|
|
|
const QString &formulaRadius2, qreal f1, const QString &formulaF1, qreal f2,
|
2016-12-17 02:41:33 +01:00
|
|
|
const QString &formulaF2, qreal rotationAngle, const QString &formulaRotationAngle,
|
|
|
|
quint32 idObject = 0, Draw mode = Draw::Calculation);
|
2016-04-10 13:40:04 +02:00
|
|
|
VEllipticalArc (const VPointF ¢er, qreal radius1, qreal radius2, qreal f1, qreal f2, qreal rotationAngle);
|
|
|
|
VEllipticalArc (qreal length, const QString &formulaLength, const VPointF ¢er, qreal radius1, qreal radius2,
|
|
|
|
const QString &formulaRadius1, const QString &formulaRadius2, qreal f1, const QString &formulaF1,
|
2016-12-20 15:51:58 +01:00
|
|
|
qreal rotationAngle, const QString &formulaRotationAngle, quint32 idObject = 0,
|
|
|
|
Draw mode = Draw::Calculation);
|
2016-04-10 13:40:04 +02:00
|
|
|
VEllipticalArc (qreal length, const VPointF ¢er, qreal radius1, qreal radius2, qreal f1, qreal rotationAngle);
|
2016-02-10 05:59:29 +01:00
|
|
|
VEllipticalArc(const VEllipticalArc &arc);
|
|
|
|
|
2016-04-10 13:40:04 +02:00
|
|
|
VEllipticalArc Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix = QString()) const;
|
2016-09-10 20:40:30 +02:00
|
|
|
VEllipticalArc Flip(const QLineF &axis, const QString &prefix = QString()) const;
|
2016-10-04 16:34:37 +02:00
|
|
|
VEllipticalArc Move(qreal length, qreal angle, const QString &prefix = QString()) const;
|
2016-02-10 05:59:29 +01:00
|
|
|
|
|
|
|
virtual ~VEllipticalArc() Q_DECL_OVERRIDE;
|
|
|
|
|
2017-04-19 12:27:17 +02:00
|
|
|
VEllipticalArc& operator= (const VEllipticalArc &arc);
|
|
|
|
#ifdef Q_COMPILER_RVALUE_REFS
|
|
|
|
VEllipticalArc &operator=(VEllipticalArc &&arc) Q_DECL_NOTHROW { Swap(arc); return *this; }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void Swap(VEllipticalArc &arc) Q_DECL_NOTHROW
|
2017-04-28 08:38:09 +02:00
|
|
|
{ VAbstractArc::Swap(arc); std::swap(d, arc.d); }
|
2017-04-19 12:27:17 +02:00
|
|
|
|
2016-12-17 02:41:33 +01:00
|
|
|
QString GetFormulaRotationAngle () const;
|
|
|
|
void SetFormulaRotationAngle (const QString &formula, qreal value);
|
|
|
|
qreal GetRotationAngle() const;
|
2016-02-10 05:59:29 +01:00
|
|
|
|
2016-04-10 16:40:55 +02:00
|
|
|
QString GetFormulaRadius1 () const;
|
|
|
|
void SetFormulaRadius1 (const QString &formula, qreal value);
|
|
|
|
qreal GetRadius1 () const;
|
2016-02-10 05:59:29 +01:00
|
|
|
|
2016-04-10 16:40:55 +02:00
|
|
|
QString GetFormulaRadius2 () const;
|
|
|
|
void SetFormulaRadius2 (const QString &formula, qreal value);
|
|
|
|
qreal GetRadius2 () const;
|
2016-02-12 19:19:46 +01:00
|
|
|
|
2016-05-20 18:39:13 +02:00
|
|
|
virtual qreal GetLength () const Q_DECL_OVERRIDE;
|
2016-02-12 21:02:54 +01:00
|
|
|
|
2016-04-10 16:40:55 +02:00
|
|
|
QPointF GetP1() const;
|
|
|
|
QPointF GetP2() const;
|
2016-02-10 05:59:29 +01:00
|
|
|
|
2016-05-20 18:39:13 +02:00
|
|
|
virtual QVector<QPointF> GetPoints () const Q_DECL_OVERRIDE;
|
2016-02-10 05:59:29 +01:00
|
|
|
|
2016-04-10 16:40:55 +02:00
|
|
|
QPointF CutArc (const qreal &length, VEllipticalArc &arc1, VEllipticalArc &arc2) const;
|
|
|
|
QPointF CutArc (const qreal &length) const;
|
2016-02-27 15:53:17 +01:00
|
|
|
protected:
|
|
|
|
virtual void CreateName() Q_DECL_OVERRIDE;
|
2016-04-10 16:40:55 +02:00
|
|
|
virtual void FindF2(qreal length) Q_DECL_OVERRIDE;
|
2016-02-10 05:59:29 +01:00
|
|
|
private:
|
|
|
|
QSharedDataPointer<VEllipticalArcData> d;
|
|
|
|
|
2016-08-02 14:12:13 +02:00
|
|
|
// cppcheck-suppress unusedPrivateFunction
|
2016-04-10 16:40:55 +02:00
|
|
|
QVector<qreal> GetAngles () const;
|
|
|
|
qreal MaxLength() const;
|
|
|
|
QPointF GetPoint (qreal angle) const;
|
|
|
|
|
2016-04-10 13:40:04 +02:00
|
|
|
static int GetQuadransRad(qreal &rad);
|
2016-02-10 05:59:29 +01:00
|
|
|
};
|
|
|
|
|
2016-09-10 20:40:30 +02:00
|
|
|
Q_DECLARE_METATYPE(VEllipticalArc)
|
2016-02-10 05:59:29 +01:00
|
|
|
Q_DECLARE_TYPEINFO(VEllipticalArc, Q_MOVABLE_TYPE);
|
|
|
|
|
|
|
|
#endif // VELLIPTICALARC_H
|