Refactoring.

This commit is contained in:
Roman Telezhynskyi 2022-08-22 10:23:51 +03:00
parent cf4145dd94
commit 4d104a789e
28 changed files with 60 additions and 61 deletions

View File

@ -204,7 +204,7 @@ void VToolFlippingByAxis::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolFlippingByAxis *visual = qobject_cast<VisToolFlippingByAxis *>(vis); auto *visual = qobject_cast<VisToolFlippingByAxis *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->SetObjects(SourceToObjects(source)); visual->SetObjects(SourceToObjects(source));

View File

@ -189,7 +189,7 @@ void VToolFlippingByLine::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolFlippingByLine *visual = qobject_cast<VisToolFlippingByLine *>(vis); auto *visual = qobject_cast<VisToolFlippingByLine *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->SetObjects(SourceToObjects(source)); visual->SetObjects(SourceToObjects(source));

View File

@ -457,17 +457,16 @@ void VToolMove::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolMove *visual = qobject_cast<VisToolMove *>(vis); auto *visual = qobject_cast<VisToolMove *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
const bool osSeparator = VAbstractApplication::VApp()->Settings()->GetOsSeparator();
const VTranslateVars *trVars = VAbstractApplication::VApp()->TrVars();
visual->SetObjects(SourceToObjects(source)); visual->SetObjects(SourceToObjects(source));
visual->SetAngle(VAbstractApplication::VApp()->TrVars() visual->SetAngle(trVars->FormulaToUser(formulaAngle, osSeparator));
->FormulaToUser(formulaAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator())); visual->SetRotationAngle(trVars->FormulaToUser(formulaRotationAngle, osSeparator));
visual->SetRotationAngle(VAbstractApplication::VApp()->TrVars() visual->SetLength(trVars->FormulaToUser(formulaLength, osSeparator));
->FormulaToUser(formulaRotationAngle,
VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->SetLength(VAbstractApplication::VApp()->TrVars()
->FormulaToUser(formulaLength, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->SetRotationOriginPointId(origPointId); visual->SetRotationOriginPointId(origPointId);
visual->RefreshGeometry(); visual->RefreshGeometry();
} }

View File

@ -339,7 +339,7 @@ void VToolRotation::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolRotation *visual = qobject_cast<VisToolRotation *>(vis); auto *visual = qobject_cast<VisToolRotation *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->SetObjects(SourceToObjects(source)); visual->SetObjects(SourceToObjects(source));

View File

@ -371,14 +371,13 @@ void VToolArc::SetVisualization()
auto *visual = qobject_cast<VisToolArc *>(vis); auto *visual = qobject_cast<VisToolArc *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
const bool osSeparator = VAbstractApplication::VApp()->Settings()->GetOsSeparator();
const VTranslateVars *trVars = VAbstractApplication::VApp()->TrVars(); const VTranslateVars *trVars = VAbstractApplication::VApp()->TrVars();
visual->setObject1Id(arc->GetCenter().id()); visual->setObject1Id(arc->GetCenter().id());
visual->setRadius(trVars->FormulaToUser( visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius(), osSeparator));
arc->GetFormulaRadius(), VAbstractApplication::VApp()->Settings()->GetOsSeparator())); visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1(), osSeparator));
visual->setF1(trVars->FormulaToUser( visual->setF2(trVars->FormulaToUser(arc->GetFormulaF2(), osSeparator));
arc->GetFormulaF1(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->setF2(trVars->FormulaToUser(
arc->GetFormulaF2(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->setLineStyle(LineStyleToPenStyle(arc->GetPenStyle())); visual->setLineStyle(LineStyleToPenStyle(arc->GetPenStyle()));
visual->setApproximationScale(arc->GetApproximationScale()); visual->setApproximationScale(arc->GetApproximationScale());
visual->SetMode(Mode::Show); visual->SetMode(Mode::Show);

View File

@ -350,14 +350,13 @@ void VToolArcWithLength::SetVisualization()
auto *visual = qobject_cast<VisToolArcWithLength *>(vis); auto *visual = qobject_cast<VisToolArcWithLength *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
const bool osSeparator = VAbstractApplication::VApp()->Settings()->GetOsSeparator();
const VTranslateVars *trVars = VAbstractApplication::VApp()->TrVars(); const VTranslateVars *trVars = VAbstractApplication::VApp()->TrVars();
visual->setObject1Id(arc->GetCenter().id()); visual->setObject1Id(arc->GetCenter().id());
visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius(), visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius(), osSeparator));
VAbstractApplication::VApp()->Settings()->GetOsSeparator())); visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1(), osSeparator));
visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1(), visual->setLength(trVars->FormulaToUser(arc->GetFormulaLength(), osSeparator));
VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->setLength(trVars->FormulaToUser(arc->GetFormulaLength(),
VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->setLineStyle(LineStyleToPenStyle(arc->GetPenStyle())); visual->setLineStyle(LineStyleToPenStyle(arc->GetPenStyle()));
visual->setApproximationScale(arc->GetApproximationScale()); visual->setApproximationScale(arc->GetApproximationScale());
visual->SetMode(Mode::Show); visual->SetMode(Mode::Show);

View File

@ -417,21 +417,18 @@ void VToolEllipticalArc::SetVisualization()
if (not vis.isNull()) if (not vis.isNull())
{ {
const QSharedPointer<VEllipticalArc> elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(m_id); const QSharedPointer<VEllipticalArc> elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(m_id);
VisToolEllipticalArc *visual = qobject_cast<VisToolEllipticalArc *>(vis); auto *visual = qobject_cast<VisToolEllipticalArc *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
const bool osSeparator = VAbstractApplication::VApp()->Settings()->GetOsSeparator();
const VTranslateVars *trVars = VAbstractApplication::VApp()->TrVars(); const VTranslateVars *trVars = VAbstractApplication::VApp()->TrVars();
visual->setObject1Id(elArc->GetCenter().id()); visual->setObject1Id(elArc->GetCenter().id());
visual->setRadius1(trVars->FormulaToUser(elArc->GetFormulaRadius1(), visual->setRadius1(trVars->FormulaToUser(elArc->GetFormulaRadius1(), osSeparator));
VAbstractApplication::VApp()->Settings()->GetOsSeparator())); visual->setRadius2(trVars->FormulaToUser(elArc->GetFormulaRadius2(), osSeparator));
visual->setRadius2(trVars->FormulaToUser(elArc->GetFormulaRadius2(), visual->setF1(trVars->FormulaToUser(elArc->GetFormulaF1(), osSeparator));
VAbstractApplication::VApp()->Settings()->GetOsSeparator())); visual->setF2(trVars->FormulaToUser(elArc->GetFormulaF2(), osSeparator));
visual->setF1(trVars->FormulaToUser(elArc->GetFormulaF1(), visual->setRotationAngle(trVars->FormulaToUser(elArc->GetFormulaRotationAngle(), osSeparator));
VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->setF2(trVars->FormulaToUser(elArc->GetFormulaF2(),
VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->setRotationAngle(trVars->FormulaToUser(elArc->GetFormulaRotationAngle(),
VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->setLineStyle(LineStyleToPenStyle(elArc->GetPenStyle())); visual->setLineStyle(LineStyleToPenStyle(elArc->GetPenStyle()));
visual->RefreshGeometry(); visual->RefreshGeometry();
} }

View File

@ -539,7 +539,7 @@ void VToolSpline::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolSpline *visual = qobject_cast<VisToolSpline *>(vis); auto *visual = qobject_cast<VisToolSpline *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(m_id); const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(m_id);

View File

@ -748,7 +748,7 @@ void VToolSplinePath::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolSplinePath *visual = qobject_cast<VisToolSplinePath *>(vis); auto *visual = qobject_cast<VisToolSplinePath *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(m_id); QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(m_id);

View File

@ -324,7 +324,7 @@ void VToolTrueDarts::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolTrueDarts *visual = qobject_cast<VisToolTrueDarts *>(vis); auto *visual = qobject_cast<VisToolTrueDarts *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(baseLineP1Id); visual->setObject1Id(baseLineP1Id);

View File

@ -267,7 +267,7 @@ void VToolCutArc::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolCutArc *visual = qobject_cast<VisToolCutArc *>(vis); auto *visual = qobject_cast<VisToolCutArc *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(baseCurveId); visual->setObject1Id(baseCurveId);

View File

@ -360,7 +360,7 @@ void VToolCutSplinePath::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolCutSplinePath *visual = qobject_cast<VisToolCutSplinePath *>(vis); auto *visual = qobject_cast<VisToolCutSplinePath *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(baseCurveId); visual->setObject1Id(baseCurveId);

View File

@ -298,7 +298,7 @@ void VToolBisector::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolBisector *visual = qobject_cast<VisToolBisector *>(vis); auto *visual = qobject_cast<VisToolBisector *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(firstPointId); visual->setObject1Id(firstPointId);

View File

@ -225,14 +225,15 @@ void VToolEndLine::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolEndLine *visual = qobject_cast<VisToolEndLine *>(vis); auto *visual = qobject_cast<VisToolEndLine *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
const bool osSeparator = VAbstractApplication::VApp()->Settings()->GetOsSeparator();
const VTranslateVars *trVars = VAbstractApplication::VApp()->TrVars();
visual->setObject1Id(basePointId); visual->setObject1Id(basePointId);
visual->setLength(VAbstractApplication::VApp()->TrVars() visual->setLength(trVars->FormulaToUser(formulaLength, osSeparator));
->FormulaToUser(formulaLength, VAbstractApplication::VApp()->Settings()->GetOsSeparator())); visual->SetAngle(trVars->FormulaToUser(formulaAngle, osSeparator));
visual->SetAngle(VAbstractApplication::VApp()->TrVars()
->FormulaToUser(formulaAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->setLineStyle(LineStyleToPenStyle(m_lineType)); visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->SetMode(Mode::Show); visual->SetMode(Mode::Show);
visual->RefreshGeometry(); visual->RefreshGeometry();

View File

@ -257,7 +257,7 @@ void VToolHeight::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolHeight *visual = qobject_cast<VisToolHeight *>(vis); auto *visual = qobject_cast<VisToolHeight *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(basePointId); visual->setObject1Id(basePointId);

View File

@ -315,7 +315,7 @@ void VToolLineIntersectAxis::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolLineIntersectAxis *visual = qobject_cast<VisToolLineIntersectAxis *>(vis); auto *visual = qobject_cast<VisToolLineIntersectAxis *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(firstPointId); visual->setObject1Id(firstPointId);

View File

@ -268,7 +268,7 @@ void VToolNormal::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolNormal *visual = qobject_cast<VisToolNormal *>(vis); auto *visual = qobject_cast<VisToolNormal *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(basePointId); visual->setObject1Id(basePointId);

View File

@ -318,7 +318,7 @@ void VToolShoulderPoint::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolShoulderPoint *visual = qobject_cast<VisToolShoulderPoint *>(vis); auto *visual = qobject_cast<VisToolShoulderPoint *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(pShoulder); visual->setObject1Id(pShoulder);

View File

@ -293,7 +293,7 @@ void VToolLineIntersect::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolLineIntersect *visual = qobject_cast<VisToolLineIntersect *>(vis); auto *visual = qobject_cast<VisToolLineIntersect *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(p1Line1); visual->setObject1Id(p1Line1);

View File

@ -331,7 +331,7 @@ void VToolPointFromArcAndTangent::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolPointFromArcAndTangent *visual = qobject_cast<VisToolPointFromArcAndTangent *>(vis); auto *visual = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(tangentPointId); visual->setObject1Id(tangentPointId);

View File

@ -325,7 +325,7 @@ void VToolPointFromCircleAndTangent::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolPointFromCircleAndTangent *visual = qobject_cast<VisToolPointFromCircleAndTangent *>(vis); auto *visual = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(tangentPointId); visual->setObject1Id(tangentPointId);

View File

@ -348,7 +348,7 @@ void VToolPointOfContact::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolPointOfContact *visual = qobject_cast<VisToolPointOfContact *>(vis); auto *visual = qobject_cast<VisToolPointOfContact *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(firstPointId); visual->setObject1Id(firstPointId);

View File

@ -237,7 +237,7 @@ void VToolPointOfIntersection::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolPointOfIntersection *visual = qobject_cast<VisToolPointOfIntersection *>(vis); auto *visual = qobject_cast<VisToolPointOfIntersection *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(firstPointId); visual->setObject1Id(firstPointId);

View File

@ -351,7 +351,7 @@ void VToolPointOfIntersectionArcs::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolPointOfIntersectionArcs *visual = qobject_cast<VisToolPointOfIntersectionArcs *>(vis); auto *visual = qobject_cast<VisToolPointOfIntersectionArcs *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setArc1Id(firstArcId); visual->setArc1Id(firstArcId);

View File

@ -367,13 +367,17 @@ void VToolPointOfIntersectionCircles::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolPointOfIntersectionCircles *visual = qobject_cast<VisToolPointOfIntersectionCircles *>(vis); auto *visual = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(firstCircleCenterId); visual->setObject1Id(firstCircleCenterId);
visual->setObject2Id(secondCircleCenterId); visual->setObject2Id(secondCircleCenterId);
visual->setC1Radius(firstCircleRadius);
visual->setC2Radius(secondCircleRadius); const bool osSeparator = VAbstractApplication::VApp()->Settings()->GetOsSeparator();
const VTranslateVars *trVars = VAbstractApplication::VApp()->TrVars();
visual->setC1Radius(trVars->FormulaToUser(firstCircleRadius, osSeparator));
visual->setC2Radius(trVars->FormulaToUser(secondCircleRadius, osSeparator));
visual->setCrossPoint(crossPoint); visual->setCrossPoint(crossPoint);
visual->RefreshGeometry(); visual->RefreshGeometry();
} }

View File

@ -338,7 +338,7 @@ void VToolTriangle::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolTriangle * visual = qobject_cast<VisToolTriangle *>(vis); auto * visual = qobject_cast<VisToolTriangle *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(axisP1Id); visual->setObject1Id(axisP1Id);

View File

@ -423,7 +423,7 @@ void VToolLine::SetVisualization()
{ {
if (not vis.isNull()) if (not vis.isNull())
{ {
VisToolLine *visual = qobject_cast<VisToolLine *>(vis); auto *visual = qobject_cast<VisToolLine *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setObject1Id(firstPoint); visual->setObject1Id(firstPoint);

View File

@ -55,7 +55,7 @@ public:
void setC2Radius(const QString &value); void setC2Radius(const QString &value);
void setCrossPoint(const CrossCirclesPoint &value); void setCrossPoint(const CrossCirclesPoint &value);
auto type() const -> int override {return Type;} auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolPointOfIntersectionCircles)}; enum {Type = UserType + static_cast<int>(Vis::ToolPointOfIntersectionCircles)};
private: private:
// cppcheck-suppress unknownMacro // cppcheck-suppress unknownMacro