From 016883110fd213b8b769023eeb031324a04fb2ac Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 15 Nov 2017 13:22:16 +0200 Subject: [PATCH] Allow an arc to have the same start and end angles. In such a case full circle will be drawn. --HG-- branch : develop --- src/libs/vtools/dialogs/tools/dialogarc.cpp | 26 ------------------- src/libs/vtools/dialogs/tools/dialogarc.h | 1 - .../dialogs/tools/dialogellipticalarc.cpp | 26 ------------------- .../dialogs/tools/dialogellipticalarc.h | 1 - .../tools/drawTools/toolcurve/vtoolarc.cpp | 14 +++------- 5 files changed, 4 insertions(+), 64 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/dialogarc.cpp b/src/libs/vtools/dialogs/tools/dialogarc.cpp index 620800e6f..4d1c268c8 100644 --- a/src/libs/vtools/dialogs/tools/dialogarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogarc.cpp @@ -423,32 +423,6 @@ void DialogArc::EvalF() labelEditFormula = ui->labelEditF2; angleF2 = Eval(ui->plainTextEditF2->toPlainText(), flagF2, ui->labelResultF2, degreeSymbol, false); - - CheckAngles(); -} - -//--------------------------------------------------------------------------------------------------------------------- -void DialogArc::CheckAngles() -{ - if (static_cast(angleF1) == INT_MIN || static_cast(angleF2) == INT_MIN) - { - return; - } - - if (VFuzzyComparePossibleNulls(angleF1, angleF2)) - { - flagF1 = false; - ChangeColor(ui->labelEditF1, Qt::red); - ui->labelResultF1->setText(tr("Error")); - ui->labelResultF1->setToolTip(tr("Angles equal")); - - flagF2 = false; - ChangeColor(ui->labelEditF2, Qt::red); - ui->labelResultF2->setText(tr("Error")); - ui->labelResultF2->setToolTip(tr("Angles equal")); - } - - DialogArc::CheckState(); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogarc.h b/src/libs/vtools/dialogs/tools/dialogarc.h index 67d14009d..2f444f4a4 100644 --- a/src/libs/vtools/dialogs/tools/dialogarc.h +++ b/src/libs/vtools/dialogs/tools/dialogarc.h @@ -139,7 +139,6 @@ private: void EvalRadius(); void EvalF(); - void CheckAngles(); }; #endif // DIALOGARC_H diff --git a/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp b/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp index b823a0355..f3fac738e 100644 --- a/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp @@ -408,32 +408,6 @@ void DialogEllipticalArc::EvalAngles() labelEditFormula = ui->labelEditRotationAngle; angleRotation = Eval(ui->plainTextEditRotationAngle->toPlainText(), flagRotationAngle, ui->labelResultRotationAngle, degreeSymbol, false); - - CheckAngles(); -} - -//--------------------------------------------------------------------------------------------------------------------- -void DialogEllipticalArc::CheckAngles() -{ - if (static_cast(angleF1) == INT_MIN || static_cast(angleF2) == INT_MIN) - { - return; - } - - if (VFuzzyComparePossibleNulls(angleF1, angleF2)) - { - flagF1 = false; - ChangeColor(ui->labelEditF1, Qt::red); - ui->labelResultF1->setText(tr("Error")); - ui->labelResultF1->setToolTip(tr("Angles equal")); - - flagF2 = false; - ChangeColor(ui->labelEditF2, Qt::red); - ui->labelResultF2->setText(tr("Error")); - ui->labelResultF2->setToolTip(tr("Angles equal")); - } - - DialogEllipticalArc::CheckState(); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogellipticalarc.h b/src/libs/vtools/dialogs/tools/dialogellipticalarc.h index 653a20fef..2df6e0017 100644 --- a/src/libs/vtools/dialogs/tools/dialogellipticalarc.h +++ b/src/libs/vtools/dialogs/tools/dialogellipticalarc.h @@ -170,7 +170,6 @@ private: void EvalRadiuses(); void EvalAngles(); - void CheckAngles(); }; #endif // DIALOGELLIPTICALARC_H diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp index e62656edc..369323398 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp @@ -232,11 +232,8 @@ void VToolArc::SetFormulaF1(const VFormula &value) QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); QSharedPointer arc = qSharedPointerDynamicCast(obj); - if (not VFuzzyComparePossibleNulls(value.getDoubleValue(), arc->GetEndAngle()))// Angles can't be equal - { - arc->SetFormulaF1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); - SaveOption(obj); - } + arc->SetFormulaF1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); + SaveOption(obj); } } @@ -260,11 +257,8 @@ void VToolArc::SetFormulaF2(const VFormula &value) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); QSharedPointer arc = qSharedPointerDynamicCast(obj); - if (not VFuzzyComparePossibleNulls(value.getDoubleValue(), arc->GetStartAngle()))// Angles can't be equal - { - arc->SetFormulaF2(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); - SaveOption(obj); - } + arc->SetFormulaF2(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); + SaveOption(obj); } }