Refactoring. Use conversion operator for conversion VPointF to QPointF.
--HG-- branch : feature
This commit is contained in:
parent
95a7553741
commit
6187f16c6a
|
@ -1291,8 +1291,7 @@ void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &par
|
|||
Q_UNUSED(e);
|
||||
return;// Just ignore
|
||||
}
|
||||
data->UpdateGObject(id, new VPointF(point->toQPointF(), point->name(), mx, my, idObject,
|
||||
Draw::Modeling));
|
||||
data->UpdateGObject(id, new VPointF(*point, point->name(), mx, my, idObject, Draw::Modeling));
|
||||
VNodePoint::Create(this, data, sceneDetail, id, idObject, parse, Source::FromFile, idTool);
|
||||
}
|
||||
catch (const VExceptionBadId &e)
|
||||
|
|
|
@ -97,7 +97,7 @@ QPointF VAbstractCubicBezier::CutSpline(qreal length, QPointF &spl1p2, QPointF &
|
|||
|
||||
const qreal parT = GetParmT(length);
|
||||
|
||||
QLineF seg1_2 ( GetP1 ().toQPointF(), GetControlPoint1 () );
|
||||
QLineF seg1_2 ( GetP1 (), GetControlPoint1 () );
|
||||
seg1_2.setLength(seg1_2.length () * parT);
|
||||
const QPointF p12 = seg1_2.p2();
|
||||
|
||||
|
@ -109,7 +109,7 @@ QPointF VAbstractCubicBezier::CutSpline(qreal length, QPointF &spl1p2, QPointF &
|
|||
seg12_23.setLength(seg12_23.length () * parT);
|
||||
const QPointF p123 = seg12_23.p2();
|
||||
|
||||
QLineF seg3_4 ( GetControlPoint2 (), GetP4 ().toQPointF() );
|
||||
QLineF seg3_4 ( GetControlPoint2 (), GetP4 () );
|
||||
seg3_4.setLength(seg3_4.length () * parT);
|
||||
const QPointF p34 = seg3_4.p2();
|
||||
|
||||
|
@ -547,7 +547,7 @@ qreal VAbstractCubicBezier::LengthT(qreal t) const
|
|||
qDebug()<<"Wrong value t.";
|
||||
return 0;
|
||||
}
|
||||
QLineF seg1_2 ( GetP1 ().toQPointF(), GetControlPoint1 () );
|
||||
QLineF seg1_2 ( GetP1 (), GetControlPoint1 () );
|
||||
seg1_2.setLength(seg1_2.length () * t);
|
||||
const QPointF p12 = seg1_2.p2();
|
||||
|
||||
|
@ -559,7 +559,7 @@ qreal VAbstractCubicBezier::LengthT(qreal t) const
|
|||
seg12_23.setLength(seg12_23.length () * t);
|
||||
const QPointF p123 = seg12_23.p2();
|
||||
|
||||
QLineF seg3_4 ( GetControlPoint2 (), GetP4 ().toQPointF() );
|
||||
QLineF seg3_4 ( GetControlPoint2 (), GetP4 () );
|
||||
seg3_4.setLength(seg3_4.length () * t);
|
||||
const QPointF p34 = seg3_4.p2();
|
||||
|
||||
|
@ -571,5 +571,5 @@ qreal VAbstractCubicBezier::LengthT(qreal t) const
|
|||
seg123_234.setLength(seg123_234.length () * t);
|
||||
const QPointF p1234 = seg123_234.p2();
|
||||
|
||||
return LengthBezier ( GetP1().toQPointF(), p12, p123, p1234);
|
||||
return LengthBezier ( GetP1(), p12, p123, p1234);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ VArc VArc::Rotate(const QPointF &originPoint, qreal degrees, const QString &pref
|
|||
const QPointF p1 = VPointF::RotatePF(originPoint, GetP1(), degrees);
|
||||
const QPointF p2 = VPointF::RotatePF(originPoint, GetP2(), degrees);
|
||||
|
||||
VArc arc(center, GetRadius(), QLineF(center.toQPointF(), p1).angle(), QLineF(center.toQPointF(), p2).angle());
|
||||
VArc arc(center, GetRadius(), QLineF(center, p1).angle(), QLineF(center, p2).angle());
|
||||
arc.setName(name() + prefix);
|
||||
return arc;
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ qreal VArc::GetLength() const
|
|||
QPointF VArc::GetP1() const
|
||||
{
|
||||
QPointF p1 ( GetCenter().x () + d->radius, GetCenter().y () );
|
||||
QLineF centerP1(GetCenter().toQPointF(), p1);
|
||||
QLineF centerP1(GetCenter(), p1);
|
||||
centerP1.setAngle(GetStartAngle());
|
||||
return centerP1.p2();
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ QPointF VArc::GetP1() const
|
|||
QPointF VArc::GetP2 () const
|
||||
{
|
||||
QPointF p2 ( GetCenter().x () + d->radius, GetCenter().y () );
|
||||
QLineF centerP2(GetCenter().toQPointF(), p2);
|
||||
QLineF centerP2(GetCenter(), p2);
|
||||
centerP2.setAngle(GetEndAngle());
|
||||
return centerP2.p2();
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ QVector<QPointF> VArc::GetPoints() const
|
|||
{
|
||||
const qreal lDistance = GetRadius() * 4.0/3.0 * qTan(qDegreesToRadians(sectionAngle.at(i)) * 0.25);
|
||||
|
||||
const QPointF center = GetCenter().toQPointF();
|
||||
const QPointF center = GetCenter();
|
||||
|
||||
QLineF lineP1P2(pStart, center);
|
||||
lineP1P2.setAngle(lineP1P2.angle() - 90.0);
|
||||
|
@ -286,7 +286,7 @@ QPointF VArc::CutArc(const qreal &length, VArc &arc1, VArc &arc2) const
|
|||
|
||||
qreal n = qRadiansToDegrees(len/d->radius); // n - is angle in degrees
|
||||
|
||||
QLineF line(GetCenter().toQPointF(), GetP1());
|
||||
QLineF line(GetCenter(), GetP1());
|
||||
line.setAngle(line.angle()+n);
|
||||
|
||||
arc1 = VArc (GetCenter(), d->radius, d->formulaRadius, GetStartAngle(), GetFormulaF1(), line.angle(),
|
||||
|
|
|
@ -129,13 +129,13 @@ void VCubicBezier::SetP4(const VPointF &p)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VCubicBezier::GetStartAngle() const
|
||||
{
|
||||
return QLineF(GetP1().toQPointF(), GetP2().toQPointF()).angle();
|
||||
return QLineF(GetP1(), GetP2()).angle();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VCubicBezier::GetEndAngle() const
|
||||
{
|
||||
return QLineF(GetP4().toQPointF(), GetP3().toQPointF()).angle();
|
||||
return QLineF(GetP4(), GetP3()).angle();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -145,7 +145,7 @@ qreal VCubicBezier::GetEndAngle() const
|
|||
*/
|
||||
qreal VCubicBezier::GetLength() const
|
||||
{
|
||||
return LengthBezier (GetP1().toQPointF(), GetP2().toQPointF(), GetP3().toQPointF(), GetP4().toQPointF());
|
||||
return LengthBezier (GetP1(), GetP2(), GetP3(), GetP4());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -155,17 +155,17 @@ qreal VCubicBezier::GetLength() const
|
|||
*/
|
||||
QVector<QPointF> VCubicBezier::GetPoints() const
|
||||
{
|
||||
return GetCubicBezierPoints(GetP1().toQPointF(), GetP2().toQPointF(), GetP3().toQPointF(), GetP4().toQPointF());
|
||||
return GetCubicBezierPoints(GetP1(), GetP2(), GetP3(), GetP4());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPointF VCubicBezier::GetControlPoint1() const
|
||||
{
|
||||
return GetP2().toQPointF();
|
||||
return GetP2();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPointF VCubicBezier::GetControlPoint2() const
|
||||
{
|
||||
return GetP3().toQPointF();
|
||||
return GetP3();
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ const VPointF &VCubicBezierPath::at(int indx) const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VCubicBezierPath::append(const VPointF &point)
|
||||
{
|
||||
if (d->path.size() > 0 && d->path.last().toQPointF() != point.toQPointF())
|
||||
if (d->path.size() > 0 && d->path.last() != point)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -156,18 +156,18 @@ VSpline VCubicBezierPath::GetSpline(qint32 index) const
|
|||
const qint32 base = SubSplOffset(index);
|
||||
|
||||
// Correction the first control point of each next spline curve except for the first.
|
||||
QPointF p2 = d->path.at(base + 1).toQPointF();
|
||||
QPointF p2 = d->path.at(base + 1);
|
||||
if (base + 1 > 1)
|
||||
{
|
||||
const QPointF b = d->path.at(base).toQPointF();
|
||||
QLineF foot1(b, d->path.at(base - 1).toQPointF());
|
||||
const QPointF b = d->path.at(base);
|
||||
QLineF foot1(b, d->path.at(base - 1));
|
||||
QLineF foot2(b, p2);
|
||||
|
||||
foot2.setAngle(foot1.angle() + 180);
|
||||
p2 = foot2.p2();
|
||||
}
|
||||
|
||||
VSpline spl(d->path.at(base), p2, d->path.at(base + 2).toQPointF(), d->path.at(base + 3));
|
||||
VSpline spl(d->path.at(base), p2, d->path.at(base + 2), d->path.at(base + 3));
|
||||
return spl;
|
||||
}
|
||||
|
||||
|
|
|
@ -122,8 +122,8 @@ VEllipticalArc VEllipticalArc::Rotate(const QPointF &originPoint, qreal degrees,
|
|||
const VPointF center = GetCenter().Rotate(originPoint, degrees);
|
||||
const QPointF p1 = VPointF::RotatePF(originPoint, GetP1(), degrees);
|
||||
const QPointF p2 = VPointF::RotatePF(originPoint, GetP2(), degrees);
|
||||
const qreal f1 = QLineF(center.toQPointF(), p1).angle() - GetRotationAngle();
|
||||
const qreal f2 = QLineF(center.toQPointF(), p2).angle() - GetRotationAngle();
|
||||
const qreal f1 = QLineF(center, p1).angle() - GetRotationAngle();
|
||||
const qreal f2 = QLineF(center, p2).angle() - GetRotationAngle();
|
||||
VEllipticalArc elArc(center, GetRadius1(), GetRadius2(), f1, f2, GetRotationAngle());
|
||||
elArc.setName(name() + prefix);
|
||||
return elArc;
|
||||
|
@ -246,7 +246,7 @@ QPointF VEllipticalArc::GetPoint (qreal angle) const
|
|||
|
||||
QPointF p (GetCenter().x() + x, GetCenter().y() + y);
|
||||
// rotation of point
|
||||
QLineF line(GetCenter().toQPointF(), p);
|
||||
QLineF line(GetCenter(), p);
|
||||
line.setAngle(line.angle() + GetRotationAngle());
|
||||
|
||||
return line.p2();
|
||||
|
|
|
@ -100,6 +100,18 @@ VPointF &VPointF::operator =(const VPointF &point)
|
|||
return *this;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPointF::operator const QPointF() const
|
||||
{
|
||||
return toQPointF();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPointF::operator QPointF()
|
||||
{
|
||||
return toQPointF();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPointF VPointF::Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix) const
|
||||
{
|
||||
|
@ -107,16 +119,6 @@ VPointF VPointF::Rotate(const QPointF &originPoint, qreal degrees, const QString
|
|||
return VPointF(p, name() + prefix, mx(), my());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief toQPointF convert to QPointF
|
||||
* @return QPointF point
|
||||
*/
|
||||
QPointF VPointF::toQPointF() const
|
||||
{
|
||||
return QPointF(d->_x, d->_y);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief mx return offset name respect to x
|
||||
|
@ -157,6 +159,12 @@ void VPointF::setMy(qreal my)
|
|||
d->_my = my;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPointF VPointF::toQPointF() const
|
||||
{
|
||||
return QPointF(d->_x, d->_y);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief x return x coordinate
|
||||
|
|
|
@ -58,6 +58,8 @@ public:
|
|||
const Draw &mode = Draw::Calculation);
|
||||
virtual ~VPointF() Q_DECL_OVERRIDE;
|
||||
VPointF &operator=(const VPointF &point);
|
||||
operator QPointF();
|
||||
operator const QPointF() const;
|
||||
VPointF Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix = QString()) const;
|
||||
qreal mx() const;
|
||||
qreal my() const;
|
||||
|
|
|
@ -132,7 +132,7 @@ VSpline::~VSpline()
|
|||
*/
|
||||
qreal VSpline::GetLength () const
|
||||
{
|
||||
return LengthBezier ( GetP1().toQPointF(), GetP2(), GetP3(), GetP4().toQPointF());
|
||||
return LengthBezier ( GetP1(), GetP2(), GetP3(), GetP4());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -156,7 +156,7 @@ QPointF VSpline::CutSpline(qreal length, VSpline &spl1, VSpline &spl2) const
|
|||
*/
|
||||
QVector<QPointF> VSpline::GetPoints () const
|
||||
{
|
||||
return GetCubicBezierPoints(GetP1().toQPointF(), GetP2(), GetP3(), GetP4().toQPointF());
|
||||
return GetCubicBezierPoints(GetP1(), GetP2(), GetP3(), GetP4());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -348,7 +348,7 @@ void VSpline::SetC2Length(qreal length, const QString &formula)
|
|||
*/
|
||||
qreal VSpline::GetKasm1() const
|
||||
{
|
||||
return QLineF(d->p1.toQPointF(), GetP2()).length() / VSplineData::GetL(d->p1.toQPointF(), d->p4.toQPointF(),
|
||||
return QLineF(d->p1, GetP2()).length() / VSplineData::GetL(d->p1, d->p4,
|
||||
d->kCurve);
|
||||
}
|
||||
|
||||
|
@ -359,7 +359,7 @@ qreal VSpline::GetKasm1() const
|
|||
*/
|
||||
qreal VSpline::GetKasm2() const
|
||||
{
|
||||
return QLineF(d->p4.toQPointF(), GetP3()).length() / VSplineData::GetL(d->p1.toQPointF(), d->p4.toQPointF(),
|
||||
return QLineF(d->p4, GetP3()).length() / VSplineData::GetL(d->p1, d->p4,
|
||||
d->kCurve);
|
||||
}
|
||||
|
||||
|
@ -469,8 +469,8 @@ qreal VSpline::ParamT (const QPointF &pBt) const
|
|||
{
|
||||
QVector<qreal> ts;
|
||||
// Calculate t coefficient for each axis
|
||||
ts += CalcT (GetP1().toQPointF().x(), GetP2().x(), GetP3().x(), GetP4().toQPointF().x(), pBt.x());
|
||||
ts += CalcT (GetP1().toQPointF().y(), GetP2().y(), GetP3().y(), GetP4().toQPointF().y(), pBt.y());
|
||||
ts += CalcT (GetP1().x(), GetP2().x(), GetP3().x(), GetP4().x(), pBt.x());
|
||||
ts += CalcT (GetP1().y(), GetP2().y(), GetP3().y(), GetP4().y(), pBt.y());
|
||||
|
||||
if (ts.isEmpty())
|
||||
{
|
||||
|
@ -485,10 +485,10 @@ qreal VSpline::ParamT (const QPointF &pBt) const
|
|||
for (int i=0; i< ts.size(); ++i)
|
||||
{
|
||||
const qreal t = ts.at(i);
|
||||
const QPointF p0 = GetP1().toQPointF();
|
||||
const QPointF p0 = GetP1();
|
||||
const QPointF p1 = GetP2();
|
||||
const QPointF p2 = GetP3();
|
||||
const QPointF p3 = GetP4().toQPointF();
|
||||
const QPointF p3 = GetP4();
|
||||
//The explicit form of the Cubic Bézier curve
|
||||
const qreal pointX = pow(1-t, 3)*p0.x() + 3*pow(1-t, 2)*t*p1.x() + 3*(1-t)*pow(t, 2)*p2.x() + pow(t, 3)*p3.x();
|
||||
const qreal pointY = pow(1-t, 3)*p0.y() + 3*pow(1-t, 2)*t*p1.y() + 3*(1-t)*pow(t, 2)*p2.y() + pow(t, 3)*p3.y();
|
||||
|
|
|
@ -136,7 +136,7 @@ VSplineData::VSplineData(VPointF p1, VPointF p4, qreal angle1, qreal angle2, qre
|
|||
c2LengthF("0"),
|
||||
kCurve(kCurve)
|
||||
{
|
||||
const qreal L = GetL(p1.toQPointF(), p4.toQPointF(), kCurve);
|
||||
const qreal L = GetL(p1, p4, kCurve);
|
||||
|
||||
QLineF p1p2(p1.x(), p1.y(), p1.x() + L * kAsm1, p1.y());
|
||||
p1p2.setAngle(angle1);
|
||||
|
@ -163,7 +163,7 @@ VSplineData::VSplineData(VPointF p1, QPointF p2, QPointF p3, VPointF p4)
|
|||
c2LengthF("0"),
|
||||
kCurve(1)
|
||||
{
|
||||
QLineF p1p2(p1.toQPointF(), p2);
|
||||
QLineF p1p2(p1, p2);
|
||||
|
||||
angle1 = p1p2.angle();
|
||||
angle1F = QString().number(angle1);
|
||||
|
@ -171,7 +171,7 @@ VSplineData::VSplineData(VPointF p1, QPointF p2, QPointF p3, VPointF p4)
|
|||
c1Length = p1p2.length();
|
||||
c1LengthF = QString().number(qApp->fromPixel(c1Length));
|
||||
|
||||
QLineF p4p3(p4.toQPointF(), p3);
|
||||
QLineF p4p3(p4, p3);
|
||||
|
||||
angle2 = p4p3.angle();
|
||||
angle2F = QString().number(angle2);
|
||||
|
|
|
@ -136,7 +136,7 @@ VSplinePath::~VSplinePath()
|
|||
*/
|
||||
void VSplinePath::append(const VSplinePoint &point)
|
||||
{
|
||||
if (d->path.size() > 0 && d->path.last().P().toQPointF() == point.P().toQPointF()) //-V807
|
||||
if (d->path.size() > 0 && d->path.last().P() == point.P()) //-V807
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ void VLineAngle::SetValue(const VPointF *p1, const VPointF *p2)
|
|||
SCASSERT(p1 != nullptr);
|
||||
SCASSERT(p2 != nullptr);
|
||||
//Correct angle. Try avoid results like 6,7563e-15.
|
||||
const qreal angle = qFloor(QLineF(p1->toQPointF(), p2->toQPointF()).angle() * 100000.) / 100000.;
|
||||
const qreal angle = qFloor(QLineF(*p1, *p2).angle() * 100000.) / 100000.;
|
||||
VInternalVariable::SetValue(angle);
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ void VLengthLine::SetValue(const VPointF *p1, const VPointF *p2)
|
|||
SCASSERT(p1 != nullptr);
|
||||
SCASSERT(p2 != nullptr);
|
||||
|
||||
VInternalVariable::SetValue(FromPixel(QLineF(p1->toQPointF(), p2->toQPointF()).length(), d->patternUnit));
|
||||
VInternalVariable::SetValue(FromPixel(QLineF(*p1, *p2).length(), d->patternUnit));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -371,7 +371,7 @@ QVector<QPointF> VDetail::ContourPoints(const VContainer *data) const
|
|||
case (Tool::NodePoint):
|
||||
{
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(at(i).getId());
|
||||
points.append(point->toQPointF());
|
||||
points.append(*point);
|
||||
}
|
||||
break;
|
||||
case (Tool::NodeArc):
|
||||
|
@ -412,7 +412,7 @@ QVector<QPointF> VDetail::SeamAllowancePoints(const VContainer *data) const
|
|||
case (Tool::NodePoint):
|
||||
{
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(at(i).getId());
|
||||
QPointF pEkv = point->toQPointF();
|
||||
QPointF pEkv = *point;
|
||||
pEkv.setX(pEkv.x()+at(i).getMx());
|
||||
pEkv.setY(pEkv.y()+at(i).getMy());
|
||||
pointsEkv.append(pEkv);
|
||||
|
@ -555,14 +555,14 @@ QPointF VDetail::StartSegment(const VContainer *data, const int &i, bool reverse
|
|||
{
|
||||
if (at(CountNode()-1).getTypeTool() == Tool::NodePoint)
|
||||
{
|
||||
begin = data->GeometricObject<VPointF>(at(CountNode()-1).getId())->toQPointF();
|
||||
begin = *data->GeometricObject<VPointF>(at(CountNode()-1).getId());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (at(i-1).getTypeTool() == Tool::NodePoint)
|
||||
{
|
||||
begin = data->GeometricObject<VPointF>(at(i-1).getId())->toQPointF();
|
||||
begin = *data->GeometricObject<VPointF>(at(i-1).getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -592,14 +592,14 @@ QPointF VDetail::EndSegment(const VContainer *data, const int &i, bool reverse)
|
|||
{
|
||||
if (at(0).getTypeTool() == Tool::NodePoint)
|
||||
{
|
||||
end = data->GeometricObject<VPointF>(at(0).getId())->toQPointF();
|
||||
end = *data->GeometricObject<VPointF>(at(0).getId());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (at(i+1).getTypeTool() == Tool::NodePoint)
|
||||
{
|
||||
end = data->GeometricObject<VPointF>(at(i+1).getId())->toQPointF();
|
||||
end = *data->GeometricObject<VPointF>(at(i+1).getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
|
|||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
||||
QLineF line = QLineF(*point, scene->getScenePos());
|
||||
|
||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
||||
qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
|
||||
|
|
|
@ -283,7 +283,7 @@ void DialogEndLine::ShowDialog(bool click)
|
|||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
||||
QLineF line = QLineF(*point, scene->getScenePos());
|
||||
|
||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
||||
const qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
|
||||
|
|
|
@ -248,8 +248,7 @@ void DialogHeight::PointNameChanged()
|
|||
const QSharedPointer<VPointF> p2Line = data->GeometricObject<VPointF>(p2LineId);
|
||||
|
||||
QColor color = okColor;
|
||||
if (set.size() != 3 || VGObject::ClosestPoint(QLineF(p1Line->toQPointF(), p2Line->toQPointF()),
|
||||
basePoint->toQPointF()) == QPointF())
|
||||
if (set.size() != 3 || VGObject::ClosestPoint(QLineF(*p1Line, *p2Line), *basePoint) == QPointF())
|
||||
{
|
||||
flagError = false;
|
||||
color = errorColor;
|
||||
|
|
|
@ -215,8 +215,8 @@ void DialogLineIntersect::PointNameChanged()
|
|||
const QSharedPointer<VPointF> p1Line2 = data->GeometricObject<VPointF>(p1Line2Id);
|
||||
const QSharedPointer<VPointF> p2Line2 = data->GeometricObject<VPointF>(p2Line2Id);
|
||||
|
||||
QLineF line1(p1Line1->toQPointF(), p2Line1->toQPointF());
|
||||
QLineF line2(p1Line2->toQPointF(), p2Line2->toQPointF());
|
||||
QLineF line1(*p1Line1, *p2Line1);
|
||||
QLineF line2(*p1Line2, *p2Line2);
|
||||
QPointF fPoint;
|
||||
QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
|
||||
|
||||
|
@ -266,8 +266,8 @@ bool DialogLineIntersect::CheckIntersecion()
|
|||
const QSharedPointer<VPointF> p1L2 = data->GeometricObject<VPointF>(GetP1Line2());
|
||||
const QSharedPointer<VPointF> p2L2 = data->GeometricObject<VPointF>(GetP2Line2());
|
||||
|
||||
QLineF line1(p1L1->toQPointF(), p2L1->toQPointF());
|
||||
QLineF line2(p1L2->toQPointF(), p2L2->toQPointF());
|
||||
QLineF line1(*p1L1, *p2L1);
|
||||
QLineF line2(*p1L2, *p2L2);
|
||||
QPointF fPoint;
|
||||
QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
|
||||
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
|
||||
|
|
|
@ -206,7 +206,7 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
|
|||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
||||
QLineF line = QLineF(*point, scene->getScenePos());
|
||||
|
||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
||||
qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
|
||||
|
|
|
@ -167,7 +167,7 @@ void DialogRotation::ShowDialog(bool click)
|
|||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetOrigPointId());
|
||||
const QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
||||
const QLineF line = QLineF(*point, scene->getScenePos());
|
||||
|
||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
||||
const qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
|
||||
|
|
|
@ -178,7 +178,7 @@ VToolRotation *VToolRotation::Create(const quint32 _id, const quint32 &origin, Q
|
|||
calcAngle = CheckFormula(_id, angle, data);
|
||||
|
||||
const auto originPoint = *data->GeometricObject<VPointF>(origin);
|
||||
const QPointF oPoint = originPoint.toQPointF();
|
||||
const QPointF oPoint = originPoint;
|
||||
|
||||
QVector<DestinationItem> dest = destination;
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ VSpline VAbstractSpline::CorrectedSpline(const VSpline &spline, const SplinePoin
|
|||
VSpline spl;
|
||||
if (position == SplinePointPosition::FirstPoint)
|
||||
{
|
||||
QLineF line(spline.GetP1().toQPointF(), pos);
|
||||
QLineF line(spline.GetP1(), pos);
|
||||
|
||||
qreal newAngle1 = line.angle();
|
||||
QString newAngle1F = QString().setNum(newAngle1);
|
||||
|
@ -277,7 +277,7 @@ VSpline VAbstractSpline::CorrectedSpline(const VSpline &spline, const SplinePoin
|
|||
}
|
||||
else
|
||||
{
|
||||
QLineF line(spline.GetP4().toQPointF(), pos);
|
||||
QLineF line(spline.GetP4(), pos);
|
||||
|
||||
qreal newAngle2 = line.angle();
|
||||
QString newAngle2F = QString().setNum(newAngle2);
|
||||
|
|
|
@ -71,7 +71,7 @@ VToolSpline::VToolSpline(VAbstractPattern *doc, VContainer *data, quint32 id, co
|
|||
const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl->GetC1LengthFormula());
|
||||
|
||||
auto *controlPoint1 = new VControlPointSpline(1, SplinePointPosition::FirstPoint, spl->GetP2(),
|
||||
spl->GetP1().toQPointF(), *data->GetPatternUnit(), freeAngle1,
|
||||
spl->GetP1(), *data->GetPatternUnit(), freeAngle1,
|
||||
freeLength1, this);
|
||||
connect(controlPoint1, &VControlPointSpline::ControlPointChangePosition, this,
|
||||
&VToolSpline::ControlPointChangePosition);
|
||||
|
@ -83,7 +83,7 @@ VToolSpline::VToolSpline(VAbstractPattern *doc, VContainer *data, quint32 id, co
|
|||
const bool freeLength2 = qmu::QmuTokenParser::IsSingle(spl->GetC2LengthFormula());
|
||||
|
||||
auto *controlPoint2 = new VControlPointSpline(1, SplinePointPosition::LastPoint, spl->GetP3(),
|
||||
spl->GetP4().toQPointF(), *data->GetPatternUnit(), freeAngle2,
|
||||
spl->GetP4(), *data->GetPatternUnit(), freeAngle2,
|
||||
freeLength2, this);
|
||||
connect(controlPoint2, &VControlPointSpline::ControlPointChangePosition, this,
|
||||
&VToolSpline::ControlPointChangePosition);
|
||||
|
@ -528,7 +528,7 @@ void VToolSpline::RefreshGeometry()
|
|||
const bool freeAngle1 = qmu::QmuTokenParser::IsSingle(spl->GetStartAngleFormula());
|
||||
const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl->GetC1LengthFormula());
|
||||
|
||||
const QPointF splinePoint = VAbstractTool::data.GeometricObject<VPointF>(spl->GetP1().id())->toQPointF();
|
||||
const QPointF splinePoint = *VAbstractTool::data.GeometricObject<VPointF>(spl->GetP1().id());
|
||||
controlPoints[0]->RefreshCtrlPoint(1, SplinePointPosition::FirstPoint, spl->GetP2(), splinePoint, freeAngle1,
|
||||
freeLength1);
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ void VToolSpline::RefreshGeometry()
|
|||
const bool freeAngle2 = qmu::QmuTokenParser::IsSingle(spl->GetEndAngleFormula());
|
||||
const bool freeLength2 = qmu::QmuTokenParser::IsSingle(spl->GetC2LengthFormula());
|
||||
|
||||
const QPointF splinePoint = VAbstractTool::data.GeometricObject<VPointF>(spl->GetP4().id())->toQPointF();
|
||||
const QPointF splinePoint = *VAbstractTool::data.GeometricObject<VPointF>(spl->GetP4().id());
|
||||
controlPoints[1]->RefreshCtrlPoint(1, SplinePointPosition::LastPoint, spl->GetP3(), splinePoint, freeAngle2,
|
||||
freeLength2);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ VToolSplinePath::VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint3
|
|||
const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl.GetC1LengthFormula());
|
||||
|
||||
auto *controlPoint = new VControlPointSpline(i, SplinePointPosition::FirstPoint, spl.GetP2(),
|
||||
spl.GetP1().toQPointF(), *data->GetPatternUnit(), freeAngle1,
|
||||
spl.GetP1(), *data->GetPatternUnit(), freeAngle1,
|
||||
freeLength1, this);
|
||||
connect(controlPoint, &VControlPointSpline::ControlPointChangePosition, this,
|
||||
&VToolSplinePath::ControlPointChangePosition);
|
||||
|
@ -85,7 +85,7 @@ VToolSplinePath::VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint3
|
|||
const bool freeAngle2 = qmu::QmuTokenParser::IsSingle(spl.GetEndAngleFormula());
|
||||
const bool freeLength2 = qmu::QmuTokenParser::IsSingle(spl.GetC2LengthFormula());
|
||||
|
||||
controlPoint = new VControlPointSpline(i, SplinePointPosition::LastPoint, spl.GetP3(), spl.GetP4().toQPointF(),
|
||||
controlPoint = new VControlPointSpline(i, SplinePointPosition::LastPoint, spl.GetP3(), spl.GetP4(),
|
||||
*data->GetPatternUnit(), freeAngle2, freeLength2, this);
|
||||
connect(controlPoint, &VControlPointSpline::ControlPointChangePosition, this,
|
||||
&VToolSplinePath::ControlPointChangePosition);
|
||||
|
@ -648,7 +648,7 @@ void VToolSplinePath::RefreshGeometry()
|
|||
const bool freeAngle1 = qmu::QmuTokenParser::IsSingle(spl.GetStartAngleFormula());
|
||||
const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl.GetC1LengthFormula());
|
||||
|
||||
const auto splinePoint = spl.GetP1().toQPointF();
|
||||
const auto splinePoint = spl.GetP1();
|
||||
controlPoints[j-2]->RefreshCtrlPoint(i, SplinePointPosition::FirstPoint, spl.GetP2(), splinePoint,
|
||||
freeAngle1, freeLength1);
|
||||
}
|
||||
|
@ -657,7 +657,7 @@ void VToolSplinePath::RefreshGeometry()
|
|||
const bool freeAngle2 = qmu::QmuTokenParser::IsSingle(spl.GetEndAngleFormula());
|
||||
const bool freeLength2 = qmu::QmuTokenParser::IsSingle(spl.GetC2LengthFormula());
|
||||
|
||||
const auto splinePoint = spl.GetP4().toQPointF();
|
||||
const auto splinePoint = spl.GetP4();
|
||||
controlPoints[j-1]->RefreshCtrlPoint(i, SplinePointPosition::LastPoint, spl.GetP3(), splinePoint,
|
||||
freeAngle2, freeLength2);
|
||||
}
|
||||
|
|
|
@ -146,8 +146,7 @@ VToolTrueDarts *VToolTrueDarts::Create(quint32 _id,
|
|||
|
||||
QPointF fPoint1;
|
||||
QPointF fPoint2;
|
||||
VToolTrueDarts::FindPoint(baseLineP1->toQPointF(), baseLineP2->toQPointF(),
|
||||
dartP1->toQPointF(), dartP2->toQPointF(), dartP3->toQPointF(), fPoint1, fPoint2);
|
||||
VToolTrueDarts::FindPoint(*baseLineP1, *baseLineP2, *dartP1, *dartP2, *dartP3, fPoint1, fPoint2);
|
||||
quint32 id = _id;
|
||||
quint32 p1id = _p1id;
|
||||
quint32 p2id = _p2id;
|
||||
|
|
|
@ -248,7 +248,7 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa
|
|||
{
|
||||
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
|
||||
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
|
||||
QLineF line = QLineF(firstPoint->toQPointF(), secondPoint->toQPointF());
|
||||
QLineF line = QLineF(*firstPoint, *secondPoint);
|
||||
|
||||
line.setLength(qApp->toPixel(CheckFormula(_id, formula, data)));
|
||||
|
||||
|
|
|
@ -177,8 +177,7 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const
|
|||
|
||||
const qreal result = CheckFormula(_id, formula, data);
|
||||
|
||||
QPointF fPoint = VToolBisector::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(),
|
||||
thirdPoint->toQPointF(), qApp->toPixel(result));
|
||||
QPointF fPoint = VToolBisector::FindPoint(*firstPoint, *secondPoint, *thirdPoint, qApp->toPixel(result));
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
|
|
|
@ -113,7 +113,7 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(const quint32 _id, cons
|
|||
const qreal angle = CheckFormula(_id, formulaAngle, data);
|
||||
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(curveId);
|
||||
|
||||
const QPointF fPoint = FindPoint(basePoint->toQPointF(), angle, curve);
|
||||
const QPointF fPoint = FindPoint(*basePoint, angle, curve);
|
||||
const qreal segLength = curve->GetLengthByPoint(fPoint);
|
||||
quint32 id = _id;
|
||||
VPointF *p = new VPointF(fPoint, pointName, mx, my);
|
||||
|
|
|
@ -140,7 +140,7 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
|
|||
const Source &typeCreation)
|
||||
{
|
||||
const QSharedPointer<VPointF> basePoint = data->GeometricObject<VPointF>(basePointId);
|
||||
QLineF line = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y()));
|
||||
QLineF line = QLineF(*basePoint, QPointF(basePoint->x()+100, basePoint->y()));
|
||||
|
||||
line.setAngle(CheckFormula(_id, formulaAngle, data)); //First set angle.
|
||||
line.setLength(qApp->toPixel(CheckFormula(_id, formulaLength, data)));
|
||||
|
|
|
@ -131,7 +131,7 @@ VToolHeight* VToolHeight::Create(const quint32 _id, const QString &pointName, co
|
|||
const QSharedPointer<VPointF> p1Line = data->GeometricObject<VPointF>(p1LineId);
|
||||
const QSharedPointer<VPointF> p2Line = data->GeometricObject<VPointF>(p2LineId);
|
||||
|
||||
QPointF pHeight = FindPoint(QLineF(p1Line->toQPointF(), p2Line->toQPointF()), basePoint->toQPointF());
|
||||
QPointF pHeight = FindPoint(QLineF(*p1Line, *p2Line), *basePoint);
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
|
|
|
@ -106,12 +106,12 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(const quint32 _id, const
|
|||
const Source &typeCreation)
|
||||
{
|
||||
const QSharedPointer<VPointF> basePoint = data->GeometricObject<VPointF>(basePointId);
|
||||
QLineF axis = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y()));
|
||||
QLineF axis = QLineF(*basePoint, QPointF(basePoint->x()+100, basePoint->y()));
|
||||
axis.setAngle(CheckFormula(_id, formulaAngle, data));
|
||||
|
||||
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
|
||||
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
|
||||
QLineF line(firstPoint->toQPointF(), secondPoint->toQPointF());
|
||||
QLineF line(*firstPoint, *secondPoint);
|
||||
|
||||
QPointF fPoint = FindPoint(axis, line);
|
||||
quint32 id = _id;
|
||||
|
|
|
@ -51,8 +51,8 @@ VToolLinePoint::VToolLinePoint(VAbstractPattern *doc, VContainer *data, const qu
|
|||
this->typeLine = typeLine;
|
||||
this->lineColor = lineColor;
|
||||
Q_ASSERT_X(basePointId != 0, Q_FUNC_INFO, "basePointId == 0"); //-V654 //-V712
|
||||
QPointF point1 = data->GeometricObject<VPointF>(basePointId)->toQPointF();
|
||||
QPointF point2 = data->GeometricObject<VPointF>(id)->toQPointF();
|
||||
QPointF point1 = *data->GeometricObject<VPointF>(basePointId);
|
||||
QPointF point2 = *data->GeometricObject<VPointF>(id);
|
||||
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
|
||||
mainLine->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
||||
LineStyleToPenStyle(typeLine)));
|
||||
|
@ -75,8 +75,8 @@ void VToolLinePoint::RefreshGeometry()
|
|||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
||||
LineStyleToPenStyle(typeLine)));
|
||||
VToolSinglePoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
|
||||
QPointF point = VDrawTool::data.GeometricObject<VPointF>(id)->toQPointF();
|
||||
QPointF basePoint = VDrawTool::data.GeometricObject<VPointF>(basePointId)->toQPointF();
|
||||
QPointF point = *VDrawTool::data.GeometricObject<VPointF>(id);
|
||||
QPointF basePoint = *VDrawTool::data.GeometricObject<VPointF>(basePointId);
|
||||
mainLine->setLine(QLineF(basePoint - point, QPointF()));
|
||||
}
|
||||
|
||||
|
|
|
@ -137,8 +137,7 @@ VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quin
|
|||
|
||||
const qreal result = CheckFormula(_id, formula, data);
|
||||
|
||||
QPointF fPoint = VToolNormal::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(),
|
||||
qApp->toPixel(result), angle);
|
||||
QPointF fPoint = VToolNormal::FindPoint(*firstPoint, *secondPoint, qApp->toPixel(result), angle);
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
|
|
|
@ -178,8 +178,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formu
|
|||
|
||||
const qreal result = CheckFormula(_id, formula, data);
|
||||
|
||||
QPointF fPoint = VToolShoulderPoint::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(),
|
||||
shoulderPoint->toQPointF(), qApp->toPixel(result));
|
||||
QPointF fPoint = VToolShoulderPoint::FindPoint(*firstPoint, *secondPoint, *shoulderPoint, qApp->toPixel(result));
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
|
|
|
@ -76,7 +76,7 @@ void VToolBasePoint::setDialog()
|
|||
DialogSinglePoint *dialogTool = qobject_cast<DialogSinglePoint*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->SetData(p->name(), p->toQPointF());
|
||||
dialogTool->SetData(p->name(), *p);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -131,8 +131,8 @@ VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, const quint32
|
|||
const QSharedPointer<VPointF> p1Line2 = data->GeometricObject<VPointF>(p1Line2Id);
|
||||
const QSharedPointer<VPointF> p2Line2 = data->GeometricObject<VPointF>(p2Line2Id);
|
||||
|
||||
QLineF line1(p1Line1->toQPointF(), p2Line1->toQPointF());
|
||||
QLineF line2(p1Line2->toQPointF(), p2Line2->toQPointF());
|
||||
QLineF line1(*p1Line1, *p2Line1);
|
||||
QLineF line2(*p1Line2, *p2Line2);
|
||||
QPointF fPoint;
|
||||
QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
|
||||
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
|
||||
|
|
|
@ -88,7 +88,7 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(const quint32 _
|
|||
const VArc arc = *data->GeometricObject<VArc>(arcId);
|
||||
const VPointF tPoint = *data->GeometricObject<VPointF>(tangentPointId);
|
||||
|
||||
const QPointF point = VToolPointFromArcAndTangent::FindPoint(tPoint.toQPointF(), &arc, crossPoint);
|
||||
const QPointF point = VToolPointFromArcAndTangent::FindPoint(tPoint, &arc, crossPoint);
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(const quint32 _
|
|||
QPointF VToolPointFromArcAndTangent::FindPoint(const QPointF &p, const VArc *arc, const CrossCirclesPoint pType)
|
||||
{
|
||||
QPointF p1, p2;
|
||||
const QPointF center = arc->GetCenter().toQPointF();
|
||||
const QPointF center = arc->GetCenter();
|
||||
const qreal radius = arc->GetRadius();
|
||||
const int res = VGObject::ContactPoints (p, center, radius, p1, p2);
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(const qui
|
|||
const VPointF cPoint = *data->GeometricObject<VPointF>(circleCenterId);
|
||||
const VPointF tPoint = *data->GeometricObject<VPointF>(tangentPointId);
|
||||
|
||||
const QPointF point = VToolPointFromCircleAndTangent::FindPoint(tPoint.toQPointF(), cPoint.toQPointF(), radius,
|
||||
const QPointF point = VToolPointFromCircleAndTangent::FindPoint(tPoint, cPoint, radius,
|
||||
crossPoint);
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
|
|
|
@ -193,8 +193,7 @@ VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &rad
|
|||
|
||||
const qreal result = CheckFormula(_id, radius, data);
|
||||
|
||||
QPointF fPoint = VToolPointOfContact::FindPoint(qApp->toPixel(result), centerP->toQPointF(),
|
||||
firstP->toQPointF(), secondP->toQPointF());
|
||||
QPointF fPoint = VToolPointOfContact::FindPoint(qApp->toPixel(result), *centerP, *firstP, *secondP);
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
|
|
|
@ -122,8 +122,8 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(const quint32
|
|||
QPointF VToolPointOfIntersectionArcs::FindPoint(const VArc *arc1, const VArc *arc2, const CrossCirclesPoint pType)
|
||||
{
|
||||
QPointF p1, p2;
|
||||
const QPointF centerArc1 = arc1->GetCenter().toQPointF();
|
||||
const QPointF centerArc2 = arc2->GetCenter().toQPointF();
|
||||
const QPointF centerArc1 = arc1->GetCenter();
|
||||
const QPointF centerArc2 = arc2->GetCenter();
|
||||
const int res = VGObject::IntersectionCircles(centerArc1, arc1->GetRadius(), centerArc2, arc2->GetRadius(), p1, p2);
|
||||
|
||||
QLineF r1Arc1(centerArc1, p1);
|
||||
|
|
|
@ -107,7 +107,7 @@ VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(const q
|
|||
const VPointF c1Point = *data->GeometricObject<VPointF>(firstCircleCenterId);
|
||||
const VPointF c2Point = *data->GeometricObject<VPointF>(secondCircleCenterId);
|
||||
|
||||
const QPointF point = FindPoint(c1Point.toQPointF(), c2Point.toQPointF(), calcC1Radius, calcC2Radius, crossPoint);
|
||||
const QPointF point = FindPoint(c1Point, c2Point, calcC1Radius, calcC2Radius, crossPoint);
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
|
|
|
@ -249,7 +249,7 @@ void VToolSinglePoint::RefreshPointGeometry(const VPointF &point)
|
|||
QRectF rec = QRectF(0, 0, radius*2, radius*2);
|
||||
rec.translate(-rec.center().x(), -rec.center().y());
|
||||
this->setRect(rec);
|
||||
this->setPos(point.toQPointF());
|
||||
this->setPos(point);
|
||||
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||
namePoint->blockSignals(true);
|
||||
QFont font = namePoint->font();
|
||||
|
|
|
@ -130,8 +130,7 @@ VToolTriangle* VToolTriangle::Create(const quint32 _id, const QString &pointName
|
|||
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
|
||||
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
|
||||
|
||||
QPointF point = FindPoint(axisP1->toQPointF(), axisP2->toQPointF(), firstPoint->toQPointF(),
|
||||
secondPoint->toQPointF());
|
||||
QPointF point = FindPoint(*axisP1, *axisP2, *firstPoint, *secondPoint);
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ VToolLine::VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint3
|
|||
//Line
|
||||
const QSharedPointer<VPointF> first = data->GeometricObject<VPointF>(firstPoint);
|
||||
const QSharedPointer<VPointF> second = data->GeometricObject<VPointF>(secondPoint);
|
||||
this->setLine(QLineF(first->toQPointF(), second->toQPointF()));
|
||||
this->setLine(QLineF(*first, *second));
|
||||
this->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
||||
|
@ -503,6 +503,6 @@ void VToolLine::RefreshGeometry()
|
|||
{
|
||||
const QSharedPointer<VPointF> first = VAbstractTool::data.GeometricObject<VPointF>(firstPoint);
|
||||
const QSharedPointer<VPointF> second = VAbstractTool::data.GeometricObject<VPointF>(secondPoint);
|
||||
this->setLine(QLineF(first->toQPointF(), second->toQPointF()));
|
||||
this->setLine(QLineF(*first, *second));
|
||||
this->setPen(QPen(CorrectColor(lineColor), pen().widthF(), LineStyleToPenStyle(typeLine)));
|
||||
}
|
||||
|
|
|
@ -317,7 +317,7 @@ void VNodePoint::RefreshPointGeometry(const VPointF &point)
|
|||
QRectF rec = QRectF(0, 0, radius*2, radius*2);
|
||||
rec.translate(-rec.center().x(), -rec.center().y());
|
||||
this->setRect(rec);
|
||||
this->setPos(point.toQPointF());
|
||||
this->setPos(point);
|
||||
|
||||
namePoint->blockSignals(true);
|
||||
namePoint->setText(point.name());
|
||||
|
|
|
@ -119,8 +119,7 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
|||
{
|
||||
VPointF *point = new VPointF(*data->GeometricObject<VPointF>(det.at(i).getId()));
|
||||
point->setMode(Draw::Modeling);
|
||||
BiasRotatePoint(point, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
|
||||
angle);
|
||||
BiasRotatePoint(point, dx, dy, *data->GeometricObject<VPointF>(pRotate), angle);
|
||||
idObject = data->AddGObject(point);
|
||||
children.append(idObject);
|
||||
VPointF *point1 = new VPointF(*point);
|
||||
|
@ -138,7 +137,7 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
|||
}
|
||||
else
|
||||
{
|
||||
const QPointF p = data->GeometricObject<VPointF>(pRotate)->toQPointF();
|
||||
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(det.at(i).getId());
|
||||
VPointF p1 = VPointF(arc->GetP1(), "A", 0, 0);
|
||||
BiasRotatePoint(&p1, dx, dy, p, angle);
|
||||
|
@ -147,8 +146,8 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
|||
VPointF *center = new VPointF(arc->GetCenter());
|
||||
BiasRotatePoint(center, dx, dy, p, angle);
|
||||
|
||||
QLineF l1(center->toQPointF(), p1.toQPointF());
|
||||
QLineF l2(center->toQPointF(), p2.toQPointF());
|
||||
QLineF l1(*center, p1);
|
||||
QLineF l2(*center, p2);
|
||||
center->setMode(Draw::Modeling);
|
||||
quint32 idCenter = data->AddGObject(center);
|
||||
Q_UNUSED(idCenter);
|
||||
|
@ -177,7 +176,7 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
|||
{
|
||||
const QSharedPointer<VSpline> spline = data->GeometricObject<VSpline>(det.at(i).getId());
|
||||
|
||||
const QPointF p = data->GeometricObject<VPointF>(pRotate)->toQPointF();
|
||||
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
||||
VPointF *p1 = new VPointF(spline->GetP1());
|
||||
BiasRotatePoint(p1, dx, dy, p, angle);
|
||||
|
||||
|
@ -190,7 +189,7 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
|||
VPointF *p4 = new VPointF(spline->GetP4());
|
||||
BiasRotatePoint(p4, dx, dy, p, angle);
|
||||
|
||||
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, 0, Draw::Modeling);
|
||||
VSpline *spl = new VSpline(*p1, p2, p3, *p4, 0, Draw::Modeling);
|
||||
idObject = data->AddGObject(spl);
|
||||
children.append(idObject);
|
||||
|
||||
|
@ -223,7 +222,7 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
|||
point2.Angle1Formula(), point1.Length2(), point1.Length2Formula(), point2.Length1(),
|
||||
point2.Length1Formula());
|
||||
|
||||
const QPointF p = data->GeometricObject<VPointF>(pRotate)->toQPointF();
|
||||
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
||||
VPointF *p1 = new VPointF(spline.GetP1());
|
||||
BiasRotatePoint(p1, dx, dy, p, angle);
|
||||
|
||||
|
@ -236,7 +235,7 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
|||
VPointF *p4 = new VPointF(spline.GetP4());
|
||||
BiasRotatePoint(p4, dx, dy, p, angle);
|
||||
|
||||
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4);
|
||||
VSpline spl = VSpline(*p1, p2, p3, *p4);
|
||||
if (i==1)
|
||||
{
|
||||
const qreal angle1 = spl.GetStartAngle()+180;
|
||||
|
@ -299,7 +298,7 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
|||
{
|
||||
VPointF *point = new VPointF(*data->GeometricObject<VPointF>(det.at(i).getId()));
|
||||
point->setMode(Draw::Modeling);
|
||||
BiasRotatePoint(point, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
|
||||
BiasRotatePoint(point, dx, dy, *data->GeometricObject<VPointF>(pRotate), angle);
|
||||
data->UpdateGObject(TakeNextId(children), point);
|
||||
}
|
||||
}
|
||||
|
@ -308,7 +307,7 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
|||
{
|
||||
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != 0)
|
||||
{
|
||||
const QPointF p = data->GeometricObject<VPointF>(pRotate)->toQPointF();
|
||||
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(det.at(i).getId());
|
||||
VPointF p1 = VPointF(arc->GetP1());
|
||||
BiasRotatePoint(&p1, dx, dy, p, angle);
|
||||
|
@ -319,8 +318,8 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
|||
VPointF *center = new VPointF(arc->GetCenter());
|
||||
BiasRotatePoint(center, dx, dy, p, angle);
|
||||
|
||||
QLineF l1(center->toQPointF(), p1.toQPointF());
|
||||
QLineF l2(center->toQPointF(), p2.toQPointF());
|
||||
QLineF l1(*center, p1);
|
||||
QLineF l2(*center, p2);
|
||||
|
||||
VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(),
|
||||
QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle()));
|
||||
|
@ -336,7 +335,7 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
|||
{
|
||||
const QSharedPointer<VSpline> spline = data->GeometricObject<VSpline>(det.at(i).getId());
|
||||
|
||||
const QPointF p = data->GeometricObject<VPointF>(pRotate)->toQPointF();
|
||||
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
||||
VPointF *p1 = new VPointF(spline->GetP1());
|
||||
BiasRotatePoint(p1, dx, dy, p, angle);
|
||||
|
||||
|
@ -349,7 +348,7 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
|||
VPointF *p4 = new VPointF(spline->GetP4());
|
||||
BiasRotatePoint(p4, dx, dy, p, angle);
|
||||
|
||||
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, 0, Draw::Modeling);
|
||||
VSpline *spl = new VSpline(*p1, p2, p3, *p4, 0, Draw::Modeling);
|
||||
data->UpdateGObject(TakeNextId(children), spl);
|
||||
delete p1;
|
||||
delete p4;
|
||||
|
@ -373,7 +372,7 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
|||
point2.Angle1Formula(), point1.Length2(), point1.Length2Formula(), point2.Length1(),
|
||||
point2.Length1Formula());
|
||||
|
||||
const QPointF p = data->GeometricObject<VPointF>(pRotate)->toQPointF();
|
||||
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
||||
VPointF *p1 = new VPointF(spline.GetP1());
|
||||
BiasRotatePoint(p1, dx, dy, p, angle);
|
||||
|
||||
|
@ -386,7 +385,7 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
|||
VPointF *p4 = new VPointF(spline.GetP4());
|
||||
BiasRotatePoint(p4, dx, dy, p, angle);
|
||||
|
||||
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4);
|
||||
VSpline spl = VSpline(*p1, p2, p3, *p4);
|
||||
if (i==1)
|
||||
{
|
||||
const qreal angle1 = spl.GetStartAngle()+180;
|
||||
|
@ -431,7 +430,7 @@ void VToolUnionDetails::BiasRotatePoint(VPointF *point, const qreal &dx, const q
|
|||
{
|
||||
point->setX(point->x()+dx);
|
||||
point->setY(point->y()+dy);
|
||||
QLineF line(pRotate, point->toQPointF());
|
||||
QLineF line(pRotate, *point);
|
||||
line.setAngle(line.angle()+angle);
|
||||
point->setX(line.p2().x());
|
||||
point->setY(line.p2().y());
|
||||
|
@ -587,8 +586,8 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
|||
point4.setX(point4.x()+dx);
|
||||
point4.setY(point4.y()+dy);
|
||||
|
||||
const QLineF p4p3 = QLineF(point4.toQPointF(), point3.toQPointF());
|
||||
const QLineF p1p2 = QLineF(point1.toQPointF(), point2.toQPointF());
|
||||
const QLineF p4p3 = QLineF(point4, point3);
|
||||
const QLineF p1p2 = QLineF(point1, point2);
|
||||
|
||||
const qreal angle = p4p3.angleTo(p1p2);
|
||||
qint32 pointsD2 = 0; //Keeps number points the second detail, what we have already added.
|
||||
|
|
|
@ -66,22 +66,22 @@ void VisToolAlongLine::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(lineP1, first->toQPointF(), supportColor);
|
||||
DrawPoint(lineP1, *first, supportColor);
|
||||
|
||||
if (object2Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(line, QLineF(first->toQPointF(), Visualization::scenePos), supportColor);
|
||||
DrawLine(line, QLineF(*first, Visualization::scenePos), supportColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(object2Id);
|
||||
DrawPoint(lineP2, second->toQPointF(), supportColor);
|
||||
DrawPoint(lineP2, *second, supportColor);
|
||||
|
||||
DrawLine(line, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
||||
DrawLine(line, QLineF(*first, *second), supportColor);
|
||||
|
||||
if (not qFuzzyIsNull(length))
|
||||
{
|
||||
QLineF mainLine = VGObject::BuildLine(first->toQPointF(), length, line->line().angle());
|
||||
QLineF mainLine = VGObject::BuildLine(*first, length, line->line().angle());
|
||||
DrawLine(this, mainLine, mainColor, lineStyle);
|
||||
|
||||
DrawPoint(point, mainLine.p2(), mainColor);
|
||||
|
|
|
@ -74,46 +74,43 @@ void VisToolBisector::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(line1P1, first->toQPointF(), supportColor);
|
||||
DrawPoint(line1P1, *first, supportColor);
|
||||
|
||||
if (object2Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(line1, QLineF(first->toQPointF(), Visualization::scenePos), supportColor);
|
||||
DrawLine(line1, QLineF(*first, Visualization::scenePos), supportColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(object2Id);
|
||||
DrawPoint(line1P2, second->toQPointF(), supportColor);
|
||||
DrawPoint(line1P2, *second, supportColor);
|
||||
|
||||
DrawLine(line1, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
||||
DrawLine(line1, QLineF(*first, *second), supportColor);
|
||||
|
||||
if (object3Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(line2, QLineF(second->toQPointF(), Visualization::scenePos), supportColor);
|
||||
DrawLine(line2, QLineF(*second, Visualization::scenePos), supportColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(object3Id);
|
||||
DrawPoint(line2P2, third->toQPointF(), supportColor);
|
||||
DrawPoint(line2P2, *third, supportColor);
|
||||
|
||||
DrawLine(line2, QLineF(second->toQPointF(), third->toQPointF()), supportColor);
|
||||
DrawLine(line2, QLineF(*second, *third), supportColor);
|
||||
|
||||
if (not qFuzzyIsNull(length))
|
||||
{
|
||||
qreal angle = VToolBisector::BisectorAngle(first->toQPointF(), second->toQPointF(),
|
||||
third->toQPointF());
|
||||
QLineF mainLine = VGObject::BuildLine(second->toQPointF(), length, angle);
|
||||
qreal angle = VToolBisector::BisectorAngle(*first, *second, *third);
|
||||
QLineF mainLine = VGObject::BuildLine(*second, length, angle);
|
||||
DrawLine(this, mainLine, mainColor, lineStyle);
|
||||
|
||||
DrawPoint(point, mainLine.p2(), mainColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
qreal angle = VToolBisector::BisectorAngle(first->toQPointF(), second->toQPointF(),
|
||||
third->toQPointF());
|
||||
QPointF endRay = Ray(second->toQPointF(), angle);
|
||||
QLineF mainLine = VGObject::BuildLine(second->toQPointF(),
|
||||
QLineF(second->toQPointF(), endRay).length(), angle);
|
||||
qreal angle = VToolBisector::BisectorAngle(*first, *second, *third);
|
||||
QPointF endRay = Ray(*second, angle);
|
||||
QLineF mainLine = VGObject::BuildLine(*second, QLineF(*second, endRay).length(), angle);
|
||||
DrawLine(this, mainLine, mainColor, lineStyle);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,17 +63,17 @@ void VisToolCurveIntersectAxis::RefreshGeometry()
|
|||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(axisPointId);
|
||||
if (VFuzzyComparePossibleNulls(angle, -1))
|
||||
{
|
||||
axis = Axis(first->toQPointF(), Visualization::scenePos);
|
||||
axis = Axis(*first, Visualization::scenePos);
|
||||
}
|
||||
else
|
||||
{
|
||||
axis = Axis(first->toQPointF(), angle);
|
||||
axis = Axis(*first, angle);
|
||||
}
|
||||
DrawPoint(basePoint, first->toQPointF(), mainColor);
|
||||
DrawPoint(basePoint, *first, mainColor);
|
||||
DrawLine(axisLine, axis, supportColor, Qt::DashLine);
|
||||
|
||||
QPointF p = VToolCurveIntersectAxis::FindPoint(first->toQPointF(), axis.angle(), curve);
|
||||
QLineF axis_line(first->toQPointF(), p);
|
||||
QPointF p = VToolCurveIntersectAxis::FindPoint(*first, axis.angle(), curve);
|
||||
QLineF axis_line(*first, p);
|
||||
DrawLine(this, axis_line, mainColor, lineStyle);
|
||||
|
||||
DrawPoint(point, p, mainColor);
|
||||
|
|
|
@ -55,17 +55,17 @@ void VisToolEndLine::RefreshGeometry()
|
|||
{
|
||||
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
|
||||
{
|
||||
line = QLineF(first->toQPointF(), Visualization::scenePos);
|
||||
line = QLineF(*first, Visualization::scenePos);
|
||||
line.setAngle(CorrectAngle(line.angle()));
|
||||
}
|
||||
else
|
||||
{
|
||||
line = QLineF(first->toQPointF(), Visualization::scenePos);
|
||||
line = QLineF(*first, Visualization::scenePos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
line = VGObject::BuildLine(first->toQPointF(), length, angle);
|
||||
line = VGObject::BuildLine(*first, length, angle);
|
||||
DrawPoint(point, line.p2(), mainColor);
|
||||
}
|
||||
DrawLine(this, line, mainColor, lineStyle);
|
||||
|
|
|
@ -54,37 +54,37 @@ void VisToolHeight::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(base_point, first->toQPointF(), supportColor);
|
||||
DrawPoint(base_point, *first, supportColor);
|
||||
|
||||
if (lineP1Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(this, QLineF(first->toQPointF(), Visualization::scenePos), mainColor);
|
||||
DrawLine(this, QLineF(*first, Visualization::scenePos), mainColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(lineP1Id);
|
||||
DrawPoint(lineP1, second->toQPointF(), supportColor);
|
||||
DrawPoint(lineP1, *second, supportColor);
|
||||
|
||||
QLineF base_line;
|
||||
if (lineP2Id <= NULL_ID)
|
||||
{
|
||||
base_line = QLineF(second->toQPointF(), Visualization::scenePos);
|
||||
base_line = QLineF(*second, Visualization::scenePos);
|
||||
DrawLine(line, base_line, supportColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(lineP2Id);
|
||||
DrawPoint(lineP2, third->toQPointF(), supportColor);
|
||||
DrawPoint(lineP2, *third, supportColor);
|
||||
|
||||
base_line = QLineF(second->toQPointF(), third->toQPointF());
|
||||
base_line = QLineF(*second, *third);
|
||||
}
|
||||
|
||||
DrawLine(line, base_line, supportColor);
|
||||
|
||||
QPointF height = VToolHeight::FindPoint(base_line, first->toQPointF());
|
||||
QPointF height = VToolHeight::FindPoint(base_line, *first);
|
||||
DrawPoint(point, height, mainColor);
|
||||
|
||||
QLineF height_line(first->toQPointF(), height);
|
||||
QLineF height_line(*first, height);
|
||||
DrawLine(this, height_line, mainColor, lineStyle);
|
||||
|
||||
ShowIntersection(height_line, base_line);
|
||||
|
|
|
@ -49,12 +49,12 @@ void VisToolLine::RefreshGeometry()
|
|||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
if (point2Id == NULL_ID)
|
||||
{
|
||||
line = QLineF(first->toQPointF(), Visualization::scenePos);
|
||||
line = QLineF(*first, Visualization::scenePos);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
|
||||
line = QLineF(first->toQPointF(), second->toQPointF());
|
||||
line = QLineF(*first, *second);
|
||||
}
|
||||
DrawLine(this, line, mainColor, lineStyle);
|
||||
}
|
||||
|
|
|
@ -55,18 +55,18 @@ void VisToolLineIntersect::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(line1P1, first->toQPointF(), supportColor);
|
||||
DrawPoint(line1P1, *first, supportColor);
|
||||
|
||||
if (line1P2Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(line1, QLineF(first->toQPointF(), Visualization::scenePos), supportColor);
|
||||
DrawLine(line1, QLineF(*first, Visualization::scenePos), supportColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(line1P2Id);
|
||||
DrawPoint(line1P2, second->toQPointF(), supportColor);
|
||||
DrawPoint(line1P2, *second, supportColor);
|
||||
|
||||
DrawLine(line1, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
||||
DrawLine(line1, QLineF(*first, *second), supportColor);
|
||||
|
||||
if (line2P1Id <= NULL_ID)
|
||||
{
|
||||
|
@ -75,14 +75,14 @@ void VisToolLineIntersect::RefreshGeometry()
|
|||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(line2P1Id);
|
||||
DrawPoint(line2P1, third->toQPointF(), supportColor);
|
||||
DrawPoint(line2P1, *third, supportColor);
|
||||
|
||||
if (line2P2Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(this, QLineF(third->toQPointF(), Visualization::scenePos), supportColor);
|
||||
DrawLine(this, QLineF(*third, Visualization::scenePos), supportColor);
|
||||
|
||||
QLineF l1(first->toQPointF(), second->toQPointF());
|
||||
QLineF l2(third->toQPointF(), Visualization::scenePos);
|
||||
QLineF l1(*first, *second);
|
||||
QLineF l2(*third, Visualization::scenePos);
|
||||
QPointF fPoint;
|
||||
QLineF::IntersectType intersect = l1.intersect(l2, &fPoint);
|
||||
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
|
||||
|
@ -93,12 +93,12 @@ void VisToolLineIntersect::RefreshGeometry()
|
|||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> forth = Visualization::data->GeometricObject<VPointF>(line2P2Id);
|
||||
DrawPoint(line2P2, forth->toQPointF(), supportColor);
|
||||
DrawPoint(line2P2, *forth, supportColor);
|
||||
|
||||
DrawLine(this, QLineF(third->toQPointF(), forth->toQPointF()), supportColor);
|
||||
DrawLine(this, QLineF(*third, *forth), supportColor);
|
||||
|
||||
QLineF l1(first->toQPointF(), second->toQPointF());
|
||||
QLineF l2(third->toQPointF(), forth->toQPointF());
|
||||
QLineF l1(*first, *second);
|
||||
QLineF l2(*third, *forth);
|
||||
QPointF fPoint;
|
||||
QLineF::IntersectType intersect = l1.intersect(l2, &fPoint);
|
||||
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
|
||||
|
|
|
@ -57,18 +57,18 @@ void VisToolLineIntersectAxis::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(lineP1, first->toQPointF(), supportColor);
|
||||
DrawPoint(lineP1, *first, supportColor);
|
||||
|
||||
if (point2Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(baseLine, QLineF(first->toQPointF(), Visualization::scenePos), supportColor);
|
||||
DrawLine(baseLine, QLineF(*first, Visualization::scenePos), supportColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
|
||||
DrawPoint(lineP2, second->toQPointF(), supportColor);
|
||||
DrawPoint(lineP2, *second, supportColor);
|
||||
|
||||
const QLineF base_line(first->toQPointF(), second->toQPointF());
|
||||
const QLineF base_line(*first, *second);
|
||||
DrawLine(baseLine, base_line, supportColor);
|
||||
|
||||
if (axisPointId > NULL_ID)
|
||||
|
@ -77,17 +77,17 @@ void VisToolLineIntersectAxis::RefreshGeometry()
|
|||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(axisPointId);
|
||||
if (VFuzzyComparePossibleNulls(angle, -1))
|
||||
{
|
||||
axis = Axis(third->toQPointF(), Visualization::scenePos);
|
||||
axis = Axis(*third, Visualization::scenePos);
|
||||
}
|
||||
else
|
||||
{
|
||||
axis = Axis(third->toQPointF(), angle);
|
||||
axis = Axis(*third, angle);
|
||||
}
|
||||
DrawPoint(basePoint, third->toQPointF(), mainColor);
|
||||
DrawPoint(basePoint, *third, mainColor);
|
||||
DrawLine(axisLine, axis, supportColor, Qt::DashLine);
|
||||
|
||||
QPointF p = VToolLineIntersectAxis::FindPoint(axis, base_line);
|
||||
QLineF axis_line(third->toQPointF(), p);
|
||||
QLineF axis_line(*third, p);
|
||||
DrawLine(this, axis_line, mainColor, lineStyle);
|
||||
|
||||
DrawPoint(point, p, mainColor);
|
||||
|
|
|
@ -54,11 +54,11 @@ void VisToolNormal::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(lineP1, first->toQPointF(), supportColor);
|
||||
DrawPoint(lineP1, *first, supportColor);
|
||||
|
||||
if (object2Id <= NULL_ID)
|
||||
{
|
||||
QLineF line_mouse(first->toQPointF(), Visualization::scenePos);
|
||||
QLineF line_mouse(*first, Visualization::scenePos);
|
||||
DrawLine(line, line_mouse, supportColor);
|
||||
|
||||
QLineF normal = line_mouse.normalVector();
|
||||
|
@ -68,9 +68,9 @@ void VisToolNormal::RefreshGeometry()
|
|||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(object2Id);
|
||||
DrawPoint(lineP2, second->toQPointF(), supportColor);
|
||||
DrawPoint(lineP2, *second, supportColor);
|
||||
|
||||
QLineF line_mouse(first->toQPointF(), second->toQPointF());
|
||||
QLineF line_mouse(*first, *second);
|
||||
DrawLine(line, line_mouse, supportColor);
|
||||
|
||||
if (qFuzzyIsNull(length))
|
||||
|
@ -81,8 +81,8 @@ void VisToolNormal::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
QPointF fPoint = VToolNormal::FindPoint(first->toQPointF(), second->toQPointF(), length, angle);
|
||||
QLineF mainLine = QLineF(first->toQPointF(), fPoint);
|
||||
QPointF fPoint = VToolNormal::FindPoint(*first, *second, length, angle);
|
||||
QLineF mainLine = QLineF(*first, fPoint);
|
||||
DrawLine(this, mainLine, mainColor, lineStyle);
|
||||
|
||||
DrawPoint(point, mainLine.p2(), mainColor);
|
||||
|
|
|
@ -53,16 +53,16 @@ void VisToolPointFromArcAndTangent::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)// tangent point
|
||||
{
|
||||
const QSharedPointer<VPointF> tan = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(tangent, tan->toQPointF(), supportColor);
|
||||
DrawPoint(tangent, *tan, supportColor);
|
||||
|
||||
if (arcId > NULL_ID)// circle center
|
||||
{
|
||||
const QSharedPointer<VArc> arc = Visualization::data->GeometricObject<VArc>(arcId);
|
||||
DrawPath(arcPath, arc->GetPath(PathDirection::Show), Qt::darkGreen, Qt::SolidLine, Qt::RoundCap);
|
||||
|
||||
FindRays(tan->toQPointF(), arc.data());
|
||||
FindRays(*tan, arc.data());
|
||||
|
||||
const QPointF fPoint = VToolPointFromArcAndTangent::FindPoint(tan->toQPointF(), arc.data(), crossPoint);
|
||||
const QPointF fPoint = VToolPointFromArcAndTangent::FindPoint(*tan, arc.data(), crossPoint);
|
||||
DrawPoint(point, fPoint, mainColor);
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ void VisToolPointFromArcAndTangent::setCrossPoint(const CrossCirclesPoint &value
|
|||
void VisToolPointFromArcAndTangent::FindRays(const QPointF &p, const VArc *arc)
|
||||
{
|
||||
QPointF p1, p2;
|
||||
const QPointF center = arc->GetCenter().toQPointF();
|
||||
const QPointF center = arc->GetCenter();
|
||||
const qreal radius = arc->GetRadius();
|
||||
const int res = VGObject::ContactPoints (p, center, radius, p1, p2);
|
||||
|
||||
|
|
|
@ -53,22 +53,21 @@ void VisToolPointFromCircleAndTangent::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)// tangent point
|
||||
{
|
||||
const QSharedPointer<VPointF> tan = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(tangent, tan->toQPointF(), supportColor);
|
||||
DrawPoint(tangent, *tan, supportColor);
|
||||
|
||||
if (object2Id > NULL_ID)// circle center
|
||||
{
|
||||
const QSharedPointer<VPointF> center = Visualization::data->GeometricObject<VPointF>(object2Id);
|
||||
DrawPoint(cCenter, center->toQPointF(), supportColor);
|
||||
DrawPoint(cCenter, *center, supportColor);
|
||||
|
||||
if (cRadius > 0)
|
||||
{
|
||||
cPath->setRect(PointRect(cRadius));
|
||||
DrawPoint(cPath, center->toQPointF(), Qt::darkGreen, Qt::DashLine);
|
||||
DrawPoint(cPath, *center, Qt::darkGreen, Qt::DashLine);
|
||||
|
||||
FindRays(tan->toQPointF(), center->toQPointF(), cRadius);
|
||||
FindRays(*tan, *center, cRadius);
|
||||
|
||||
const QPointF fPoint = VToolPointFromCircleAndTangent::FindPoint(tan->toQPointF(), center->toQPointF(),
|
||||
cRadius, crossPoint);
|
||||
const QPointF fPoint = VToolPointFromCircleAndTangent::FindPoint(*tan, *center, cRadius, crossPoint);
|
||||
DrawPoint(point, fPoint, mainColor);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,17 +53,17 @@ void VisToolPointOfContact::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(lineP1, first->toQPointF(), supportColor);
|
||||
DrawPoint(lineP1, *first, supportColor);
|
||||
|
||||
if (lineP2Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(this, QLineF(first->toQPointF(), Visualization::scenePos), supportColor);
|
||||
DrawLine(this, QLineF(*first, Visualization::scenePos), supportColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(lineP2Id);
|
||||
DrawPoint(lineP2, second->toQPointF(), supportColor);
|
||||
DrawLine(this, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
||||
DrawPoint(lineP2, *second, supportColor);
|
||||
DrawLine(this, QLineF(*first, *second), supportColor);
|
||||
|
||||
if (radiusId <= NULL_ID)
|
||||
{
|
||||
|
@ -72,16 +72,15 @@ void VisToolPointOfContact::RefreshGeometry()
|
|||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(radiusId);
|
||||
DrawPoint(arc_point, third->toQPointF(), supportColor);
|
||||
DrawPoint(arc_point, *third, supportColor);
|
||||
|
||||
if (not qFuzzyIsNull(radius))
|
||||
{
|
||||
QPointF fPoint = VToolPointOfContact::FindPoint(radius, third->toQPointF(), first->toQPointF(),
|
||||
second->toQPointF());
|
||||
QPointF fPoint = VToolPointOfContact::FindPoint(radius, *third, *first, *second);
|
||||
DrawPoint(point, fPoint, mainColor);
|
||||
|
||||
circle->setRect(PointRect(radius));
|
||||
DrawPoint(circle, third->toQPointF(), supportColor, Qt::DashLine);
|
||||
DrawPoint(circle, *third, supportColor, Qt::DashLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,9 +57,9 @@ void VisToolPointOfIntersection::RefreshGeometry()
|
|||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(axisP1, first->toQPointF(), supportColor);
|
||||
DrawPoint(axisP1, *first, supportColor);
|
||||
|
||||
axisL1 = Axis(first->toQPointF(), 90);
|
||||
axisL1 = Axis(*first, 90);
|
||||
DrawLine(this, axisL1, supportColor, Qt::DashLine);
|
||||
|
||||
QLineF axisL2;
|
||||
|
@ -71,8 +71,8 @@ void VisToolPointOfIntersection::RefreshGeometry()
|
|||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
|
||||
DrawPoint(axisP2, second->toQPointF(), supportColor);
|
||||
axisL2 = Axis(second->toQPointF(), 180);
|
||||
DrawPoint(axisP2, *second, supportColor);
|
||||
axisL2 = Axis(*second, 180);
|
||||
ShowIntersection(axisL1, axisL2, mainColor);
|
||||
}
|
||||
DrawLine(axis2, axisL2, supportColor, Qt::DashLine);
|
||||
|
|
|
@ -56,23 +56,22 @@ void VisToolPointOfIntersectionCircles::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(c1Center, first->toQPointF(), supportColor);
|
||||
DrawPoint(c1Center, *first, supportColor);
|
||||
|
||||
if (object2Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(object2Id);
|
||||
DrawPoint(c2Center, second->toQPointF(), supportColor);
|
||||
DrawPoint(c2Center, *second, supportColor);
|
||||
|
||||
if (c1Radius > 0 && c2Radius > 0)
|
||||
{
|
||||
c1Path->setRect(PointRect(c1Radius));
|
||||
DrawPoint(c1Path, first->toQPointF(), Qt::darkGreen, Qt::DashLine);
|
||||
DrawPoint(c1Path, *first, Qt::darkGreen, Qt::DashLine);
|
||||
|
||||
c2Path->setRect(PointRect(c2Radius));
|
||||
DrawPoint(c2Path, second->toQPointF(), Qt::darkRed, Qt::DashLine);
|
||||
DrawPoint(c2Path, *second, Qt::darkRed, Qt::DashLine);
|
||||
|
||||
const QPointF fPoint = VToolPointOfIntersectionCircles::FindPoint(first->toQPointF(),
|
||||
second->toQPointF(), c1Radius,
|
||||
const QPointF fPoint = VToolPointOfIntersectionCircles::FindPoint(*first, *second, c1Radius,
|
||||
c2Radius, crossPoint);
|
||||
DrawPoint(point, fPoint, mainColor);
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ void VisToolRotation::RefreshGeometry()
|
|||
|
||||
if (object1Id != NULL_ID)
|
||||
{
|
||||
const QPointF origin = Visualization::data->GeometricObject<VPointF>(object1Id)->toQPointF();
|
||||
const QPointF origin = *Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(point, origin, supportColor2);
|
||||
|
||||
QLineF rLine;
|
||||
|
@ -122,11 +122,11 @@ void VisToolRotation::RefreshGeometry()
|
|||
|
||||
++iPoint;
|
||||
QGraphicsEllipseItem *point = GetPoint(iPoint);
|
||||
DrawPoint(point, p->toQPointF(), supportColor);
|
||||
DrawPoint(point, *p, supportColor);
|
||||
|
||||
++iPoint;
|
||||
point = GetPoint(iPoint);
|
||||
DrawPoint(point, p->Rotate(origin, angle).toQPointF(), supportColor);
|
||||
DrawPoint(point, p->Rotate(origin, angle), supportColor);
|
||||
break;
|
||||
}
|
||||
case GOType::Arc:
|
||||
|
|
|
@ -56,46 +56,44 @@ void VisToolShoulderPoint::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(line1P1, first->toQPointF(), supportColor);
|
||||
DrawPoint(line1P1, *first, supportColor);
|
||||
|
||||
if (lineP1Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(line1, QLineF(first->toQPointF(), Visualization::scenePos), supportColor);
|
||||
DrawLine(line1, QLineF(*first, Visualization::scenePos), supportColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(lineP1Id);
|
||||
DrawPoint(line1P2, second->toQPointF(), supportColor);
|
||||
DrawPoint(line1P2, *second, supportColor);
|
||||
|
||||
DrawLine(line1, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
||||
DrawLine(line1, QLineF(*first, *second), supportColor);
|
||||
|
||||
if (lineP2Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(line2, QLineF(second->toQPointF(), Visualization::scenePos), supportColor);
|
||||
DrawLine(line2, QLineF(*second, Visualization::scenePos), supportColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(lineP2Id);
|
||||
DrawPoint(line2P2, third->toQPointF(), supportColor);
|
||||
DrawPoint(line2P2, *third, supportColor);
|
||||
|
||||
DrawLine(line2, QLineF(second->toQPointF(), third->toQPointF()), supportColor);
|
||||
DrawLine(line2, QLineF(*second, *third), supportColor);
|
||||
|
||||
if (not qFuzzyIsNull(length))
|
||||
{
|
||||
QPointF fPoint = VToolShoulderPoint::FindPoint(second->toQPointF(), third->toQPointF(),
|
||||
first->toQPointF(), length);
|
||||
QLineF mainLine = QLineF(second->toQPointF(), fPoint);
|
||||
QPointF fPoint = VToolShoulderPoint::FindPoint(*second, *third, *first, length);
|
||||
QLineF mainLine = QLineF(*second, fPoint);
|
||||
DrawLine(this, mainLine, mainColor, lineStyle);
|
||||
|
||||
DrawPoint(point, mainLine.p2(), mainColor);
|
||||
DrawLine(line3, QLineF(first->toQPointF(), mainLine.p2()), supportColor, Qt::DashLine);
|
||||
DrawLine(line3, QLineF(*first, mainLine.p2()), supportColor, Qt::DashLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
qreal angle = QLineF(second->toQPointF(), third->toQPointF()).angle();
|
||||
QPointF endRay = Ray(second->toQPointF(), angle);
|
||||
QLineF mainLine = VGObject::BuildLine(second->toQPointF(),
|
||||
QLineF(second->toQPointF(), endRay).length(), angle);
|
||||
qreal angle = QLineF(*second, *third).angle();
|
||||
QPointF endRay = Ray(*second, angle);
|
||||
QLineF mainLine = VGObject::BuildLine(*second, QLineF(*second, endRay).length(), angle);
|
||||
DrawLine(this, mainLine, mainColor, lineStyle);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,18 +59,18 @@ void VisToolTriangle::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(axisP1, first->toQPointF(), supportColor);
|
||||
DrawPoint(axisP1, *first, supportColor);
|
||||
|
||||
if (object2Id <= NULL_ID)
|
||||
{
|
||||
DrawAimedAxis(axis, QLineF(first->toQPointF(), Visualization::scenePos), supportColor);
|
||||
DrawAimedAxis(axis, QLineF(*first, Visualization::scenePos), supportColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(object2Id);
|
||||
DrawPoint(axisP2, second->toQPointF(), supportColor);
|
||||
DrawPoint(axisP2, *second, supportColor);
|
||||
|
||||
DrawAimedAxis(axis, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
||||
DrawAimedAxis(axis, QLineF(*first, *second), supportColor);
|
||||
|
||||
if (hypotenuseP1Id <= NULL_ID)
|
||||
{
|
||||
|
@ -79,32 +79,30 @@ void VisToolTriangle::RefreshGeometry()
|
|||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(hypotenuseP1Id);
|
||||
DrawPoint(hypotenuseP1, third->toQPointF(), supportColor);
|
||||
DrawPoint(hypotenuseP1, *third, supportColor);
|
||||
|
||||
if (hypotenuseP2Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(this, QLineF(third->toQPointF(), Visualization::scenePos), supportColor, Qt::DashLine);
|
||||
DrawLine(this, QLineF(*third, Visualization::scenePos), supportColor, Qt::DashLine);
|
||||
|
||||
QPointF trPoint = VToolTriangle::FindPoint(first->toQPointF(), second->toQPointF(),
|
||||
third->toQPointF(), Visualization::scenePos);
|
||||
QPointF trPoint = VToolTriangle::FindPoint(*first, *second, *third, Visualization::scenePos);
|
||||
DrawPoint(point, trPoint, mainColor);
|
||||
|
||||
DrawLine(foot1, QLineF(third->toQPointF(), trPoint), supportColor, Qt::DashLine);
|
||||
DrawLine(foot1, QLineF(*third, trPoint), supportColor, Qt::DashLine);
|
||||
DrawLine(foot2, QLineF(Visualization::scenePos, trPoint), supportColor, Qt::DashLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> forth = Visualization::data->GeometricObject<VPointF>(hypotenuseP2Id);
|
||||
DrawPoint(hypotenuseP2, forth->toQPointF(), supportColor);
|
||||
DrawPoint(hypotenuseP2, *forth, supportColor);
|
||||
|
||||
DrawLine(this, QLineF(third->toQPointF(), forth->toQPointF()), supportColor, Qt::DashLine);
|
||||
DrawLine(this, QLineF(*third, *forth), supportColor, Qt::DashLine);
|
||||
|
||||
QPointF trPoint = VToolTriangle::FindPoint(first->toQPointF(), second->toQPointF(),
|
||||
third->toQPointF(), forth->toQPointF());
|
||||
QPointF trPoint = VToolTriangle::FindPoint(*first, *second, *third, *forth);
|
||||
DrawPoint(point, trPoint, mainColor);
|
||||
|
||||
DrawLine(foot1, QLineF(third->toQPointF(), trPoint), supportColor, Qt::DashLine);
|
||||
DrawLine(foot2, QLineF(forth->toQPointF(), trPoint), supportColor, Qt::DashLine);
|
||||
DrawLine(foot1, QLineF(*third, trPoint), supportColor, Qt::DashLine);
|
||||
DrawLine(foot2, QLineF(*forth, trPoint), supportColor, Qt::DashLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,55 +75,51 @@ void VisToolTrueDarts::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> blP1 = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(baseLineP1, blP1->toQPointF(), supportColor);
|
||||
DrawPoint(baseLineP1, *blP1, supportColor);
|
||||
|
||||
if (baseLineP2Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(this, QLineF(blP1->toQPointF(), Visualization::scenePos), supportColor, Qt::DashLine);
|
||||
DrawLine(this, QLineF(*blP1, Visualization::scenePos), supportColor, Qt::DashLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> blP2 = Visualization::data->GeometricObject<VPointF>(baseLineP2Id);
|
||||
DrawPoint(baseLineP2, blP2->toQPointF(), supportColor);
|
||||
DrawLine(this, QLineF(blP1->toQPointF(), blP2->toQPointF()), supportColor, Qt::DashLine);
|
||||
DrawPoint(baseLineP2, *blP2, supportColor);
|
||||
DrawLine(this, QLineF(*blP1, *blP2), supportColor, Qt::DashLine);
|
||||
|
||||
if (dartP1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> d1 = Visualization::data->GeometricObject<VPointF>(dartP1Id);
|
||||
DrawPoint(dartP1, d1->toQPointF(), supportColor);
|
||||
DrawPoint(dartP1, *d1, supportColor);
|
||||
|
||||
if (dartP2Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(p1d2, QLineF(d1->toQPointF(), Visualization::scenePos), supportColor);
|
||||
DrawLine(p1d2, QLineF(*d1, Visualization::scenePos), supportColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> d2 = Visualization::data->GeometricObject<VPointF>(dartP2Id);
|
||||
DrawPoint(dartP2, d2->toQPointF(), supportColor);
|
||||
DrawLine(p1d2, QLineF(d1->toQPointF(), d2->toQPointF()), supportColor);
|
||||
DrawPoint(dartP2, *d2, supportColor);
|
||||
DrawLine(p1d2, QLineF(*d1, *d2), supportColor);
|
||||
|
||||
if (dartP3Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(d2p2, QLineF(d2->toQPointF(), Visualization::scenePos), supportColor);
|
||||
DrawLine(d2p2, QLineF(*d2, Visualization::scenePos), supportColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> d3 = Visualization::data->GeometricObject<VPointF>(dartP3Id);
|
||||
DrawPoint(dartP3, d3->toQPointF(), supportColor);
|
||||
DrawLine(d2p2, QLineF(d2->toQPointF(), d3->toQPointF()), supportColor);
|
||||
DrawPoint(dartP3, *d3, supportColor);
|
||||
DrawLine(d2p2, QLineF(*d2, *d3), supportColor);
|
||||
|
||||
QPointF p1;
|
||||
QPointF p2;
|
||||
VToolTrueDarts::FindPoint(blP1->toQPointF(),
|
||||
blP2->toQPointF(),
|
||||
d1->toQPointF(),
|
||||
d2->toQPointF(),
|
||||
d3->toQPointF(), p1, p2);
|
||||
VToolTrueDarts::FindPoint(*blP1, *blP2, *d1, *d2, *d3, p1, p2);
|
||||
|
||||
DrawLine(lineblP1P1, QLineF(blP1->toQPointF(), p1), supportColor);
|
||||
DrawLine(lineblP2P2, QLineF(blP2->toQPointF(), p2), supportColor);
|
||||
DrawLine(p1d2, QLineF(p1, d2->toQPointF()), supportColor);
|
||||
DrawLine(d2p2, QLineF(d2->toQPointF(), p2), supportColor);
|
||||
DrawLine(lineblP1P1, QLineF(*blP1, p1), supportColor);
|
||||
DrawLine(lineblP2P2, QLineF(*blP2, p2), supportColor);
|
||||
DrawLine(p1d2, QLineF(p1, *d2), supportColor);
|
||||
DrawLine(d2p2, QLineF(*d2, p2), supportColor);
|
||||
|
||||
DrawPoint(point1, p1, mainColor);
|
||||
DrawPoint(point2, p2, mainColor);
|
||||
|
|
|
@ -48,7 +48,7 @@ void VisToolArc::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(arcCenter, first->toQPointF(), supportColor);
|
||||
DrawPoint(arcCenter, *first, supportColor);
|
||||
|
||||
if (not qFuzzyIsNull(radius) && f1 >= 0 && f2 >= 0 && not VFuzzyComparePossibleNulls(f1, f2))
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ void VisToolArcWithLength::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(arcCenter, first->toQPointF(), supportColor);
|
||||
DrawPoint(arcCenter, *first, supportColor);
|
||||
|
||||
if (not qFuzzyIsNull(radius) && f1 >= 0 && not qFuzzyIsNull(length))
|
||||
{
|
||||
|
|
|
@ -62,17 +62,17 @@ void VisToolCubicBezier::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const auto first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(point1, first->toQPointF(), Qt::DashLine);
|
||||
DrawPoint(point1, *first, Qt::DashLine);
|
||||
|
||||
if (object2Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(helpLine1, QLineF(first->toQPointF(), Visualization::scenePos), mainColor, Qt::DashLine);
|
||||
DrawLine(helpLine1, QLineF(*first, Visualization::scenePos), mainColor, Qt::DashLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto second = Visualization::data->GeometricObject<VPointF>(object2Id);
|
||||
DrawPoint(point2, second->toQPointF(), supportColor);
|
||||
DrawLine(helpLine1, QLineF(first->toQPointF(), second->toQPointF()), mainColor, Qt::DashLine);
|
||||
DrawPoint(point2, *second, supportColor);
|
||||
DrawLine(helpLine1, QLineF(*first, *second), mainColor, Qt::DashLine);
|
||||
|
||||
if (object3Id <= NULL_ID)
|
||||
{
|
||||
|
@ -83,19 +83,19 @@ void VisToolCubicBezier::RefreshGeometry()
|
|||
else
|
||||
{
|
||||
const auto third = Visualization::data->GeometricObject<VPointF>(object3Id);
|
||||
DrawPoint(point3, third->toQPointF(), supportColor);
|
||||
DrawPoint(point3, *third, supportColor);
|
||||
|
||||
if (object4Id <= NULL_ID)
|
||||
{
|
||||
VCubicBezier spline(*first, *second, *third, VPointF(Visualization::scenePos));
|
||||
DrawPath(this, spline.GetPath(PathDirection::Hide), mainColor, Qt::SolidLine, Qt::RoundCap);
|
||||
DrawLine(helpLine2, QLineF(third->toQPointF(), Visualization::scenePos), mainColor, Qt::DashLine);
|
||||
DrawLine(helpLine2, QLineF(*third, Visualization::scenePos), mainColor, Qt::DashLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto fourth = Visualization::data->GeometricObject<VPointF>(object4Id);
|
||||
DrawPoint(point4, fourth->toQPointF(), supportColor);
|
||||
DrawLine(helpLine2, QLineF(fourth->toQPointF(), third->toQPointF()), mainColor, Qt::DashLine);
|
||||
DrawPoint(point4, *fourth, supportColor);
|
||||
DrawLine(helpLine2, QLineF(*fourth, *third), mainColor, Qt::DashLine);
|
||||
|
||||
VCubicBezier spline(*first, *second, *third, *fourth);
|
||||
DrawPath(this, spline.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap);
|
||||
|
|
|
@ -65,7 +65,7 @@ void VisToolCubicBezierPath::RefreshGeometry()
|
|||
for (int i = 0; i < size; ++i)
|
||||
{
|
||||
QGraphicsEllipseItem *point = this->getPoint(mainPoints, static_cast<unsigned>(i), 1/*zValue*/);
|
||||
DrawPoint(point, pathPoints.at(i).toQPointF(), supportColor);
|
||||
DrawPoint(point, pathPoints.at(i), supportColor);
|
||||
}
|
||||
|
||||
if (mode == Mode::Creation)
|
||||
|
@ -93,13 +93,13 @@ void VisToolCubicBezierPath::RefreshGeometry()
|
|||
const VSpline spl = path.GetSpline(i);
|
||||
|
||||
QGraphicsLineItem *ctrlLine1 = this->getLine(static_cast<unsigned>(preLastPoint));
|
||||
DrawLine(ctrlLine1, QLineF(spl.GetP1().toQPointF(), spl.GetP2()), mainColor, Qt::DashLine);
|
||||
DrawLine(ctrlLine1, QLineF(spl.GetP1(), spl.GetP2()), mainColor, Qt::DashLine);
|
||||
|
||||
QGraphicsEllipseItem *p2 = this->getPoint(ctrlPoints, static_cast<unsigned>(preLastPoint));
|
||||
DrawPoint(p2, spl.GetP2(), Qt::green);
|
||||
|
||||
QGraphicsLineItem *ctrlLine2 = this->getLine(static_cast<unsigned>(lastPoint));
|
||||
DrawLine(ctrlLine2, QLineF(spl.GetP4().toQPointF(), spl.GetP3()), mainColor, Qt::DashLine);
|
||||
DrawLine(ctrlLine2, QLineF(spl.GetP4(), spl.GetP3()), mainColor, Qt::DashLine);
|
||||
|
||||
QGraphicsEllipseItem *p3 = this->getPoint(ctrlPoints, static_cast<unsigned>(lastPoint));
|
||||
DrawPoint(p3, spl.GetP3(), Qt::green);
|
||||
|
@ -180,8 +180,8 @@ void VisToolCubicBezierPath::Creating(const QVector<VPointF> &pathPoints, int po
|
|||
const VPointF p1 = pathPoints.last();
|
||||
if (pathPoints.size() >= 4)
|
||||
{
|
||||
QLineF p1p2(p1.toQPointF(), Visualization::scenePos);
|
||||
QLineF prP3p1(pathPoints.at(size-2).toQPointF(), p1.toQPointF());
|
||||
QLineF p1p2(p1, Visualization::scenePos);
|
||||
QLineF prP3p1(pathPoints.at(size-2), p1);
|
||||
p1p2.setAngle(prP3p1.angle());
|
||||
|
||||
const QPointF p2 = p1p2.p2();
|
||||
|
@ -197,24 +197,24 @@ void VisToolCubicBezierPath::Creating(const QVector<VPointF> &pathPoints, int po
|
|||
}
|
||||
else
|
||||
{
|
||||
DrawLine(helpLine1, QLineF(p1.toQPointF(), Visualization::scenePos), mainColor, Qt::DashLine);
|
||||
DrawLine(helpLine1, QLineF(p1, Visualization::scenePos), mainColor, Qt::DashLine);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
const VPointF p1 = pathPoints.at(subSplPoints + pointsLeft-1);
|
||||
QPointF p2 = pathPoints.at(subSplPoints + pointsLeft).toQPointF();
|
||||
QPointF p2 = pathPoints.at(subSplPoints + pointsLeft);
|
||||
|
||||
if (subSplCount >= 1)
|
||||
{
|
||||
QLineF p1p2(p1.toQPointF(), p2);
|
||||
QLineF prP3p1(pathPoints.at(subSplPoints + pointsLeft-2).toQPointF(), p1.toQPointF());
|
||||
QLineF p1p2(p1, p2);
|
||||
QLineF prP3p1(pathPoints.at(subSplPoints + pointsLeft-2), p1);
|
||||
p1p2.setAngle(prP3p1.angle());
|
||||
p2 = p1p2.p2();
|
||||
}
|
||||
|
||||
DrawLine(helpLine1, QLineF(p1.toQPointF(), p2), mainColor, Qt::DashLine);
|
||||
DrawLine(helpLine1, QLineF(p1, p2), mainColor, Qt::DashLine);
|
||||
|
||||
VSpline spline(p1, p2, Visualization::scenePos, VPointF(Visualization::scenePos));
|
||||
DrawPath(newCurveSegment, spline.GetPath(PathDirection::Hide), mainColor, Qt::SolidLine, Qt::RoundCap);
|
||||
|
@ -227,18 +227,18 @@ void VisToolCubicBezierPath::Creating(const QVector<VPointF> &pathPoints, int po
|
|||
case 2:
|
||||
{
|
||||
const VPointF p1 = pathPoints.at(subSplPoints + pointsLeft-2);
|
||||
QPointF p2 = pathPoints.at(subSplPoints + pointsLeft-1).toQPointF();
|
||||
const QPointF p3 = pathPoints.at(subSplPoints + pointsLeft).toQPointF();
|
||||
QPointF p2 = pathPoints.at(subSplPoints + pointsLeft-1);
|
||||
const QPointF p3 = pathPoints.at(subSplPoints + pointsLeft);
|
||||
|
||||
if (subSplCount >= 1)
|
||||
{
|
||||
QLineF p1p2(p1.toQPointF(), p2);
|
||||
QLineF prP3p1(pathPoints.at(subSplPoints + pointsLeft-3).toQPointF(), p1.toQPointF());
|
||||
QLineF p1p2(p1, p2);
|
||||
QLineF prP3p1(pathPoints.at(subSplPoints + pointsLeft-3), p1);
|
||||
p1p2.setAngle(prP3p1.angle());
|
||||
p2 = p1p2.p2();
|
||||
}
|
||||
|
||||
DrawLine(helpLine1, QLineF(p1.toQPointF(), p2), mainColor, Qt::DashLine);
|
||||
DrawLine(helpLine1, QLineF(p1, p2), mainColor, Qt::DashLine);
|
||||
DrawLine(helpLine2, QLineF(p3, Visualization::scenePos), mainColor, Qt::DashLine);
|
||||
|
||||
VSpline spline(p1, p2, p3, VPointF(Visualization::scenePos));
|
||||
|
|
|
@ -66,7 +66,7 @@ void VisToolCutSplinePath::RefreshGeometry()
|
|||
SCASSERT(spPath1 != nullptr);
|
||||
SCASSERT(spPath2 != nullptr);
|
||||
|
||||
DrawPoint(point, p->toQPointF(), mainColor);
|
||||
DrawPoint(point, *p, mainColor);
|
||||
delete p;
|
||||
|
||||
DrawPath(splPath1, spPath1->GetPath(PathDirection::Show), Qt::darkGreen, Qt::SolidLine, Qt::RoundCap);
|
||||
|
|
|
@ -77,24 +77,24 @@ void VisToolSpline::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const auto first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(point1, first->toQPointF(), supportColor);
|
||||
DrawPoint(point1, *first, supportColor);
|
||||
|
||||
if (mode == Mode::Creation)
|
||||
{
|
||||
if (isLeftMousePressed && not p2Selected)
|
||||
{
|
||||
p2 = Visualization::scenePos;
|
||||
controlPoints[0]->RefreshCtrlPoint(1, SplinePointPosition::FirstPoint, p2, first->toQPointF());
|
||||
controlPoints[0]->RefreshCtrlPoint(1, SplinePointPosition::FirstPoint, p2, *first);
|
||||
|
||||
if (not controlPoints[0]->isVisible())
|
||||
{
|
||||
if (QLineF(first->toQPointF(), p2).length() > radius)
|
||||
if (QLineF(*first, p2).length() > radius)
|
||||
{
|
||||
controlPoints[0]->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
p2 = first->toQPointF();
|
||||
p2 = *first;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,26 +112,26 @@ void VisToolSpline::RefreshGeometry()
|
|||
else
|
||||
{
|
||||
const auto second = Visualization::data->GeometricObject<VPointF>(object4Id);
|
||||
DrawPoint(point4, second->toQPointF(), supportColor);
|
||||
DrawPoint(point4, *second, supportColor);
|
||||
|
||||
if (mode == Mode::Creation)
|
||||
{
|
||||
if (isLeftMousePressed && not p3Selected)
|
||||
{
|
||||
QLineF ctrlLine (second->toQPointF(), Visualization::scenePos);
|
||||
QLineF ctrlLine (*second, Visualization::scenePos);
|
||||
ctrlLine.setAngle(ctrlLine.angle()+180);
|
||||
p3 = ctrlLine.p2();
|
||||
controlPoints[1]->RefreshCtrlPoint(1, SplinePointPosition::LastPoint, p3, second->toQPointF());
|
||||
controlPoints[1]->RefreshCtrlPoint(1, SplinePointPosition::LastPoint, p3, *second);
|
||||
|
||||
if (not controlPoints[1]->isVisible())
|
||||
{
|
||||
if (QLineF(second->toQPointF(), p3).length() > radius)
|
||||
if (QLineF(*second, p3).length() > radius)
|
||||
{
|
||||
controlPoints[1]->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
p3 = second->toQPointF();
|
||||
p3 = *second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ void VisToolSplinePath::RefreshGeometry()
|
|||
for (int i = 0; i < size; ++i)
|
||||
{
|
||||
QGraphicsEllipseItem *point = this->getPoint(static_cast<unsigned>(i));
|
||||
DrawPoint(point, pathPoints.at(i).P().toQPointF(), supportColor);
|
||||
DrawPoint(point, pathPoints.at(i).P(), supportColor);
|
||||
}
|
||||
|
||||
if (mode == Mode::Creation)
|
||||
|
@ -76,13 +76,13 @@ void VisToolSplinePath::RefreshGeometry()
|
|||
VSpline spl = path.GetSpline(i);
|
||||
|
||||
ctrlPoints[preLastPoint]->RefreshCtrlPoint(i, SplinePointPosition::FirstPoint, spl.GetP2(),
|
||||
spl.GetP1().toQPointF());
|
||||
spl.GetP1());
|
||||
ctrlPoints[lastPoint]->RefreshCtrlPoint(i, SplinePointPosition::LastPoint, spl.GetP3(),
|
||||
spl.GetP4().toQPointF());
|
||||
spl.GetP4());
|
||||
}
|
||||
}
|
||||
|
||||
Creating(pathPoints.at(size-1).P().toQPointF(), size);
|
||||
Creating(pathPoints.at(size-1).P(), size);
|
||||
}
|
||||
|
||||
if (size > 1)
|
||||
|
|
|
@ -108,7 +108,7 @@ void VSimplePoint::RefreshGeometry(const VPointF &point)
|
|||
QRectF rec = QRectF(0, 0, radius*2, radius*2);
|
||||
rec.translate(-rec.center().x(), -rec.center().y());
|
||||
this->setRect(rec);
|
||||
this->setPos(point.toQPointF());
|
||||
this->setPos(point);
|
||||
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||
namePoint->blockSignals(true);
|
||||
QFont font = namePoint->font();
|
||||
|
|
|
@ -181,7 +181,7 @@ void TST_VArc::TestGetPoints()
|
|||
|
||||
for (int i=0; i < points.size(); ++i)
|
||||
{
|
||||
QLineF rLine(center.toQPointF(), points.at(i));
|
||||
QLineF rLine(center, points.at(i));
|
||||
const qreal value = qAbs(rLine.length() - radius);
|
||||
const QString errorMsg = QString("Broken the first rule. All points should be on the same distance from "
|
||||
"the center. Error ='%1'.").arg(value);
|
||||
|
@ -199,7 +199,7 @@ void TST_VArc::TestGetPoints()
|
|||
else
|
||||
{// sector square
|
||||
gSquere = (M_PI * radius * radius) / 360.0 * arc.AngleArc();
|
||||
points.append(center.toQPointF());
|
||||
points.append(center);
|
||||
}
|
||||
|
||||
// calculated square
|
||||
|
|
|
@ -299,13 +299,13 @@ void TST_VEllipticalArc::TestGetPoints2()
|
|||
const qreal c = qSqrt(qAbs(radius2*radius2 - radius1*radius1));
|
||||
// distance from the center to the focus
|
||||
|
||||
QPointF focus1 = center.toQPointF();
|
||||
QPointF focus2 = center.toQPointF();
|
||||
QPointF focus1 = center;
|
||||
QPointF focus2 = center;
|
||||
|
||||
if (radius1 < radius2)
|
||||
{
|
||||
focus1.setY(focus1.ry() + c);
|
||||
QLineF line(center.toQPointF(), focus1);
|
||||
QLineF line(center, focus1);
|
||||
line.setAngle(line.angle() + rotationAngle);
|
||||
focus1 = line.p2();
|
||||
|
||||
|
@ -317,7 +317,7 @@ void TST_VEllipticalArc::TestGetPoints2()
|
|||
else
|
||||
{
|
||||
focus1.setX(focus1.rx() + c);
|
||||
QLineF line(center.toQPointF(), focus1);
|
||||
QLineF line(center, focus1);
|
||||
line.setAngle(line.angle() + rotationAngle);
|
||||
focus1 = line.p2();
|
||||
|
||||
|
@ -328,7 +328,7 @@ void TST_VEllipticalArc::TestGetPoints2()
|
|||
}
|
||||
|
||||
QPointF ellipsePoint(center.x() + radius1, center.y());
|
||||
QLineF line(center.toQPointF(), ellipsePoint);
|
||||
QLineF line(center, ellipsePoint);
|
||||
line.setAngle(line.angle() + rotationAngle);
|
||||
ellipsePoint = line.p2();
|
||||
|
||||
|
|
|
@ -326,8 +326,8 @@ void TST_VSpline::TestLengthByPoint_data()
|
|||
|
||||
QTest::newRow("Point on spline") << spl << p << testLength;
|
||||
QTest::newRow("Wrong point") << spl << QPointF(-10000, -10000) << -1.0;
|
||||
QTest::newRow("First point") << spl << p1.toQPointF() << 0.0;
|
||||
QTest::newRow("Last point") << spl << p4.toQPointF() << length;
|
||||
QTest::newRow("First point") << spl << p1 << 0.0;
|
||||
QTest::newRow("Last point") << spl << p4 << length;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user