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.cpp
|
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
|
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2013-11-15 13:41:26 +01:00
|
|
|
|
** <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
|
|
|
|
#include "varc.h"
|
2014-08-20 14:23:21 +02:00
|
|
|
|
#include "varc_p.h"
|
2014-04-17 19:18:26 +02:00
|
|
|
|
#include <QDebug>
|
2014-06-17 11:50:11 +02:00
|
|
|
|
#include <QLineF>
|
|
|
|
|
#include <QPainterPath>
|
|
|
|
|
#include <QPointF>
|
2014-10-04 22:11:30 +02:00
|
|
|
|
#include <QtCore/qmath.h>
|
2013-08-05 10:37:56 +02:00
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief VArc default constructor.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
VArc::VArc ()
|
2014-08-20 14:23:21 +02:00
|
|
|
|
:VAbstractCurve(GOType::Arc), d (new VArcData)
|
2014-05-02 13:11:30 +02:00
|
|
|
|
{}
|
2013-08-05 10:37:56 +02:00
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief VArc constructor.
|
|
|
|
|
* @param center center point.
|
|
|
|
|
* @param radius arc radius.
|
|
|
|
|
* @param f1 start angle (degree).
|
|
|
|
|
* @param f2 end angle (degree).
|
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
|
VArc::VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2,
|
2014-06-12 09:22:29 +02:00
|
|
|
|
QString formulaF2, quint32 idObject, Draw mode)
|
2014-08-20 14:23:21 +02:00
|
|
|
|
: VAbstractCurve(GOType::Arc, idObject, mode),
|
|
|
|
|
d (new VArcData(center, radius, formulaRadius, f1, formulaF1, f2, formulaF2))
|
2013-11-12 13:48:45 +01:00
|
|
|
|
{
|
2015-06-09 12:21:10 +02:00
|
|
|
|
ArcName();
|
2013-11-12 13:48:45 +01:00
|
|
|
|
}
|
2013-08-13 18:48:36 +02:00
|
|
|
|
|
2014-08-15 15:54:24 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
VArc::VArc(VPointF center, qreal radius, qreal f1, qreal f2)
|
2014-08-20 14:23:21 +02:00
|
|
|
|
: VAbstractCurve(GOType::Arc, NULL_ID, Draw::Calculation), d (new VArcData(center, radius, f1, f2))
|
2014-08-15 15:54:24 +02:00
|
|
|
|
{
|
2015-06-09 12:21:10 +02:00
|
|
|
|
ArcName();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
VArc::VArc(qreal length, QString formulaLength, VPointF center, qreal radius, QString formulaRadius, qreal f1,
|
|
|
|
|
QString formulaF1, quint32 idObject, Draw mode)
|
|
|
|
|
: VAbstractCurve(GOType::Arc, idObject, mode),
|
|
|
|
|
d (new VArcData(formulaLength, center, radius, formulaRadius, f1, formulaF1))
|
|
|
|
|
{
|
|
|
|
|
ArcName();
|
|
|
|
|
FindF2(length);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
VArc::VArc(qreal length, VPointF center, qreal radius, qreal f1)
|
|
|
|
|
: VAbstractCurve(GOType::Arc, NULL_ID, Draw::Calculation), d (new VArcData(center, radius, f1))
|
|
|
|
|
{
|
|
|
|
|
ArcName();
|
|
|
|
|
FindF2(length);
|
2014-08-15 15:54:24 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief VArc copy constructor
|
|
|
|
|
* @param arc arc
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
VArc::VArc(const VArc &arc)
|
2014-08-20 14:23:21 +02:00
|
|
|
|
: VAbstractCurve(arc), d (arc.d)
|
2014-05-02 13:11:30 +02:00
|
|
|
|
{}
|
2013-08-13 18:48:36 +02:00
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief operator = assignment operator
|
|
|
|
|
* @param arc arc
|
|
|
|
|
* @return arc
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
VArc &VArc::operator =(const VArc &arc)
|
|
|
|
|
{
|
2014-07-27 14:30:28 +02:00
|
|
|
|
if ( &arc == this )
|
|
|
|
|
{
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
2014-06-25 16:08:12 +02:00
|
|
|
|
VAbstractCurve::operator=(arc);
|
2014-08-20 14:23:21 +02:00
|
|
|
|
d = arc.d;
|
2013-08-13 18:48:36 +02:00
|
|
|
|
return *this;
|
2013-08-05 10:37:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-20 14:23:21 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
VArc::~VArc()
|
|
|
|
|
{}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetLength return arc length.
|
|
|
|
|
* @return length.
|
|
|
|
|
*/
|
2014-01-10 10:16:55 +01:00
|
|
|
|
qreal VArc::GetLength() const
|
|
|
|
|
{
|
2015-06-09 12:21:10 +02:00
|
|
|
|
qreal length = (M_PI * d->radius)/180 * AngleArc();
|
|
|
|
|
if (d->isFlipped)
|
|
|
|
|
{
|
|
|
|
|
length = length * -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return length;
|
2014-01-10 10:16:55 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetP1 return point associated with start angle.
|
|
|
|
|
* @return point.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
QPointF VArc::GetP1() const
|
|
|
|
|
{
|
2014-08-20 14:23:21 +02:00
|
|
|
|
QPointF p1 ( GetCenter().x () + d->radius, GetCenter().y () );
|
2013-12-29 17:48:57 +01:00
|
|
|
|
QLineF centerP1(GetCenter().toQPointF(), p1);
|
2014-08-20 14:23:21 +02:00
|
|
|
|
centerP1.setAngle(d->f1);
|
2013-08-06 09:56:09 +02:00
|
|
|
|
return centerP1.p2();
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetP2 return point associated with end angle.
|
|
|
|
|
* @return точку point.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
QPointF VArc::GetP2 () const
|
|
|
|
|
{
|
2014-08-20 14:23:21 +02:00
|
|
|
|
QPointF p2 ( GetCenter().x () + d->radius, GetCenter().y () );
|
2013-12-29 17:48:57 +01:00
|
|
|
|
QLineF centerP2(GetCenter().toQPointF(), p2);
|
2014-08-20 14:23:21 +02:00
|
|
|
|
centerP2.setAngle(d->f2);
|
2013-08-06 09:56:09 +02:00
|
|
|
|
return centerP2.p2();
|
2013-08-05 10:37:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief AngleArc calculate arc angle.
|
|
|
|
|
* @return angle in degree.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
qreal VArc::AngleArc() const
|
|
|
|
|
{
|
2014-11-21 08:54:12 +01:00
|
|
|
|
if ((qFuzzyCompare(d->f1+1, 0+1) && qFuzzyCompare(d->f2, 360)) ||
|
|
|
|
|
(qFuzzyCompare(d->f1, 360) && qFuzzyCompare(d->f2+1, 0+1)))
|
|
|
|
|
{
|
|
|
|
|
return 360;
|
|
|
|
|
}
|
2013-11-04 21:35:15 +01:00
|
|
|
|
QLineF l1(0, 0, 100, 100);
|
2014-08-20 14:23:21 +02:00
|
|
|
|
l1.setAngle(d->f1);
|
2013-11-04 21:35:15 +01:00
|
|
|
|
QLineF l2(0, 0, 100, 100);
|
2014-08-20 14:23:21 +02:00
|
|
|
|
l2.setAngle(d->f2);
|
2015-06-09 12:21:10 +02:00
|
|
|
|
|
|
|
|
|
qreal ang = l1.angleTo(l2);
|
|
|
|
|
|
|
|
|
|
if (d->isFlipped)
|
|
|
|
|
{
|
|
|
|
|
ang = 360 - ang;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ang;
|
2013-08-28 10:55:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetPoints return list of points needed for drawing arc.
|
|
|
|
|
* @return list of points
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
QVector<QPointF> VArc::GetPoints() const
|
|
|
|
|
{
|
2013-08-28 10:55:11 +02:00
|
|
|
|
QVector<QPointF> points;
|
2014-01-10 10:16:55 +01:00
|
|
|
|
qreal i = 0;
|
2015-06-09 12:21:10 +02:00
|
|
|
|
const qreal angle = AngleArc();
|
|
|
|
|
const qint32 k = static_cast<qint32>(angle);
|
|
|
|
|
const qreal s = angle/(k/4);
|
2014-01-10 10:16:55 +01:00
|
|
|
|
do
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2015-06-09 12:21:10 +02:00
|
|
|
|
QPointF pStart;
|
|
|
|
|
if (d->isFlipped)
|
|
|
|
|
{
|
|
|
|
|
pStart = GetP2();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pStart = GetP1();
|
|
|
|
|
}
|
|
|
|
|
QLineF line(d->center.toQPointF(), pStart);
|
2014-01-10 10:16:55 +01:00
|
|
|
|
line.setAngle(line.angle()+i);
|
|
|
|
|
points.append(line.p2());
|
2014-01-11 11:11:42 +01:00
|
|
|
|
i = i + s;
|
2014-01-27 17:01:24 +01:00
|
|
|
|
if (i > angle)
|
2014-01-11 11:11:42 +01:00
|
|
|
|
{
|
2015-06-09 12:21:10 +02:00
|
|
|
|
QLineF line(d->center.toQPointF(), pStart);
|
2014-01-11 11:11:42 +01:00
|
|
|
|
line.setAngle(line.angle()+angle);
|
|
|
|
|
points.append(line.p2());
|
|
|
|
|
}
|
2014-01-27 17:01:24 +01:00
|
|
|
|
} while (i <= angle);
|
2015-06-09 20:23:37 +02:00
|
|
|
|
return points;
|
2013-08-28 10:55:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief CutArc cut arc into two arcs.
|
|
|
|
|
* @param length length first arc.
|
|
|
|
|
* @param arc1 first arc.
|
|
|
|
|
* @param arc2 second arc.
|
|
|
|
|
* @return point cutting
|
|
|
|
|
*/
|
2014-01-08 15:05:32 +01:00
|
|
|
|
QPointF VArc::CutArc(const qreal &length, VArc &arc1, VArc &arc2) const
|
|
|
|
|
{
|
|
|
|
|
//Always need return two arcs, so we must correct wrong length.
|
|
|
|
|
qreal len = 0;
|
|
|
|
|
if (length < this->GetLength()*0.02)
|
|
|
|
|
{
|
|
|
|
|
len = this->GetLength()*0.02;
|
|
|
|
|
}
|
|
|
|
|
else if ( length > this->GetLength()*0.98)
|
|
|
|
|
{
|
|
|
|
|
len = this->GetLength()*0.98;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
len = length;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-20 14:23:21 +02:00
|
|
|
|
qreal n = (len*180)/(M_PI*d->radius);
|
2014-01-08 15:05:32 +01:00
|
|
|
|
QLineF line(GetCenter().toQPointF(), GetP1());
|
|
|
|
|
line.setAngle(line.angle()+n);
|
|
|
|
|
|
2014-08-20 14:23:21 +02:00
|
|
|
|
arc1 = VArc (d->center, d->radius, d->formulaRadius, d->f1, d->formulaF1, line.angle(),
|
|
|
|
|
QString().setNum(line.angle()), getIdObject(), getMode());
|
2014-01-08 15:05:32 +01:00
|
|
|
|
|
2014-08-20 14:23:21 +02:00
|
|
|
|
arc2 = VArc (d->center, d->radius, d->formulaRadius, line.angle(), QString().setNum(line.angle()), d->f2,
|
|
|
|
|
d->formulaF2, getIdObject(), getMode());
|
2014-01-10 10:16:55 +01:00
|
|
|
|
return line.p2();
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-15 16:37:22 +02:00
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
QPointF VArc::CutArc(const qreal &length) const
|
|
|
|
|
{
|
|
|
|
|
VArc arc1;
|
|
|
|
|
VArc arc2;
|
|
|
|
|
return this->CutArc(length, arc1, arc2);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief setId keep id arc in data.
|
|
|
|
|
* @param id id arc in data.
|
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
|
void VArc::setId(const quint32 &id)
|
2014-01-10 10:16:55 +01:00
|
|
|
|
{
|
2014-08-20 14:01:35 +02:00
|
|
|
|
VAbstractCurve::setId(id);
|
2014-08-20 14:23:21 +02:00
|
|
|
|
setName(QString (arc_+"%1_%2").arg(d->center.name()).arg(id));
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-09 12:21:10 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VArc::ArcName()
|
|
|
|
|
{
|
|
|
|
|
setName(QString (arc_+"%1").arg(this->GetCenter().name()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VArc::FindF2(qreal length)
|
|
|
|
|
{
|
|
|
|
|
length < 0 ? d->isFlipped = true : d->isFlipped = false;
|
|
|
|
|
|
|
|
|
|
if (length >= MaxLength())
|
|
|
|
|
{
|
|
|
|
|
length = MaxLength();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qreal arcAngle = (qAbs(length)*180)/(M_PI*d->radius);
|
|
|
|
|
|
|
|
|
|
if (d->isFlipped)
|
|
|
|
|
{
|
|
|
|
|
arcAngle = arcAngle * -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QLineF startAngle(0, 0, 100, 0);
|
|
|
|
|
startAngle.setAngle(d->f1 + arcAngle);// We use QLineF just because it is easy way correct angle value
|
|
|
|
|
|
|
|
|
|
d->f2 = startAngle.angle();
|
|
|
|
|
d->formulaF2 = QString("%1").arg(d->f2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
qreal VArc::MaxLength() const
|
|
|
|
|
{
|
|
|
|
|
return 2*M_PI*d->radius;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-20 14:23:21 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief GetF1 return start angle.
|
|
|
|
|
* @return angle in degree.
|
|
|
|
|
*/
|
|
|
|
|
QString VArc::GetFormulaF1() const
|
|
|
|
|
{
|
|
|
|
|
return d->formulaF1;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-01 16:34:45 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-05-07 14:31:53 +02:00
|
|
|
|
void VArc::SetFormulaF1(const QString &formula, qreal value)
|
2014-09-01 16:34:45 +02:00
|
|
|
|
{
|
2015-05-07 14:31:53 +02:00
|
|
|
|
d->formulaF1 = formula;
|
|
|
|
|
d->f1 = value;
|
2014-09-01 16:34:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-20 14:23:21 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief GetF1 return formula for start angle.
|
|
|
|
|
* @return string with formula.
|
|
|
|
|
*/
|
2015-06-02 15:53:19 +02:00
|
|
|
|
qreal VArc::GetStartAngle() const
|
2014-08-20 14:23:21 +02:00
|
|
|
|
{
|
|
|
|
|
return d->f1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief GetF2 return end angle.
|
|
|
|
|
* @return angle in degree.
|
|
|
|
|
*/
|
|
|
|
|
QString VArc::GetFormulaF2() const
|
|
|
|
|
{
|
|
|
|
|
return d->formulaF2;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-01 16:34:45 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-05-07 14:31:53 +02:00
|
|
|
|
void VArc::SetFormulaF2(const QString &formula, qreal value)
|
2014-09-01 16:34:45 +02:00
|
|
|
|
{
|
2015-05-07 14:31:53 +02:00
|
|
|
|
d->formulaF2 = formula;
|
|
|
|
|
d->f2 = value;
|
2014-09-01 16:34:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-20 14:23:21 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief GetF2 return formula for end angle.
|
|
|
|
|
* @return string with formula.
|
|
|
|
|
*/
|
2015-06-02 15:53:19 +02:00
|
|
|
|
qreal VArc::GetEndAngle() const
|
2014-08-20 14:23:21 +02:00
|
|
|
|
{
|
|
|
|
|
return d->f2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief GetRadius return arc radius.
|
|
|
|
|
* @return radius.
|
|
|
|
|
*/
|
|
|
|
|
QString VArc::GetFormulaRadius() const
|
|
|
|
|
{
|
|
|
|
|
return d->formulaRadius;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-01 16:34:45 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-05-07 14:31:53 +02:00
|
|
|
|
void VArc::SetFormulaRadius(const QString &formula, qreal value)
|
2014-09-01 16:34:45 +02:00
|
|
|
|
{
|
2015-05-07 14:31:53 +02:00
|
|
|
|
d->formulaRadius = formula;
|
|
|
|
|
d->radius = value;
|
2014-09-01 16:34:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-20 14:23:21 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief GetRadius return formula for radius.
|
|
|
|
|
* @return string with formula.
|
|
|
|
|
*/
|
|
|
|
|
qreal VArc::GetRadius() const
|
|
|
|
|
{
|
|
|
|
|
return d->radius;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief GetCenter return center point.
|
|
|
|
|
* @return center point.
|
|
|
|
|
*/
|
|
|
|
|
VPointF VArc::GetCenter() const
|
|
|
|
|
{
|
|
|
|
|
return d->center;
|
2014-01-08 15:05:32 +01:00
|
|
|
|
}
|
2014-09-01 16:34:45 +02:00
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VArc::SetCenter(const VPointF &value)
|
|
|
|
|
{
|
|
|
|
|
d->center = value;
|
|
|
|
|
}
|
2015-06-09 12:21:10 +02:00
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
QString VArc::GetFormulaLength() const
|
|
|
|
|
{
|
|
|
|
|
return d->formulaLength;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VArc::SetFormulaLength(const QString &formula, qreal value)
|
|
|
|
|
{
|
|
|
|
|
d->formulaLength = formula;
|
|
|
|
|
FindF2(value);
|
|
|
|
|
}
|