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
|
2013-11-15 13:41:26 +01:00
|
|
|
|
** @author Roman Telezhinsky <dismine@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
|
|
|
|
|
** 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.
|
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
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
#include "vspline.h"
|
2013-11-12 13:48:45 +01:00
|
|
|
|
class QString;
|
|
|
|
|
class QLineF;
|
|
|
|
|
class QPainterPath;
|
|
|
|
|
class QPointF;
|
2013-08-05 10:37:56 +02:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief VArc клас, що реалізує дугу. Дуга розраховується за годиниковою стрілкою.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
class VArc
|
|
|
|
|
{
|
2013-10-10 20:45:58 +02:00
|
|
|
|
Q_DECLARE_TR_FUNCTIONS(VArc)
|
2013-08-05 10:37:56 +02:00
|
|
|
|
public:
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief VArc конструктор по замовчуванню.
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
VArc ();
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief VArc конструктор.
|
|
|
|
|
* @param center точка центру.
|
|
|
|
|
* @param radius радіус.
|
|
|
|
|
* @param f1 початковий кут в градусах.
|
|
|
|
|
* @param f2 кінцевий кут в градусах.
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
VArc (const QHash<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
|
2013-11-04 21:35:15 +01:00
|
|
|
|
qreal f1, QString formulaF1, qreal f2, QString formulaF2,
|
2013-10-27 11:22:44 +01:00
|
|
|
|
Draw::Draws mode = Draw::Calculation, qint64 idObject = 0);
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief VArc
|
|
|
|
|
* @param arc
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
VArc(const VArc &arc);
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @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;}
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @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;}
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @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 повертає довжину дуги.
|
|
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
|
inline qreal GetLength () const {return M_PI * radius/180 * (f2-f1);}
|
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;}
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @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 повертає точку центра дуги.
|
|
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
|
inline qint64 GetCenter () const {return center;}
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetCenterPoint
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
|
QPointF GetCenterPoint() const;
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetCenterVPoint
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2013-11-12 13:48:45 +01:00
|
|
|
|
VPointF GetCenterVPoint() const;
|
2013-08-05 10:37:56 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetP1 повертає першу точку з якої починається дуга.
|
|
|
|
|
* @return точку початку дуги.
|
|
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
|
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-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetDataPoints
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2013-10-10 20:45:58 +02:00
|
|
|
|
const QHash<qint64, VPointF> GetDataPoints() const;
|
2013-08-05 10:37:56 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetPath будує шлях по даній дузі.
|
|
|
|
|
* @return повертає шлях.
|
|
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
|
QPainterPath GetPath() const;
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief AngleArc
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
|
qreal AngleArc() const;
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief NumberSplOfArc
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
|
qint32 NumberSplOfArc () const;
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetPoints
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
|
QVector<QPointF> GetPoints () const;
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief SplOfArc
|
|
|
|
|
* @param number
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
|
QVector<QPointF> SplOfArc( qint32 number ) const;
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief getMode
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
|
inline Draw::Draws getMode() const {return mode;}
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief setMode
|
|
|
|
|
* @param value
|
|
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
|
inline void setMode(const Draw::Draws &value) {mode = value;}
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief getIdObject
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
|
inline qint64 getIdObject() const {return idObject;}
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief setIdObject
|
|
|
|
|
* @param value
|
|
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
|
inline void setIdObject(const qint64 &value) {idObject = value;}
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief name
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2013-11-12 13:48:45 +01:00
|
|
|
|
QString name() const {return _name;}
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief setName
|
|
|
|
|
* @param name
|
|
|
|
|
*/
|
2013-11-12 13:48:45 +01:00
|
|
|
|
void setName(const QString &name) {_name = name;}
|
2013-08-05 10:37:56 +02:00
|
|
|
|
private:
|
|
|
|
|
/**
|
|
|
|
|
* @brief f1 початковий кут в градусах
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
qreal f1; // початковий кут нахилу дуги (градуси)
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief formulaF1
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
QString formulaF1;
|
2013-08-05 10:37:56 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief f2 кінцевий кут в градусах
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
qreal f2; // кінцевий кут нахилу дуги (градуси)
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @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;
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief formulaRadius
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
QString formulaRadius;
|
2013-08-05 10:37:56 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief center центральна точка дуги.
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
qint64 center;
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief points
|
|
|
|
|
*/
|
2013-10-10 20:45:58 +02:00
|
|
|
|
QHash<qint64, VPointF> points;
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief mode
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
Draw::Draws mode;
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief idObject
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
qint64 idObject;
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief _name
|
|
|
|
|
*/
|
2013-11-12 13:48:45 +01:00
|
|
|
|
QString _name;
|
2013-08-05 10:37:56 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // VARC_H
|