Allow an arc to have the same start and end angles.

In such a case full circle will be drawn.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-11-15 13:22:16 +02:00
parent 12761dcfa6
commit 016883110f
5 changed files with 4 additions and 64 deletions

View File

@ -423,32 +423,6 @@ void DialogArc::EvalF()
labelEditFormula = ui->labelEditF2; labelEditFormula = ui->labelEditF2;
angleF2 = Eval(ui->plainTextEditF2->toPlainText(), flagF2, ui->labelResultF2, degreeSymbol, false); angleF2 = Eval(ui->plainTextEditF2->toPlainText(), flagF2, ui->labelResultF2, degreeSymbol, false);
CheckAngles();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::CheckAngles()
{
if (static_cast<int>(angleF1) == INT_MIN || static_cast<int>(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();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -139,7 +139,6 @@ private:
void EvalRadius(); void EvalRadius();
void EvalF(); void EvalF();
void CheckAngles();
}; };
#endif // DIALOGARC_H #endif // DIALOGARC_H

View File

@ -408,32 +408,6 @@ void DialogEllipticalArc::EvalAngles()
labelEditFormula = ui->labelEditRotationAngle; labelEditFormula = ui->labelEditRotationAngle;
angleRotation = Eval(ui->plainTextEditRotationAngle->toPlainText(), flagRotationAngle, angleRotation = Eval(ui->plainTextEditRotationAngle->toPlainText(), flagRotationAngle,
ui->labelResultRotationAngle, degreeSymbol, false); ui->labelResultRotationAngle, degreeSymbol, false);
CheckAngles();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::CheckAngles()
{
if (static_cast<int>(angleF1) == INT_MIN || static_cast<int>(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();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -170,7 +170,6 @@ private:
void EvalRadiuses(); void EvalRadiuses();
void EvalAngles(); void EvalAngles();
void CheckAngles();
}; };
#endif // DIALOGELLIPTICALARC_H #endif // DIALOGELLIPTICALARC_H

View File

@ -232,12 +232,9 @@ void VToolArc::SetFormulaF1(const VFormula &value)
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id); QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj); QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
if (not VFuzzyComparePossibleNulls(value.getDoubleValue(), arc->GetEndAngle()))// Angles can't be equal
{
arc->SetFormulaF1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); arc->SetFormulaF1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue());
SaveOption(obj); SaveOption(obj);
} }
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -260,12 +257,9 @@ void VToolArc::SetFormulaF2(const VFormula &value)
{ {
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id); QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj); QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
if (not VFuzzyComparePossibleNulls(value.getDoubleValue(), arc->GetStartAngle()))// Angles can't be equal
{
arc->SetFormulaF2(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); arc->SetFormulaF2(value.GetFormula(FormulaType::FromUser), value.getDoubleValue());
SaveOption(obj); SaveOption(obj);
} }
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------