valentina/src/libs/vgeometry/varc.h

98 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 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/>.
**
*************************************************************************/
2013-08-05 10:37:56 +02:00
#ifndef VARC_H
#define VARC_H
2014-06-25 16:08:12 +02:00
#include "vabstractcurve.h"
#include "vpointf.h"
#include <QCoreApplication>
class QPainterPath;
class VArcData;
2013-08-05 10:37:56 +02:00
/**
* @brief VArc class for anticlockwise arc.
2013-08-05 10:37:56 +02:00
*/
2014-06-25 16:08:12 +02:00
class VArc: public VAbstractCurve
{
Q_DECLARE_TR_FUNCTIONS(VArc)
2013-08-05 10:37:56 +02:00
public:
VArc ();
VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2,
QString formulaF2, quint32 idObject = 0, Draw mode = Draw::Calculation);
VArc (VPointF center, qreal radius, qreal f1, qreal f2);
VArc (qreal length, QString formulaLength, VPointF center, qreal radius, QString formulaRadius, qreal f1,
QString formulaF1, quint32 idObject = 0, Draw mode = Draw::Calculation);
VArc (qreal length, VPointF center, qreal radius, qreal f1);
VArc(const VArc &arc);
VArc& operator= (const VArc &arc);
VArc Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix = QString()) const;
virtual ~VArc() Q_DECL_OVERRIDE;
QString GetFormulaF1 () const;
void SetFormulaF1 (const QString &formula, qreal value);
virtual qreal GetStartAngle () const Q_DECL_OVERRIDE;
QString GetFormulaF2 () const;
void SetFormulaF2 (const QString &formula, qreal value);
virtual qreal GetEndAngle () const Q_DECL_OVERRIDE;
QString GetFormulaRadius () const;
void SetFormulaRadius (const QString &formula, qreal value);
qreal GetRadius () const;
VPointF GetCenter () const;
void SetCenter (const VPointF &value);
QString GetFormulaLength () const;
void SetFormulaLength (const QString &formula, qreal value);
qreal GetLength () const;
QPointF GetP1() const;
2013-10-26 22:42:54 +02:00
QPointF GetP2 () const;
qreal AngleArc() const;
QVector<QPointF> GetPoints () const;
2014-01-08 15:05:32 +01:00
QPointF CutArc (const qreal &length, VArc &arc1, VArc &arc2) const;
QPointF CutArc (const qreal &length) const;
virtual void setId(const quint32 &id) Q_DECL_OVERRIDE;
virtual QString NameForHistory(const QString &toolName) const Q_DECL_OVERRIDE;
protected:
virtual void CreateName() Q_DECL_OVERRIDE;
2013-08-05 10:37:56 +02:00
private:
QSharedDataPointer<VArcData> d;
void FindF2(qreal length);
qreal MaxLength() const;
2013-08-05 10:37:56 +02:00
};
Q_DECLARE_TYPEINFO(VArc, Q_MOVABLE_TYPE);
2013-08-05 10:37:56 +02:00
#endif // VARC_H