valentina/src/geometry/varc.h

171 lines
5.8 KiB
C
Raw Normal View History

/************************************************************************
**
** @file varc.h
** @author Roman Telezhinsky <dismine@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 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
#include "vgobject.h"
#include <QCoreApplication>
#include "../options.h"
#include "vpointf.h"
class QString;
class QLineF;
class QPainterPath;
2013-08-05 10:37:56 +02:00
/**
* @brief VArc клас, що реалізує дугу. Дуга розраховується за годиниковою стрілкою.
*/
class VArc: public VGObject
{
Q_DECLARE_TR_FUNCTIONS(VArc)
2013-08-05 10:37:56 +02:00
public:
/**
* @brief VArc конструктор по замовчуванню.
*/
2013-10-27 11:22:44 +01:00
VArc ();
/**
* @brief VArc конструктор.
* @param center точка центру.
* @param radius радіус.
* @param f1 початковий кут в градусах.
* @param f2 кінцевий кут в градусах.
*/
VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2,
QString formulaF2, qint64 idObject = 0, Draw::Draws mode = Draw::Calculation);
/**
* @brief VArc
* @param arc
*/
2013-10-27 11:22:44 +01:00
VArc(const VArc &arc);
/**
* @brief operator =
* @param arc
* @return
*/
2013-10-27 11:22:44 +01:00
VArc& operator= (const VArc &arc);
2013-08-05 10:37:56 +02:00
/**
* @brief GetF1 повертає початковий кут дуги.
* @return повертає кут в градусах.
*/
2013-10-26 22:42:54 +02:00
inline QString GetFormulaF1 () const {return formulaF1;}
/**
* @brief GetF1
* @return
*/
2013-10-26 22:42:54 +02:00
inline qreal GetF1 () const {return f1;}
2013-08-05 10:37:56 +02:00
/**
* @brief GetF2 повертає кінцевий кут дуги.
* @return повертає кут в градусах.
*/
2013-10-26 22:42:54 +02:00
inline QString GetFormulaF2 () const {return formulaF2;}
/**
* @brief GetF2
* @return
*/
2013-10-26 22:42:54 +02:00
inline qreal GetF2 () const {return f2;}
2013-08-05 10:37:56 +02:00
/**
* @brief GetLength повертає довжину дуги.
* @return повертає довжину дуги.
*/
qreal GetLength () const;
2013-08-05 10:37:56 +02:00
/**
* @brief GetRadius повертає радіус дуги.
* @return повертає радіус дуги.
*/
2013-10-26 22:42:54 +02:00
inline QString GetFormulaRadius () const {return formulaRadius;}
/**
* @brief GetRadius
* @return
*/
2013-10-26 22:42:54 +02:00
inline qreal GetRadius () const {return radius;}
2013-08-05 10:37:56 +02:00
/**
* @brief GetCenter повертає точку центра дуги.
* @return повертає точку центра дуги.
*/
inline VPointF GetCenter () const {return center;}
2013-08-05 10:37:56 +02:00
/**
* @brief GetP1 повертає першу точку з якої починається дуга.
* @return точку початку дуги.
*/
QPointF GetP1() const;
2013-08-05 10:37:56 +02:00
/**
* @brief GetP2 повертає другу точку в якій закінчується дуга.
* @return точку кінця дуги.
*/
2013-10-26 22:42:54 +02:00
QPointF GetP2 () const;
2013-08-05 10:37:56 +02:00
/**
* @brief GetPath будує шлях по даній дузі.
* @return повертає шлях.
*/
2013-10-26 22:42:54 +02:00
QPainterPath GetPath() const;
/**
* @brief AngleArc
* @return
*/
2013-10-26 22:42:54 +02:00
qreal AngleArc() const;
/**
* @brief GetPoints
* @return
*/
2013-10-26 22:42:54 +02:00
QVector<QPointF> GetPoints () const;
virtual QString name() const;
2014-01-08 15:05:32 +01:00
QPointF CutArc (const qreal &length, VArc &arc1, VArc &arc2) const;
virtual void setId(const qint64 &id);
2013-08-05 10:37:56 +02:00
private:
/**
* @brief f1 початковий кут в градусах
*/
qreal f1; // початковий кут нахилу дуги (градуси)
/**
* @brief formulaF1
*/
2013-10-27 11:22:44 +01:00
QString formulaF1;
2013-08-05 10:37:56 +02:00
/**
* @brief f2 кінцевий кут в градусах
*/
qreal f2; // кінцевий кут нахилу дуги (градуси)
/**
* @brief formulaF2
*/
2013-10-27 11:22:44 +01:00
QString formulaF2;
2013-08-05 10:37:56 +02:00
/**
* @brief radius радіус дуги.
*/
2013-10-27 11:22:44 +01:00
qreal radius;
/**
* @brief formulaRadius
*/
2013-10-27 11:22:44 +01:00
QString formulaRadius;
2013-08-05 10:37:56 +02:00
/**
* @brief center центральна точка дуги.
*/
VPointF center;
2013-08-05 10:37:56 +02:00
};
#endif // VARC_H