Refactoring.

This commit is contained in:
Roman Telezhynskyi 2022-08-23 16:37:58 +03:00
parent b9a2a6715b
commit c10279c7e1
151 changed files with 2917 additions and 2507 deletions

View File

@ -225,10 +225,10 @@ void DialogAlongLine::SaveData()
auto *line = qobject_cast<VisToolAlongLine *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(GetFirstPointId());
line->setObject2Id(GetSecondPointId());
line->setLength(m_formula);
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->SetPoint1Id(GetFirstPointId());
line->SetPoint2Id(GetSecondPointId());
line->SetLength(m_formula);
line->SetLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}
@ -274,7 +274,7 @@ void DialogAlongLine::ChosenSecondPoint(quint32 id, const QString &toolTip)
if (m_flagError)
{
line->setObject2Id(id);
line->SetPoint2Id(id);
if (m_buildMidpoint)
{
SetFormula(currentLength + QStringLiteral("/2"));
@ -316,7 +316,7 @@ void DialogAlongLine::SetSecondPointId(quint32 value)
auto *line = qobject_cast<VisToolAlongLine *>(vis);
SCASSERT(line != nullptr)
line->setObject2Id(value);
line->SetPoint2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -339,7 +339,7 @@ void DialogAlongLine::Build(const Tool &type)
m_buildMidpoint = true;
auto *line = qobject_cast<VisToolAlongLine *>(vis);
SCASSERT(line != nullptr)
line->setMidPointMode(m_buildMidpoint);
line->SetMidPointMode(m_buildMidpoint);
}
}
@ -407,7 +407,7 @@ void DialogAlongLine::SetFirstPointId(quint32 value)
auto *line = qobject_cast<VisToolAlongLine *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(value);
line->SetPoint1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -428,7 +428,7 @@ void DialogAlongLine::SetFormula(const QString &value)
auto *line = qobject_cast<VisToolAlongLine *>(vis);
SCASSERT(line != nullptr)
line->setLength(m_formula);
line->SetLength(m_formula);
MoveCursorToEnd(ui->plainTextEditFormula);
}
@ -441,7 +441,7 @@ void DialogAlongLine::SetFormula(const QString &value)
void DialogAlongLine::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(LineStyleToPenStyle(value));
vis->SetLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -154,7 +154,10 @@ DialogArc::~DialogArc()
void DialogArc::SetCenter(const quint32 &value)
{
ChangeCurrentData(ui->comboBoxBasePoint, value);
vis->setObject1Id(value);
auto *path = qobject_cast<VisToolArc *>(vis);
SCASSERT(path != nullptr)
path->SetCenterId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -175,7 +178,7 @@ void DialogArc::SetF2(const QString &value)
auto *path = qobject_cast<VisToolArc *>(vis);
SCASSERT(path != nullptr)
path->setF2(m_f2);
path->SetF2(m_f2);
MoveCursorToEnd(ui->plainTextEditF2);
}
@ -217,7 +220,7 @@ void DialogArc::SetApproximationScale(qreal value)
auto *path = qobject_cast<VisToolArc *>(vis);
SCASSERT(path != nullptr)
path->setApproximationScale(value);
path->SetApproximationScale(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -343,7 +346,7 @@ void DialogArc::SetF1(const QString &value)
auto *path = qobject_cast<VisToolArc *>(vis);
SCASSERT(path != nullptr)
path->setF1(m_f1);
path->SetF1(m_f1);
MoveCursorToEnd(ui->plainTextEditF1);
}
@ -366,7 +369,7 @@ void DialogArc::SetRadius(const QString &value)
auto *path = qobject_cast<VisToolArc *>(vis);
SCASSERT(path != nullptr)
path->setRadius(m_radius);
path->SetRadius(m_radius);
MoveCursorToEnd(ui->plainTextEditFormula);
}
@ -418,11 +421,11 @@ void DialogArc::SaveData()
auto *path = qobject_cast<VisToolArc *>(vis);
SCASSERT(path != nullptr)
path->setObject1Id(GetCenter());
path->setRadius(m_radius);
path->setF1(m_f1);
path->setF2(m_f2);
path->setApproximationScale(ui->doubleSpinBoxApproximationScale->value());
path->SetCenterId(GetCenter());
path->SetRadius(m_radius);
path->SetF1(m_f1);
path->SetF2(m_f2);
path->SetApproximationScale(ui->doubleSpinBoxApproximationScale->value());
path->RefreshGeometry();
}

View File

@ -133,7 +133,9 @@ auto DialogArcWithLength::GetCenter() const -> quint32
void DialogArcWithLength::SetCenter(const quint32 &value)
{
ChangeCurrentData(ui->comboBoxCenter, value);
vis->setObject1Id(value);
auto *path = qobject_cast<VisToolArcWithLength *>(vis);
SCASSERT(path != nullptr)
path->SetCenterId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -156,7 +158,7 @@ void DialogArcWithLength::SetRadius(const QString &value)
auto *path = qobject_cast<VisToolArcWithLength *>(vis);
SCASSERT(path != nullptr)
path->setRadius(radius);
path->SetRadius(radius);
MoveCursorToEnd(ui->plainTextEditRadius);
}
@ -181,7 +183,7 @@ void DialogArcWithLength::SetF1(const QString &value)
auto *path = qobject_cast<VisToolArcWithLength *>(vis);
SCASSERT(path != nullptr)
path->setF1(f1);
path->SetF1(f1);
MoveCursorToEnd(ui->plainTextEditF1);
}
@ -206,7 +208,7 @@ void DialogArcWithLength::SetLength(const QString &value)
auto *path = qobject_cast<VisToolArcWithLength *>(vis);
SCASSERT(path != nullptr)
path->setLength(length);
path->SetLength(length);
MoveCursorToEnd(ui->plainTextEditLength);
}
@ -248,7 +250,7 @@ void DialogArcWithLength::SetApproximationScale(qreal value)
auto *path = qobject_cast<VisToolArcWithLength *>(vis);
SCASSERT(path != nullptr)
path->setApproximationScale(value);
path->SetApproximationScale(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -462,11 +464,11 @@ void DialogArcWithLength::SaveData()
auto *path = qobject_cast<VisToolArcWithLength *>(vis);
SCASSERT(path != nullptr)
path->setObject1Id(GetCenter());
path->setRadius(radius);
path->setF1(f1);
path->setLength(length);
path->setApproximationScale(ui->doubleSpinBoxApproximationScale->value());
path->SetCenterId(GetCenter());
path->SetRadius(radius);
path->SetF1(f1);
path->SetLength(length);
path->SetApproximationScale(ui->doubleSpinBoxApproximationScale->value());
path->RefreshGeometry();
}

View File

@ -218,7 +218,7 @@ void DialogBisector::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxSecondPoint, tr("Select third point of angle")))
{
m_number++;
line->setObject2Id(id);
line->SetPoint2Id(id);
line->RefreshGeometry();
}
}
@ -251,7 +251,7 @@ void DialogBisector::SetPointName(const QString &value)
void DialogBisector::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(LineStyleToPenStyle(value));
vis->SetLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -272,7 +272,7 @@ void DialogBisector::SetFormula(const QString &value)
auto *line = qobject_cast<VisToolBisector *>(vis);
SCASSERT(line != nullptr)
line->setLength(m_formula);
line->SetLength(m_formula);
MoveCursorToEnd(ui->plainTextEditFormula);
}
@ -288,7 +288,7 @@ void DialogBisector::SetFirstPointId(const quint32 &value)
auto *line = qobject_cast<VisToolBisector *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(value);
line->SetPoint1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -302,7 +302,7 @@ void DialogBisector::SetSecondPointId(const quint32 &value)
auto *line = qobject_cast<VisToolBisector *>(vis);
SCASSERT(line != nullptr)
line->setObject2Id(value);
line->SetPoint2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -316,7 +316,7 @@ void DialogBisector::SetThirdPointId(const quint32 &value)
auto *line = qobject_cast<VisToolBisector *>(vis);
SCASSERT(line != nullptr)
line->setObject3Id(value);
line->SetPoint3Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -412,11 +412,11 @@ void DialogBisector::SaveData()
auto *line = qobject_cast<VisToolBisector *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(GetFirstPointId());
line->setObject2Id(GetSecondPointId());
line->setObject3Id(GetThirdPointId());
line->setLength(m_formula);
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->SetPoint1Id(GetFirstPointId());
line->SetPoint2Id(GetSecondPointId());
line->SetPoint3Id(GetThirdPointId());
line->SetLength(m_formula);
line->SetLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}
@ -447,7 +447,7 @@ void DialogBisector::ChosenThirdPoint(quint32 id)
SCASSERT(line != nullptr)
connect(line, &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
line->setObject3Id(id);
line->SetPoint3Id(id);
line->RefreshGeometry();
prepare = true;
}

View File

@ -35,7 +35,6 @@
#include <QPointer>
#include <new>
#include "../../tools/vabstracttool.h"
#include "../../visualization/path/vistoolcubicbezier.h"
#include "../../visualization/visualization.h"
#include "../vgeometry/vpointf.h"
@ -115,11 +114,11 @@ void DialogCubicBezier::SetSpline(const VCubicBezier &spline)
auto path = qobject_cast<VisToolCubicBezier *>(vis);
SCASSERT(path != nullptr)
path->setApproximationScale(spl.GetApproximationScale());
path->setObject1Id(spl.GetP1().id());
path->setObject2Id(spl.GetP2().id());
path->setObject3Id(spl.GetP3().id());
path->setObject4Id(spl.GetP4().id());
path->SetApproximationScale(spl.GetApproximationScale());
path->SetPoint1Id(spl.GetP1().id());
path->SetPoint2Id(spl.GetP2().id());
path->SetPoint3Id(spl.GetP3().id());
path->SetPoint4Id(spl.GetP4().id());
}
//---------------------------------------------------------------------------------------------------------------------
@ -146,7 +145,7 @@ void DialogCubicBezier::ChosenObject(quint32 id, const SceneObject &type)
{
++number;
path->setObject2Id(id);
path->SetPoint2Id(id);
path->RefreshGeometry();
}
break;
@ -155,7 +154,7 @@ void DialogCubicBezier::ChosenObject(quint32 id, const SceneObject &type)
{
++number;
path->setObject3Id(id);
path->SetPoint3Id(id);
path->RefreshGeometry();
}
break;
@ -166,7 +165,7 @@ void DialogCubicBezier::ChosenObject(quint32 id, const SceneObject &type)
{
++number;
path->setObject4Id(id);
path->SetPoint4Id(id);
path->RefreshGeometry();
prepare = true;
DialogAccepted();
@ -255,11 +254,11 @@ void DialogCubicBezier::SaveData()
auto path = qobject_cast<VisToolCubicBezier *>(vis);
SCASSERT(path != nullptr)
path->setApproximationScale(ui->doubleSpinBoxApproximationScale->value());
path->setObject1Id(p1->id());
path->setObject2Id(p2->id());
path->setObject3Id(p3->id());
path->setObject4Id(p4->id());
path->SetApproximationScale(ui->doubleSpinBoxApproximationScale->value());
path->SetPoint1Id(p1->id());
path->SetPoint2Id(p2->id());
path->SetPoint3Id(p3->id());
path->SetPoint4Id(p4->id());
path->SetMode(Mode::Show);
path->RefreshGeometry();
}

View File

@ -44,12 +44,10 @@
#include <Qt>
#include <new>
#include "../../tools/vabstracttool.h"
#include "../../visualization/path/vistoolcubicbezierpath.h"
#include "../../visualization/visualization.h"
#include "../ifc/ifcdef.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vmath.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
@ -127,7 +125,7 @@ void DialogCubicBezierPath::SetPath(const VCubicBezierPath &value)
auto visPath = qobject_cast<VisToolCubicBezierPath *>(vis);
SCASSERT(visPath != nullptr)
visPath->setPath(path);
visPath->SetPath(path);
ui->listWidget->blockSignals(false);
if (ui->listWidget->count() > 0)
@ -155,7 +153,7 @@ void DialogCubicBezierPath::ChosenObject(quint32 id, const SceneObject &type)
auto visPath = qobject_cast<VisToolCubicBezierPath *>(vis);
SCASSERT(visPath != nullptr)
visPath->setPath(path);
visPath->SetPath(path);
if (path.CountPoints() == 1)
{
@ -215,7 +213,7 @@ void DialogCubicBezierPath::SaveData()
auto visPath = qobject_cast<VisToolCubicBezierPath *>(vis);
SCASSERT(visPath != nullptr)
visPath->setPath(path);
visPath->SetPath(path);
visPath->SetMode(Mode::Show);
visPath->RefreshGeometry();
}

View File

@ -136,7 +136,7 @@ QString DialogCurveIntersectAxis::GetTypeLine() const
void DialogCurveIntersectAxis::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(LineStyleToPenStyle(value));
vis->SetLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -194,7 +194,7 @@ void DialogCurveIntersectAxis::setCurveId(quint32 value)
VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(value);
line->SetCurveId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -342,10 +342,10 @@ void DialogCurveIntersectAxis::SaveData()
VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(getCurveId());
line->SetCurveId(getCurveId());
line->setAxisPointId(GetBasePointId());
line->SetAngle(formulaAngle);
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->SetLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}

View File

@ -190,8 +190,8 @@ void DialogCutArc::SaveData()
auto *path = qobject_cast<VisToolCutArc *>(vis);
SCASSERT(path != nullptr)
path->setObject1Id(getArcId());
path->setLength(m_formula);
path->SetArcId(getArcId());
path->SetLength(m_formula);
path->RefreshGeometry();
}
@ -261,7 +261,7 @@ void DialogCutArc::setArcId(quint32 value)
auto *path = qobject_cast<VisToolCutArc *>(vis);
SCASSERT(path != nullptr)
path->setObject1Id(value);
path->SetArcId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -282,7 +282,7 @@ void DialogCutArc::SetFormula(const QString &value)
auto *path = qobject_cast<VisToolCutArc *>(vis);
SCASSERT(path != nullptr)
path->setLength(m_formula);
path->SetLength(m_formula);
MoveCursorToEnd(ui->plainTextEditFormula);
}

View File

@ -140,7 +140,7 @@ void DialogCutSpline::SetFormula(const QString &value)
auto *path = qobject_cast<VisToolCutSpline *>(vis);
SCASSERT(path != nullptr)
path->setLength(m_formula);
path->SetLength(m_formula);
MoveCursorToEnd(ui->plainTextEditFormula);
}
@ -156,7 +156,7 @@ void DialogCutSpline::setSplineId(quint32 value)
auto *path = qobject_cast<VisToolCutSpline *>(vis);
SCASSERT(path != nullptr)
path->setObject1Id(value);
path->SetSplineId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -198,8 +198,8 @@ void DialogCutSpline::SaveData()
auto *path = qobject_cast<VisToolCutSpline *>(vis);
SCASSERT(path != nullptr)
path->setObject1Id(getSplineId());
path->setLength(m_formula);
path->SetSplineId(getSplineId());
path->SetLength(m_formula);
path->RefreshGeometry();
}

View File

@ -140,7 +140,7 @@ void DialogCutSplinePath::SetFormula(const QString &value)
auto *path = qobject_cast<VisToolCutSplinePath *>(vis);
SCASSERT(path != nullptr)
path->setLength(m_formula);
path->SetLength(m_formula);
MoveCursorToEnd(ui->plainTextEditFormula);
}
@ -156,7 +156,7 @@ void DialogCutSplinePath::setSplinePathId(quint32 value)
auto *path = qobject_cast<VisToolCutSplinePath *>(vis);
SCASSERT(path != nullptr)
path->setObject1Id(value);
path->SetSplinePathId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -198,8 +198,8 @@ void DialogCutSplinePath::SaveData()
auto *path = qobject_cast<VisToolCutSplinePath *>(vis);
SCASSERT(path != nullptr)
path->setObject1Id(getSplinePathId());
path->setLength(m_formula);
path->SetSplinePathId(getSplinePathId());
path->SetLength(m_formula);
path->RefreshGeometry();
}

View File

@ -38,8 +38,6 @@
#include <QToolButton>
#include <Qt>
#include "../../tools/vabstracttool.h"
#include "../ifc/xml/vdomdocument.h"
#include "../vpatterndb/vtranslatevars.h"
#include "../../visualization/path/vistoolellipticalarc.h"
#include "../../visualization/visualization.h"
@ -49,6 +47,7 @@
#include "ui_dialogellipticalarc.h"
#include "../vgeometry/vellipticalarc.h"
#include "../qmuparser/qmudef.h"
#include "../vpatterndb/vcontainer.h"
//---------------------------------------------------------------------------------------------------------------------
/**
@ -188,7 +187,10 @@ quint32 DialogEllipticalArc::GetCenter() const
void DialogEllipticalArc::SetCenter(const quint32 &value)
{
ChangeCurrentData(ui->comboBoxBasePoint, value);
vis->setObject1Id(value);
auto *path = qobject_cast<VisToolEllipticalArc *>(vis);
SCASSERT(path != nullptr)
path->SetCenterId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -219,7 +221,7 @@ void DialogEllipticalArc::SetRadius1(const QString &value)
VisToolEllipticalArc *path = qobject_cast<VisToolEllipticalArc *>(vis);
SCASSERT(path != nullptr)
path->setRadius1(radius1);
path->SetRadius1(radius1);
MoveCursorToEnd(ui->plainTextEditRadius1);
}
@ -252,7 +254,7 @@ void DialogEllipticalArc::SetRadius2(const QString &value)
VisToolEllipticalArc *path = qobject_cast<VisToolEllipticalArc *>(vis);
SCASSERT(path != nullptr)
path->setRadius2(radius2);
path->SetRadius2(radius2);
MoveCursorToEnd(ui->plainTextEditRadius2);
}
@ -285,7 +287,7 @@ void DialogEllipticalArc::SetF1(const QString &value)
VisToolEllipticalArc *path = qobject_cast<VisToolEllipticalArc *>(vis);
SCASSERT(path != nullptr)
path->setF1(f1);
path->SetF1(f1);
MoveCursorToEnd(ui->plainTextEditF1);
}
@ -318,7 +320,7 @@ void DialogEllipticalArc::SetF2(const QString &value)
VisToolEllipticalArc *path = qobject_cast<VisToolEllipticalArc *>(vis);
SCASSERT(path != nullptr)
path->setF2(f2);
path->SetF2(f2);
MoveCursorToEnd(ui->plainTextEditF2);
}
@ -351,7 +353,7 @@ void DialogEllipticalArc::SetRotationAngle(const QString &value)
VisToolEllipticalArc *path = qobject_cast<VisToolEllipticalArc *>(vis);
SCASSERT(path != nullptr)
path->setRotationAngle(rotationAngle);
path->SetRotationAngle(rotationAngle);
MoveCursorToEnd(ui->plainTextEditRotationAngle);
}
@ -584,12 +586,12 @@ void DialogEllipticalArc::SaveData()
VisToolEllipticalArc *path = qobject_cast<VisToolEllipticalArc *>(vis);
SCASSERT(path != nullptr)
path->setObject1Id(GetCenter());
path->setRadius1(radius1);
path->setRadius2(radius2);
path->setF1(f1);
path->setF2(f2);
path->setRotationAngle(rotationAngle);
path->SetCenterId(GetCenter());
path->SetRadius1(radius1);
path->SetRadius2(radius2);
path->SetF1(f1);
path->SetF2(f2);
path->SetRotationAngle(rotationAngle);
path->RefreshGeometry();
}

View File

@ -245,7 +245,7 @@ void DialogEndLine::SetPointName(const QString &value)
void DialogEndLine::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(LineStyleToPenStyle(value));
vis->SetLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -267,7 +267,7 @@ void DialogEndLine::SetFormula(const QString &value)
auto *line = qobject_cast<VisToolEndLine *>(vis);
SCASSERT(line != nullptr)
line->setLength(formulaLength);
line->SetLength(formulaLength);
MoveCursorToEnd(ui->plainTextEditFormula);
}
@ -307,7 +307,7 @@ void DialogEndLine::SetBasePointId(const quint32 &value)
auto *line = qobject_cast<VisToolEndLine *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(value);
line->SetBasePointId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -382,10 +382,10 @@ void DialogEndLine::SaveData()
VisToolEndLine *line = qobject_cast<VisToolEndLine *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(GetBasePointId());
line->setLength(formulaLength);
line->SetBasePointId(GetBasePointId());
line->SetLength(formulaLength);
line->SetAngle(formulaAngle);
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->SetLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}

View File

@ -50,15 +50,10 @@
#include "../ifc/xml/vabstractpattern.h"
#include "../ifc/xml/vdomdocument.h"
#include "../qmuparser/qmudef.h"
#include "../vgeometry/vpointf.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vcommonsettings.h"
#include "../vmisc/compatibility.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vpatterndb/vcontainer.h"
#include "../vwidgets/vabstractmainwindow.h"
#include "../vwidgets/vmaingraphicsscene.h"
#include "../vwidgets/vmaingraphicsview.h"
#include "ui_dialogflippingbyaxis.h"

View File

@ -123,7 +123,7 @@ void DialogHeight::SetPointName(const QString &value)
void DialogHeight::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(LineStyleToPenStyle(value));
vis->SetLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -137,7 +137,7 @@ void DialogHeight::SetBasePointId(const quint32 &value)
auto *line = qobject_cast<VisToolHeight *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(value);
line->SetBasePointId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -151,7 +151,7 @@ void DialogHeight::SetP1LineId(const quint32 &value)
auto *line = qobject_cast<VisToolHeight *>(vis);
SCASSERT(line != nullptr)
line->setLineP1Id(value);
line->SetLineP1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -165,7 +165,7 @@ void DialogHeight::SetP2LineId(const quint32 &value)
auto *line = qobject_cast<VisToolHeight *>(vis);
SCASSERT(line != nullptr)
line->setLineP2Id(value);
line->SetLineP2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -213,7 +213,7 @@ void DialogHeight::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxP1Line, tr("Select second point of line")))
{
m_number++;
line->setLineP1Id(id);
line->SetLineP1Id(id);
line->RefreshGeometry();
}
}
@ -229,7 +229,7 @@ void DialogHeight::ChosenObject(quint32 id, const SceneObject &type)
{
if (SetObject(id, ui->comboBoxP2Line, QString()))
{
line->setLineP2Id(id);
line->SetLineP2Id(id);
line->RefreshGeometry();
prepare = true;
DialogAccepted();
@ -251,10 +251,10 @@ void DialogHeight::SaveData()
auto *line = qobject_cast<VisToolHeight *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(GetBasePointId());
line->setLineP1Id(GetP1LineId());
line->setLineP2Id(GetP2LineId());
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->SetBasePointId(GetBasePointId());
line->SetLineP1Id(GetP1LineId());
line->SetLineP2Id(GetP2LineId());
line->SetLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}

View File

@ -94,7 +94,7 @@ void DialogLine::SetSecondPoint(quint32 value)
VisToolLine *line = qobject_cast<VisToolLine *>(vis);
SCASSERT(line != nullptr)
line->setPoint2Id(value);
line->SetPoint2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -105,7 +105,7 @@ void DialogLine::SetSecondPoint(quint32 value)
void DialogLine::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(LineStyleToPenStyle(value));
vis->SetLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -131,7 +131,7 @@ void DialogLine::SetFirstPoint(quint32 value)
VisToolLine *line = qobject_cast<VisToolLine *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(value);
line->SetPoint1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -165,9 +165,9 @@ void DialogLine::SaveData()
VisToolLine *line = qobject_cast<VisToolLine *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(GetFirstPoint());
line->setPoint2Id(GetSecondPoint());
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->SetPoint1Id(GetFirstPoint());
line->SetPoint2Id(GetSecondPoint());
line->SetLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}

View File

@ -137,7 +137,7 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxP2Line1, tr("Select first point of second line")))
{
number++;
line->setLine1P2Id(id);
line->SetLine1P2Id(id);
line->RefreshGeometry();
}
}
@ -146,7 +146,7 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxP1Line2, tr("Select second point of second line")))
{
number++;
line->setLine2P1Id(id);
line->SetLine2P1Id(id);
line->RefreshGeometry();
}
break;
@ -162,7 +162,7 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
{
if (SetObject(id, ui->comboBoxP2Line2, QString()))
{
line->setLine2P2Id(id);
line->SetLine2P2Id(id);
line->RefreshGeometry();
prepare = true;
flagPoint = CheckIntersecion();
@ -203,10 +203,10 @@ void DialogLineIntersect::SaveData()
VisToolLineIntersect *line = qobject_cast<VisToolLineIntersect *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(GetP1Line1());
line->setLine1P2Id(GetP2Line1());
line->setLine2P1Id(GetP1Line2());
line->setLine2P2Id(GetP2Line2());
line->SetLine1P1Id(GetP1Line1());
line->SetLine1P2Id(GetP2Line1());
line->SetLine2P1Id(GetP1Line2());
line->SetLine2P2Id(GetP2Line2());
line->RefreshGeometry();
}
@ -308,7 +308,7 @@ void DialogLineIntersect::SetP2Line2(quint32 value)
VisToolLineIntersect *line = qobject_cast<VisToolLineIntersect *>(vis);
SCASSERT(line != nullptr)
line->setLine2P2Id(value);
line->SetLine2P2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -328,7 +328,7 @@ void DialogLineIntersect::SetP1Line2(quint32 value)
VisToolLineIntersect *line = qobject_cast<VisToolLineIntersect *>(vis);
SCASSERT(line != nullptr)
line->setLine2P1Id(value);
line->SetLine2P1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -342,7 +342,7 @@ void DialogLineIntersect::SetP2Line1(quint32 value)
VisToolLineIntersect *line = qobject_cast<VisToolLineIntersect *>(vis);
SCASSERT(line != nullptr)
line->setLine1P2Id(value);
line->SetLine1P2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -356,7 +356,7 @@ void DialogLineIntersect::SetP1Line1(quint32 value)
VisToolLineIntersect *line = qobject_cast<VisToolLineIntersect *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(value);
line->SetLine1P1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -144,7 +144,7 @@ QString DialogLineIntersectAxis::GetTypeLine() const
void DialogLineIntersectAxis::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(LineStyleToPenStyle(value));
vis->SetLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -186,7 +186,7 @@ void DialogLineIntersectAxis::SetBasePointId(quint32 value)
VisToolLineIntersectAxis *line = qobject_cast<VisToolLineIntersectAxis *>(vis);
SCASSERT(line != nullptr)
line->setAxisPointId(value);
line->SetAxisPointId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -202,7 +202,7 @@ void DialogLineIntersectAxis::SetFirstPointId(quint32 value)
VisToolLineIntersectAxis *line = qobject_cast<VisToolLineIntersectAxis *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(value);
line->SetPoint1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -218,7 +218,7 @@ void DialogLineIntersectAxis::SetSecondPointId(quint32 value)
VisToolLineIntersectAxis *line = qobject_cast<VisToolLineIntersectAxis *>(vis);
SCASSERT(line != nullptr)
line->setPoint2Id(value);
line->SetPoint2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -301,7 +301,7 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxSecondLinePoint, tr("Select axis point")))
{
number++;
line->setPoint2Id(id);
line->SetPoint2Id(id);
line->RefreshGeometry();
}
}
@ -317,7 +317,7 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
{
if (SetObject(id, ui->comboBoxAxisPoint, QString()))
{
line->setAxisPointId(id);
line->SetAxisPointId(id);
line->RefreshGeometry();
prepare = true;
}
@ -405,11 +405,11 @@ void DialogLineIntersectAxis::SaveData()
VisToolLineIntersectAxis *line = qobject_cast<VisToolLineIntersectAxis *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(GetFirstPointId());
line->setPoint2Id(GetSecondPointId());
line->setAxisPointId(GetBasePointId());
line->SetPoint1Id(GetFirstPointId());
line->SetPoint2Id(GetSecondPointId());
line->SetAxisPointId(GetBasePointId());
line->SetAngle(formulaAngle);
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->SetLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}

View File

@ -217,7 +217,7 @@ void DialogNormal::ChosenObject(quint32 id, const SceneObject &type)
{
if (SetObject(id, ui->comboBoxSecondPoint, QString()))
{
line->setObject2Id(id);
line->SetPoint2Id(id);
line->RefreshGeometry();
prepare = true;
@ -244,11 +244,11 @@ void DialogNormal::SaveData()
auto *line = qobject_cast<VisToolNormal *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(GetFirstPointId());
line->setObject2Id(GetSecondPointId());
line->setLength(m_formula);
line->SetPoint1Id(GetFirstPointId());
line->SetPoint2Id(GetSecondPointId());
line->SetLength(m_formula);
line->SetAngle(m_angle);
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->SetLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}
@ -270,7 +270,7 @@ void DialogNormal::SetSecondPointId(quint32 value)
auto *line = qobject_cast<VisToolNormal *>(vis);
SCASSERT(line != nullptr)
line->setObject2Id(value);
line->SetPoint2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -296,7 +296,7 @@ void DialogNormal::SetFirstPointId(quint32 value)
auto *line = qobject_cast<VisToolNormal *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(value);
line->SetPoint1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -332,7 +332,7 @@ void DialogNormal::SetFormula(const QString &value)
auto *line = qobject_cast<VisToolNormal *>(vis);
SCASSERT(line != nullptr)
line->setLength(m_formula);
line->SetLength(m_formula);
MoveCursorToEnd(ui->plainTextEditFormula);
}
@ -345,7 +345,7 @@ void DialogNormal::SetFormula(const QString &value)
void DialogNormal::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(LineStyleToPenStyle(value));
vis->SetLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -34,7 +34,6 @@
#include "../../visualization/visualization.h"
#include "../../visualization/line/vistoolpointfromarcandtangent.h"
#include "../vmisc/vabstractapplication.h"
#include "dialogs/tools/dialogtool.h"
#include "ui_dialogpointfromarcandtangent.h"
@ -102,7 +101,7 @@ void DialogPointFromArcAndTangent::SetArcId(quint32 value)
VisToolPointFromArcAndTangent *point = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
SCASSERT(point != nullptr)
point->setArcId(value);
point->SetArcId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -116,9 +115,9 @@ void DialogPointFromArcAndTangent::SetTangentPointId(quint32 value)
{
setCurrentPointId(ui->comboBoxTangentPoint, value);
VisToolPointFromArcAndTangent *point = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
auto *point = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
SCASSERT(point != nullptr)
point->setObject1Id(value);
point->SetPointId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -137,7 +136,7 @@ void DialogPointFromArcAndTangent::SetCrossCirclesPoint(CrossCirclesPoint p)
VisToolPointFromArcAndTangent *point = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
SCASSERT(point != nullptr)
point->setCrossPoint(p);
point->SetCrossPoint(p);
}
}
@ -169,7 +168,7 @@ void DialogPointFromArcAndTangent::ChosenObject(quint32 id, const SceneObject &t
if (SetObject(id, ui->comboBoxArc, QString()))
{
number = 0;
point->setArcId(id);
point->SetArcId(id);
point->RefreshGeometry();
prepare = true;
DialogAccepted();
@ -194,12 +193,12 @@ void DialogPointFromArcAndTangent::SaveData()
{
pointName = ui->lineEditNamePoint->text();
VisToolPointFromArcAndTangent *point = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
auto *point = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
SCASSERT(point != nullptr)
point->setObject1Id(GetTangentPointId());
point->setArcId(GetArcId());
point->setCrossPoint(GetCrossCirclesPoint());
point->SetPointId(GetTangentPointId());
point->SetArcId(GetArcId());
point->SetCrossPoint(GetCrossCirclesPoint());
point->RefreshGeometry();
}

View File

@ -45,7 +45,6 @@
#include "../vpatterndb/vcontainer.h"
#include "../../visualization/visualization.h"
#include "../../visualization/line/vistoolpointfromcircleandtangent.h"
#include "../ifc/xml/vdomdocument.h"
#include "../support/dialogeditwrongformula.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vcommonsettings.h"
@ -141,7 +140,7 @@ void DialogPointFromCircleAndTangent::SetCircleCenterId(const quint32 &value)
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
SCASSERT(point != nullptr)
point->setObject2Id(value);
point->SetCenterId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -165,7 +164,7 @@ void DialogPointFromCircleAndTangent::SetCircleRadius(const QString &value)
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
SCASSERT(point != nullptr)
point->setCRadius(formula);
point->SetCRadius(formula);
MoveCursorToEnd(ui->plainTextEditRadius);
}
@ -183,7 +182,7 @@ void DialogPointFromCircleAndTangent::SetTangentPointId(const quint32 &value)
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
SCASSERT(point != nullptr)
point->setObject1Id(value);
point->SetPointId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -202,7 +201,7 @@ void DialogPointFromCircleAndTangent::SetCrossCirclesPoint(const CrossCirclesPoi
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
SCASSERT(point != nullptr)
point->setCrossPoint(p);
point->SetCrossPoint(p);
}
}
@ -231,7 +230,7 @@ void DialogPointFromCircleAndTangent::ChosenObject(quint32 id, const SceneObject
if (SetObject(id, ui->comboBoxCircleCenter, QString()))
{
number = 0;
point->setObject2Id(id);
point->SetCenterId(id);
point->RefreshGeometry();
prepare = true;
this->setModal(true);
@ -322,10 +321,10 @@ void DialogPointFromCircleAndTangent::SaveData()
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
SCASSERT(point != nullptr)
point->setObject1Id(GetTangentPointId());
point->setObject2Id(GetCircleCenterId());
point->setCRadius(ui->plainTextEditRadius->toPlainText());
point->setCrossPoint(GetCrossCirclesPoint());
point->SetPointId(GetTangentPointId());
point->SetCenterId(GetCircleCenterId());
point->SetCRadius(ui->plainTextEditRadius->toPlainText());
point->SetCrossPoint(GetCrossCirclesPoint());
point->RefreshGeometry();
}

View File

@ -216,7 +216,7 @@ void DialogPointOfContact::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxSecondPoint, tr("Select point of center of arc")))
{
number++;
line->setLineP2Id(id);
line->SetLineP2Id(id);
line->RefreshGeometry();
}
}
@ -232,7 +232,7 @@ void DialogPointOfContact::ChosenObject(quint32 id, const SceneObject &type)
{
if (SetObject(id, ui->comboBoxCenter, QString()))
{
line->setRadiusId(id);
line->SetRadiusId(id);
line->RefreshGeometry();
prepare = true;
this->setModal(true);
@ -257,10 +257,10 @@ void DialogPointOfContact::SaveData()
VisToolPointOfContact *line = qobject_cast<VisToolPointOfContact *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(GetFirstPoint());
line->setLineP2Id(GetSecondPoint());
line->setRadiusId(getCenter());
line->setRadius(radius);
line->SetLineP1Id(GetFirstPoint());
line->SetLineP2Id(GetSecondPoint());
line->SetRadiusId(getCenter());
line->SetRadius(radius);
line->RefreshGeometry();
}
@ -282,7 +282,7 @@ void DialogPointOfContact::SetSecondPoint(quint32 value)
VisToolPointOfContact *line = qobject_cast<VisToolPointOfContact *>(vis);
SCASSERT(line != nullptr)
line->setLineP2Id(value);
line->SetLineP2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -296,7 +296,7 @@ void DialogPointOfContact::SetFirstPoint(quint32 value)
VisToolPointOfContact *line = qobject_cast<VisToolPointOfContact *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(value);
line->SetLineP1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -310,7 +310,7 @@ void DialogPointOfContact::setCenter(quint32 value)
VisToolPointOfContact *line = qobject_cast<VisToolPointOfContact *>(vis);
SCASSERT(line != nullptr)
line->setRadiusId(value);
line->SetRadiusId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -331,7 +331,7 @@ void DialogPointOfContact::setRadius(const QString &value)
VisToolPointOfContact *line = qobject_cast<VisToolPointOfContact *>(vis);
SCASSERT(line != nullptr)
line->setRadius(radius);
line->SetRadius(radius);
MoveCursorToEnd(ui->plainTextEditFormula);
}

View File

@ -37,8 +37,6 @@
#include "../../visualization/visualization.h"
#include "../../visualization/line/vistoolpointofintersection.h"
#include "../ifc/xml/vabstractpattern.h"
#include "../ifc/ifcdef.h"
#include "../vmisc/vabstractapplication.h"
#include "dialogtool.h"
#include "ui_dialogpointofintersection.h"
@ -107,7 +105,7 @@ void DialogPointOfIntersection::SetSecondPointId(quint32 value)
VisToolPointOfIntersection *line = qobject_cast<VisToolPointOfIntersection *>(vis);
SCASSERT(line != nullptr)
line->setPoint2Id(value);
line->SetPoint2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -131,7 +129,7 @@ void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select point for Y value (horizontal)")))
{
number++;
line->setObject1Id(id);
line->SetPoint1Id(id);
line->RefreshGeometry();
}
break;
@ -140,7 +138,7 @@ void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type
{
if (SetObject(id, ui->comboBoxSecondPoint, QString()))
{
line->setPoint2Id(id);
line->SetPoint2Id(id);
line->RefreshGeometry();
prepare = true;
DialogAccepted();
@ -162,8 +160,8 @@ void DialogPointOfIntersection::SaveData()
VisToolPointOfIntersection *line = qobject_cast<VisToolPointOfIntersection *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(GetFirstPointId());
line->setPoint2Id(GetSecondPointId());
line->SetPoint1Id(GetFirstPointId());
line->SetPoint2Id(GetSecondPointId());
line->RefreshGeometry();
}
@ -203,7 +201,7 @@ void DialogPointOfIntersection::SetFirstPointId(quint32 value)
VisToolPointOfIntersection *line = qobject_cast<VisToolPointOfIntersection *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(value);
line->SetPoint1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -109,7 +109,7 @@ void DialogPointOfIntersectionArcs::SetFirstArcId(quint32 value)
VisToolPointOfIntersectionArcs *point = qobject_cast<VisToolPointOfIntersectionArcs *>(vis);
SCASSERT(point != nullptr)
point->setArc1Id(value);
point->SetArc1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -125,7 +125,7 @@ void DialogPointOfIntersectionArcs::SetSecondArcId(quint32 value)
VisToolPointOfIntersectionArcs *point = qobject_cast<VisToolPointOfIntersectionArcs *>(vis);
SCASSERT(point != nullptr)
point->setArc2Id(value);
point->SetArc2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -144,7 +144,7 @@ void DialogPointOfIntersectionArcs::SetCrossArcPoint(CrossCirclesPoint p)
VisToolPointOfIntersectionArcs *point = qobject_cast<VisToolPointOfIntersectionArcs *>(vis);
SCASSERT(point != nullptr)
point->setCrossPoint(p);
point->SetCrossPoint(p);
}
}
@ -173,7 +173,7 @@ void DialogPointOfIntersectionArcs::ChosenObject(quint32 id, const SceneObject &
if (SetObject(id, ui->comboBoxArc2, QString()))
{
number = 0;
point->setArc2Id(id);
point->SetArc2Id(id);
point->RefreshGeometry();
prepare = true;
DialogAccepted();
@ -220,9 +220,9 @@ void DialogPointOfIntersectionArcs::SaveData()
VisToolPointOfIntersectionArcs *point = qobject_cast<VisToolPointOfIntersectionArcs *>(vis);
SCASSERT(point != nullptr)
point->setArc1Id(GetFirstArcId());
point->setArc2Id(GetSecondArcId());
point->setCrossPoint(GetCrossArcPoint());
point->SetArc1Id(GetFirstArcId());
point->SetArc2Id(GetSecondArcId());
point->SetCrossPoint(GetCrossArcPoint());
point->RefreshGeometry();
}

View File

@ -153,7 +153,7 @@ void DialogPointOfIntersectionCircles::SetFirstCircleCenterId(const quint32 &val
auto *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
SCASSERT(point != nullptr)
point->setObject1Id(value);
point->SetCircle1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -169,7 +169,7 @@ void DialogPointOfIntersectionCircles::SetSecondCircleCenterId(const quint32 &va
auto *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
SCASSERT(point != nullptr)
point->setObject2Id(value);
point->SetCircle2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -193,7 +193,7 @@ void DialogPointOfIntersectionCircles::SetFirstCircleRadius(const QString &value
auto *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
SCASSERT(point != nullptr)
point->setC1Radius(formula);
point->SetC1Radius(formula);
MoveCursorToEnd(ui->plainTextEditCircle1Radius);
}
@ -219,7 +219,7 @@ void DialogPointOfIntersectionCircles::SetSecondCircleRadius(const QString &valu
auto *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
SCASSERT(point != nullptr)
point->setC2Radius(formula);
point->SetC2Radius(formula);
MoveCursorToEnd(ui->plainTextEditCircle2Radius);
}
@ -240,7 +240,7 @@ void DialogPointOfIntersectionCircles::SetCrossCirclesPoint(const CrossCirclesPo
auto *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
SCASSERT(point != nullptr)
point->setCrossPoint(p);
point->SetCrossPoint(p);
}
}
@ -337,7 +337,7 @@ void DialogPointOfIntersectionCircles::ChosenObject(quint32 id, const SceneObjec
{
if (SetObject(id, ui->comboBoxCircle2Center, QString()))
{
point->setObject2Id(id);
point->SetCircle2Id(id);
point->RefreshGeometry();
++m_stage;
prepare = true;
@ -469,11 +469,11 @@ void DialogPointOfIntersectionCircles::SaveData()
auto *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
SCASSERT(point != nullptr)
point->setObject1Id(GetFirstCircleCenterId());
point->setObject2Id(GetSecondCircleCenterId());
point->setC1Radius(ui->plainTextEditCircle1Radius->toPlainText());
point->setC2Radius(ui->plainTextEditCircle2Radius->toPlainText());
point->setCrossPoint(GetCrossCirclesPoint());
point->SetCircle1Id(GetFirstCircleCenterId());
point->SetCircle2Id(GetSecondCircleCenterId());
point->SetC1Radius(ui->plainTextEditCircle1Radius->toPlainText());
point->SetC2Radius(ui->plainTextEditCircle2Radius->toPlainText());
point->SetCrossPoint(GetCrossCirclesPoint());
point->RefreshGeometry();
}

View File

@ -117,7 +117,7 @@ void DialogPointOfIntersectionCurves::SetFirstCurveId(quint32 value)
auto point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
SCASSERT(point != nullptr)
point->setObject1Id(value);
point->SetCurve1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -133,7 +133,7 @@ void DialogPointOfIntersectionCurves::SetSecondCurveId(quint32 value)
auto point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
SCASSERT(point != nullptr)
point->setObject2Id(value);
point->SetCurve2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -152,7 +152,7 @@ void DialogPointOfIntersectionCurves::SetVCrossPoint(VCrossCurvesPoint vP)
auto point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
SCASSERT(point != nullptr)
point->setVCrossPoint(vP);
point->SetVCrossPoint(vP);
}
}
@ -172,7 +172,7 @@ void DialogPointOfIntersectionCurves::SetHCrossPoint(HCrossCurvesPoint hP)
auto point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
SCASSERT(point != nullptr)
point->setHCrossPoint(hP);
point->SetHCrossPoint(hP);
}
}
@ -204,7 +204,7 @@ void DialogPointOfIntersectionCurves::ChosenObject(quint32 id, const SceneObject
if (SetObject(id, ui->comboBoxCurve2, QString()))
{
number = 0;
point->setObject2Id(id);
point->SetCurve2Id(id);
point->RefreshGeometry();
prepare = true;
DialogAccepted();
@ -232,10 +232,10 @@ void DialogPointOfIntersectionCurves::SaveData()
auto point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
SCASSERT(point != nullptr)
point->setObject1Id(GetFirstCurveId());
point->setObject2Id(GetSecondCurveId());
point->setVCrossPoint(GetVCrossPoint());
point->setHCrossPoint(GetHCrossPoint());
point->SetCurve1Id(GetFirstCurveId());
point->SetCurve2Id(GetSecondCurveId());
point->SetVCrossPoint(GetVCrossPoint());
point->SetHCrossPoint(GetHCrossPoint());
point->RefreshGeometry();
}

View File

@ -216,7 +216,7 @@ void DialogShoulderPoint::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxP1Line, tr("Select second point of line")))
{
m_number++;
line->setLineP1Id(id);
line->SetLineP1Id(id);
line->RefreshGeometry();
}
}
@ -239,11 +239,11 @@ void DialogShoulderPoint::SaveData()
auto *line = qobject_cast<VisToolShoulderPoint *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(GetP3());
line->setLineP1Id(GetP1Line());
line->setLineP2Id(GetP2Line());
line->setLength(m_formula);
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->SetPoint3Id(GetP3());
line->SetLineP1Id(GetP1Line());
line->SetLineP2Id(GetP2Line());
line->SetLength(m_formula);
line->SetLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}
@ -274,7 +274,7 @@ void DialogShoulderPoint::ChosenThirdPoint(quint32 id)
SCASSERT(line != nullptr)
connect(line, &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
line->setLineP2Id(id);
line->SetLineP2Id(id);
line->RefreshGeometry();
prepare = true;
}
@ -292,7 +292,7 @@ void DialogShoulderPoint::SetP3(const quint32 &value)
auto *line = qobject_cast<VisToolShoulderPoint *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(value);
line->SetPoint3Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -318,7 +318,7 @@ void DialogShoulderPoint::SetP2Line(const quint32 &value)
auto *line = qobject_cast<VisToolShoulderPoint *>(vis);
SCASSERT(line != nullptr)
line->setLineP2Id(value);
line->SetLineP2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -332,7 +332,7 @@ void DialogShoulderPoint::SetP1Line(const quint32 &value)
auto *line = qobject_cast<VisToolShoulderPoint *>(vis);
SCASSERT(line != nullptr)
line->setLineP1Id(value);
line->SetLineP1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -353,7 +353,7 @@ void DialogShoulderPoint::SetFormula(const QString &value)
auto *line = qobject_cast<VisToolShoulderPoint *>(vis);
SCASSERT(line != nullptr)
line->setLength(m_formula);
line->SetLength(m_formula);
MoveCursorToEnd(ui->plainTextEditFormula);
}
@ -365,7 +365,7 @@ void DialogShoulderPoint::SetFormula(const QString &value)
void DialogShoulderPoint::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(LineStyleToPenStyle(value));
vis->SetLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -202,7 +202,7 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
{
++number;
path->SetObject4Id(id);
path->SetPoint4Id(id);
path->RefreshGeometry();
prepare = true;
}
@ -227,14 +227,14 @@ void DialogSpline::SaveData()
auto path = qobject_cast<VisToolSpline *>(vis);
SCASSERT(path != nullptr)
path->setObject1Id(GetP1()->id());
path->SetObject4Id(GetP4()->id());
path->SetPoint1Id(GetP1()->id());
path->SetPoint4Id(GetP4()->id());
path->SetAngle1(spl.GetStartAngle());
path->SetAngle2(spl.GetEndAngle());
path->SetKAsm1(spl.GetKasm1());
path->SetKAsm2(spl.GetKasm2());
path->SetKCurve(spl.GetKcurve());
path->setApproximationScale(spl.GetApproximationScale());
path->SetApproximationScale(spl.GetApproximationScale());
path->SetMode(Mode::Show);
path->RefreshGeometry();
}
@ -631,14 +631,14 @@ void DialogSpline::SetSpline(const VSpline &spline)
auto path = qobject_cast<VisToolSpline *>(vis);
SCASSERT(path != nullptr)
path->setObject1Id(spl.GetP1().id());
path->SetObject4Id(spl.GetP4().id());
path->SetPoint1Id(spl.GetP1().id());
path->SetPoint4Id(spl.GetP4().id());
path->SetAngle1(spl.GetStartAngle());
path->SetAngle2(spl.GetEndAngle());
path->SetKAsm1(spl.GetKasm1());
path->SetKAsm2(spl.GetKasm2());
path->SetKCurve(spl.GetKcurve());
path->setApproximationScale(spl.GetApproximationScale());
path->SetApproximationScale(spl.GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -47,11 +47,9 @@
#include <Qt>
#include <new>
#include "../../tools/vabstracttool.h"
#include "../../visualization/visualization.h"
#include "../../visualization/path/vistoolsplinepath.h"
#include "../ifc/xml/vdomdocument.h"
#include "../qmuparser/qmuparsererror.h"
#include "../support/dialogeditwrongformula.h"
#include "../vgeometry/../ifc/ifcdef.h"
#include "../vgeometry/vpointf.h"

View File

@ -38,7 +38,6 @@
#include "../../visualization/visualization.h"
#include "../../visualization/line/vistooltriangle.h"
#include "../ifc/xml/vabstractpattern.h"
#include "../vmisc/vabstractapplication.h"
#include "dialogtool.h"
#include "ui_dialogtriangle.h"
@ -125,7 +124,7 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxAxisP2, tr("Select first point")))
{
number++;
line->setObject2Id(id);
line->SetObject2Id(id);
line->RefreshGeometry();
}
}
@ -142,7 +141,7 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select second point")))
{
number++;
line->setHypotenuseP1Id(id);
line->SetHypotenuseP1Id(id);
line->RefreshGeometry();
}
}
@ -160,7 +159,7 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
{
if (SetObject(id, ui->comboBoxSecondPoint, QString()))
{
line->setHypotenuseP2Id(id);
line->SetHypotenuseP2Id(id);
line->RefreshGeometry();
prepare = true;
DialogAccepted();
@ -183,10 +182,10 @@ void DialogTriangle::SaveData()
VisToolTriangle *line = qobject_cast<VisToolTriangle *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(GetAxisP1Id());
line->setObject2Id(GetAxisP2Id());
line->setHypotenuseP1Id(GetFirstPointId());
line->setHypotenuseP2Id(GetSecondPointId());
line->SetObject1Id(GetAxisP1Id());
line->SetObject2Id(GetAxisP2Id());
line->SetHypotenuseP1Id(GetFirstPointId());
line->SetHypotenuseP2Id(GetSecondPointId());
line->RefreshGeometry();
}
@ -245,7 +244,7 @@ void DialogTriangle::SetSecondPointId(const quint32 &value)
VisToolTriangle *line = qobject_cast<VisToolTriangle *>(vis);
SCASSERT(line != nullptr)
line->setHypotenuseP2Id(value);
line->SetHypotenuseP2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -265,7 +264,7 @@ void DialogTriangle::SetFirstPointId(const quint32 &value)
VisToolTriangle *line = qobject_cast<VisToolTriangle *>(vis);
SCASSERT(line != nullptr)
line->setHypotenuseP1Id(value);
line->SetHypotenuseP1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -279,7 +278,7 @@ void DialogTriangle::SetAxisP2Id(const quint32 &value)
VisToolTriangle *line = qobject_cast<VisToolTriangle *>(vis);
SCASSERT(line != nullptr)
line->setObject2Id(value);
line->SetObject2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -293,7 +292,7 @@ void DialogTriangle::SetAxisP1Id(const quint32 &value)
VisToolTriangle *line = qobject_cast<VisToolTriangle *>(vis);
SCASSERT(line != nullptr)
line->setObject1Id(value);
line->SetObject1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -43,8 +43,6 @@
#include "../../visualization/line/vistooltruedarts.h"
#include "../ifc/xml/vabstractpattern.h"
#include "../qmuparser/qmudef.h"
#include "../vgeometry/../ifc/ifcdef.h"
#include "../vmisc/vabstractapplication.h"
#include "../vpatterndb/vcontainer.h"
#include "dialogtool.h"
#include "ui_dialogtruedarts.h"
@ -147,7 +145,7 @@ void DialogTrueDarts::SetFirstBasePointId(const quint32 &value)
VisToolTrueDarts *points = qobject_cast<VisToolTrueDarts *>(vis);
SCASSERT(points != nullptr)
points->setObject1Id(value);
points->SetBaseLineP1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -163,7 +161,7 @@ void DialogTrueDarts::SetSecondBasePointId(const quint32 &value)
VisToolTrueDarts *points = qobject_cast<VisToolTrueDarts *>(vis);
SCASSERT(points != nullptr)
points->setObject2Id(value);
points->SetBaseLineP2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -179,7 +177,7 @@ void DialogTrueDarts::SetFirstDartPointId(const quint32 &value)
VisToolTrueDarts *points = qobject_cast<VisToolTrueDarts *>(vis);
SCASSERT(points != nullptr)
points->setD1PointId(value);
points->SetD1PointId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -195,7 +193,7 @@ void DialogTrueDarts::SetSecondDartPointId(const quint32 &value)
VisToolTrueDarts *points = qobject_cast<VisToolTrueDarts *>(vis);
SCASSERT(points != nullptr)
points->setD2PointId(value);
points->SetD2PointId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -211,7 +209,7 @@ void DialogTrueDarts::SetThirdDartPointId(const quint32 &value)
VisToolTrueDarts *points = qobject_cast<VisToolTrueDarts *>(vis);
SCASSERT(points != nullptr)
points->setD3PointId(value);
points->SetD3PointId(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -247,7 +245,7 @@ void DialogTrueDarts::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxSecondBasePoint, tr("Select the first dart point")))
{
number++;
points->setObject2Id(id);
points->SetBaseLineP2Id(id);
points->RefreshGeometry();
}
}
@ -264,7 +262,7 @@ void DialogTrueDarts::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxFirstDartPoint, tr("Select the second dart point")))
{
number++;
points->setD1PointId(id);
points->SetD1PointId(id);
points->RefreshGeometry();
}
}
@ -283,7 +281,7 @@ void DialogTrueDarts::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxSecondDartPoint, tr("Select the third dart point")))
{
number++;
points->setD2PointId(id);
points->SetD2PointId(id);
points->RefreshGeometry();
}
}
@ -302,7 +300,7 @@ void DialogTrueDarts::ChosenObject(quint32 id, const SceneObject &type)
{
if (SetObject(id, ui->comboBoxThirdDartPoint, QString()))
{
points->setD3PointId(id);
points->SetD3PointId(id);
points->RefreshGeometry();
prepare = true;
DialogAccepted();
@ -373,11 +371,11 @@ void DialogTrueDarts::SaveData()
VisToolTrueDarts *points = qobject_cast<VisToolTrueDarts *>(vis);
SCASSERT(points != nullptr)
points->setObject1Id(GetFirstBasePointId());
points->setObject2Id(GetSecondBasePointId());
points->setD1PointId(GetFirstDartPointId());
points->setD2PointId(GetSecondDartPointId());
points->setD3PointId(GetThirdDartPointId());
points->SetBaseLineP1Id(GetFirstBasePointId());
points->SetBaseLineP2Id(GetSecondBasePointId());
points->SetD1PointId(GetFirstDartPointId());
points->SetD2PointId(GetSecondDartPointId());
points->SetD3PointId(GetThirdDartPointId());
points->RefreshGeometry();
}

View File

@ -27,7 +27,6 @@
*************************************************************************/
#include "dialogduplicatedetail.h"
#include "ui_dialogduplicatedetail.h"
#include "../vwidgets/vabstractmainwindow.h"
#include "../../../visualization/path/vistoolduplicatedetail.h"
#include "../../../tools/vabstracttool.h"

View File

@ -30,7 +30,6 @@
#include "ui_dialogpiecepath.h"
#include "../vpatterndb/vpiecenode.h"
#include "visualization/path/vistoolpiecepath.h"
#include "../../../tools/vabstracttool.h"
#include "../../../tools/vtoolseamallowance.h"
#include "../../support/dialogeditwrongformula.h"
#include "../vmisc/vmodifierkey.h"
@ -1394,7 +1393,7 @@ Qt::PenStyle DialogPiecePath::GetPenType() const
void DialogPiecePath::SetPenType(const Qt::PenStyle &type)
{
ChangeCurrentData(ui->comboBoxPenType, PenStyleToLineStyle(type));
vis->setLineStyle(type);
vis->SetLineStyle(type);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -29,10 +29,10 @@
#include "dialogpin.h"
#include "ui_dialogpin.h"
#include "visualization/line/vistoolspecialpoint.h"
#include "../../../tools/vabstracttool.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vpatterndb/vcontainer.h"
//---------------------------------------------------------------------------------------------------------------------
DialogPin::DialogPin(const VContainer *data, quint32 toolId, QWidget *parent)
@ -108,7 +108,7 @@ void DialogPin::SetPointId(quint32 id)
VisToolSpecialPoint *point = qobject_cast<VisToolSpecialPoint *>(vis);
SCASSERT(point != nullptr)
point->setObject1Id(id);
point->SetPointId(id);
CheckPoint();
}

View File

@ -29,13 +29,11 @@
#include "ui_dialogplacelabel.h"
#include "visualization/line/vistoolspecialpoint.h"
#include "../../../tools/vabstracttool.h"
#include "../../../tools/vtoolseamallowance.h"
#include "../../support/dialogeditwrongformula.h"
#include "../vgeometry/vplacelabelitem.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vpatterndb/vcontainer.h"
#include <QTimer>
@ -104,7 +102,7 @@ void DialogPlaceLabel::SetCenterPoint(quint32 id)
{
VisToolSpecialPoint *point = qobject_cast<VisToolSpecialPoint *>(vis);
SCASSERT(point != nullptr)
point->setObject1Id(id);
point->SetPointId(id);
}
CheckPoint();
@ -148,7 +146,7 @@ void DialogPlaceLabel::SetWidth(const QString &value)
// VisToolPlaceLabel *point = qobject_cast<VisToolPlaceLabel *>(vis);
// SCASSERT(point != nullptr)
// point->setObject1Id(id);
// point->SetPointId(id);
MoveCursorToEnd(ui->plainTextEditFormulaWidth);
}
@ -175,7 +173,7 @@ void DialogPlaceLabel::SetHeight(const QString &value)
// VisToolPlaceLabel *point = qobject_cast<VisToolPlaceLabel *>(vis);
// SCASSERT(point != nullptr)
// point->setObject1Id(id);
// point->SetPointId(id);
MoveCursorToEnd(ui->plainTextEditFormulaHeight);
}
@ -202,7 +200,7 @@ void DialogPlaceLabel::SetAngle(const QString &value)
// VisToolPlaceLabel *point = qobject_cast<VisToolPlaceLabel *>(vis);
// SCASSERT(point != nullptr)
// point->setObject1Id(id);
// point->SetPointId(id);
MoveCursorToEnd(ui->plainTextEditFormulaAngle);
}

View File

@ -3750,7 +3750,7 @@ void DialogSeamAllowance::ShowPieceSpecialPointsWithRect(const QListWidget *list
if (not VAbstractValApplication::VApp()->getCurrentScene()->items().contains(m_visSpecialPoints))
{
m_visSpecialPoints->VisualMode(NULL_ID);
m_visSpecialPoints->VisualMode();
m_visSpecialPoints->setZValue(10); // pins should be on top
VToolSeamAllowance *tool = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(toolId));
SCASSERT(tool != nullptr);

View File

@ -374,12 +374,12 @@ void VToolArc::SetVisualization()
const bool osSeparator = VAbstractApplication::VApp()->Settings()->GetOsSeparator();
const VTranslateVars *trVars = VAbstractApplication::VApp()->TrVars();
visual->setObject1Id(arc->GetCenter().id());
visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius(), osSeparator));
visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1(), osSeparator));
visual->setF2(trVars->FormulaToUser(arc->GetFormulaF2(), osSeparator));
visual->setLineStyle(LineStyleToPenStyle(arc->GetPenStyle()));
visual->setApproximationScale(arc->GetApproximationScale());
visual->SetCenterId(arc->GetCenter().id());
visual->SetRadius(trVars->FormulaToUser(arc->GetFormulaRadius(), osSeparator));
visual->SetF1(trVars->FormulaToUser(arc->GetFormulaF1(), osSeparator));
visual->SetF2(trVars->FormulaToUser(arc->GetFormulaF2(), osSeparator));
visual->SetLineStyle(LineStyleToPenStyle(arc->GetPenStyle()));
visual->SetApproximationScale(arc->GetApproximationScale());
visual->SetMode(Mode::Show);
visual->RefreshGeometry();
}

View File

@ -353,12 +353,12 @@ void VToolArcWithLength::SetVisualization()
const bool osSeparator = VAbstractApplication::VApp()->Settings()->GetOsSeparator();
const VTranslateVars *trVars = VAbstractApplication::VApp()->TrVars();
visual->setObject1Id(arc->GetCenter().id());
visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius(), osSeparator));
visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1(), osSeparator));
visual->setLength(trVars->FormulaToUser(arc->GetFormulaLength(), osSeparator));
visual->setLineStyle(LineStyleToPenStyle(arc->GetPenStyle()));
visual->setApproximationScale(arc->GetApproximationScale());
visual->SetCenterId(arc->GetCenter().id());
visual->SetRadius(trVars->FormulaToUser(arc->GetFormulaRadius(), osSeparator));
visual->SetF1(trVars->FormulaToUser(arc->GetFormulaF1(), osSeparator));
visual->SetLength(trVars->FormulaToUser(arc->GetFormulaLength(), osSeparator));
visual->SetLineStyle(LineStyleToPenStyle(arc->GetPenStyle()));
visual->SetApproximationScale(arc->GetApproximationScale());
visual->SetMode(Mode::Show);
visual->RefreshGeometry();
}

View File

@ -47,7 +47,6 @@
#include "../vgeometry/vcubicbezier.h"
#include "../vgeometry/vgobject.h"
#include "../vgeometry/vpointf.h"
#include "../vmisc/vabstractapplication.h"
#include "../vpatterndb/vcontainer.h"
#include "../vwidgets/vmaingraphicsscene.h"
#include "../../vabstracttool.h"
@ -257,12 +256,12 @@ void VToolCubicBezier::SetVisualization()
SCASSERT(visual != nullptr)
const QSharedPointer<VCubicBezier> spl = VAbstractTool::data.GeometricObject<VCubicBezier>(m_id);
visual->setObject1Id(spl->GetP1().id());
visual->setObject2Id(spl->GetP2().id());
visual->setObject3Id(spl->GetP3().id());
visual->setObject4Id(spl->GetP4().id());
visual->setLineStyle(LineStyleToPenStyle(spl->GetPenStyle()));
visual->setApproximationScale(spl->GetApproximationScale());
visual->SetPoint1Id(spl->GetP1().id());
visual->SetPoint2Id(spl->GetP2().id());
visual->SetPoint3Id(spl->GetP3().id());
visual->SetPoint4Id(spl->GetP4().id());
visual->SetLineStyle(LineStyleToPenStyle(spl->GetPenStyle()));
visual->SetApproximationScale(spl->GetApproximationScale());
visual->SetMode(Mode::Show);
visual->RefreshGeometry();
}

View File

@ -245,8 +245,8 @@ void VToolCubicBezierPath::SetVisualization()
SCASSERT(visual != nullptr)
QSharedPointer<VCubicBezierPath> splPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(m_id);
visual->setPath(*splPath.data());
visual->setLineStyle(LineStyleToPenStyle(splPath->GetPenStyle()));
visual->SetPath(*splPath.data());
visual->SetLineStyle(LineStyleToPenStyle(splPath->GetPenStyle()));
visual->SetMode(Mode::Show);
visual->RefreshGeometry();
}

View File

@ -423,13 +423,13 @@ void VToolEllipticalArc::SetVisualization()
const bool osSeparator = VAbstractApplication::VApp()->Settings()->GetOsSeparator();
const VTranslateVars *trVars = VAbstractApplication::VApp()->TrVars();
visual->setObject1Id(elArc->GetCenter().id());
visual->setRadius1(trVars->FormulaToUser(elArc->GetFormulaRadius1(), osSeparator));
visual->setRadius2(trVars->FormulaToUser(elArc->GetFormulaRadius2(), osSeparator));
visual->setF1(trVars->FormulaToUser(elArc->GetFormulaF1(), osSeparator));
visual->setF2(trVars->FormulaToUser(elArc->GetFormulaF2(), osSeparator));
visual->setRotationAngle(trVars->FormulaToUser(elArc->GetFormulaRotationAngle(), osSeparator));
visual->setLineStyle(LineStyleToPenStyle(elArc->GetPenStyle()));
visual->SetCenterId(elArc->GetCenter().id());
visual->SetRadius1(trVars->FormulaToUser(elArc->GetFormulaRadius1(), osSeparator));
visual->SetRadius2(trVars->FormulaToUser(elArc->GetFormulaRadius2(), osSeparator));
visual->SetF1(trVars->FormulaToUser(elArc->GetFormulaF1(), osSeparator));
visual->SetF2(trVars->FormulaToUser(elArc->GetFormulaF2(), osSeparator));
visual->SetRotationAngle(trVars->FormulaToUser(elArc->GetFormulaRotationAngle(), osSeparator));
visual->SetLineStyle(LineStyleToPenStyle(elArc->GetPenStyle()));
visual->RefreshGeometry();
}
}

View File

@ -544,15 +544,15 @@ void VToolSpline::SetVisualization()
SCASSERT(visual != nullptr)
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(m_id);
visual->setObject1Id(spl->GetP1().id());
visual->SetObject4Id(spl->GetP4().id());
visual->SetPoint1Id(spl->GetP1().id());
visual->SetPoint4Id(spl->GetP4().id());
visual->SetAngle1(spl->GetStartAngle());
visual->SetAngle2(spl->GetEndAngle());
visual->SetKAsm1(spl->GetKasm1());
visual->SetKAsm2(spl->GetKasm2());
visual->SetKCurve(spl->GetKcurve());
visual->setLineStyle(LineStyleToPenStyle(spl->GetPenStyle()));
visual->setApproximationScale(spl->GetApproximationScale());
visual->SetLineStyle(LineStyleToPenStyle(spl->GetPenStyle()));
visual->SetApproximationScale(spl->GetApproximationScale());
visual->SetMode(Mode::Show);
visual->RefreshGeometry();
}

View File

@ -754,7 +754,7 @@ void VToolSplinePath::SetVisualization()
QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(m_id);
visual->SetPath(*splPath.data());
visual->setLineStyle(LineStyleToPenStyle(splPath->GetPenStyle()));
visual->SetLineStyle(LineStyleToPenStyle(splPath->GetPenStyle()));
visual->SetMode(Mode::Show);
visual->RefreshGeometry();
}

View File

@ -327,11 +327,11 @@ void VToolTrueDarts::SetVisualization()
auto *visual = qobject_cast<VisToolTrueDarts *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(baseLineP1Id);
visual->setObject2Id(baseLineP2Id);
visual->setD1PointId(dartP1Id);
visual->setD2PointId(dartP2Id);
visual->setD3PointId(dartP3Id);
visual->SetBaseLineP1Id(baseLineP1Id);
visual->SetBaseLineP2Id(baseLineP2Id);
visual->SetD1PointId(dartP1Id);
visual->SetD2PointId(dartP2Id);
visual->SetD3PointId(dartP3Id);
visual->RefreshGeometry();
}
}

View File

@ -270,12 +270,12 @@ void VToolCutArc::SetVisualization()
auto *visual = qobject_cast<VisToolCutArc *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(baseCurveId);
visual->setLength(VAbstractApplication::VApp()->TrVars()
visual->SetArcId(baseCurveId);
visual->SetLength(VAbstractApplication::VApp()->TrVars()
->FormulaToUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(baseCurveId);
visual->setLineStyle(LineStyleToPenStyle(curve->GetPenStyle()));
visual->SetLineStyle(LineStyleToPenStyle(curve->GetPenStyle()));
visual->RefreshGeometry();
}

View File

@ -269,12 +269,12 @@ void VToolCutSpline::SetVisualization()
auto *visual = qobject_cast<VisToolCutSpline *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(baseCurveId);
visual->setLength(VAbstractApplication::VApp()->TrVars()
visual->SetSplineId(baseCurveId);
visual->SetLength(VAbstractApplication::VApp()->TrVars()
->FormulaToUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(baseCurveId);
visual->setLineStyle(LineStyleToPenStyle(curve->GetPenStyle()));
visual->SetLineStyle(LineStyleToPenStyle(curve->GetPenStyle()));
visual->RefreshGeometry();
}

View File

@ -363,12 +363,12 @@ void VToolCutSplinePath::SetVisualization()
auto *visual = qobject_cast<VisToolCutSplinePath *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(baseCurveId);
visual->setLength(VAbstractApplication::VApp()->TrVars()
visual->SetSplinePathId(baseCurveId);
visual->SetLength(VAbstractApplication::VApp()->TrVars()
->FormulaToUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(baseCurveId);
visual->setLineStyle(LineStyleToPenStyle(curve->GetPenStyle()));
visual->SetLineStyle(LineStyleToPenStyle(curve->GetPenStyle()));
visual->RefreshGeometry();
}

View File

@ -141,11 +141,11 @@ void VToolAlongLine::SetVisualization()
{
auto *visual = qobject_cast<VisToolAlongLine *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(basePointId);
visual->setObject2Id(m_secondPointId);
visual->setLength(VAbstractApplication::VApp()->TrVars()
visual->SetPoint1Id(basePointId);
visual->SetPoint2Id(m_secondPointId);
visual->SetLength(VAbstractApplication::VApp()->TrVars()
->FormulaToUser(formulaLength, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->SetLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}

View File

@ -301,12 +301,12 @@ void VToolBisector::SetVisualization()
auto *visual = qobject_cast<VisToolBisector *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(firstPointId);
visual->setObject2Id(basePointId);
visual->setObject3Id(thirdPointId);
visual->setLength(VAbstractApplication::VApp()->TrVars()
visual->SetPoint1Id(firstPointId);
visual->SetPoint2Id(basePointId);
visual->SetPoint3Id(thirdPointId);
visual->SetLength(VAbstractApplication::VApp()->TrVars()
->FormulaToUser(formulaLength, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->SetLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}

View File

@ -322,11 +322,11 @@ void VToolCurveIntersectAxis::SetVisualization()
auto *visual = qobject_cast<VisToolCurveIntersectAxis *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(curveId);
visual->SetCurveId(curveId);
visual->setAxisPointId(basePointId);
visual->SetAngle(VAbstractApplication::VApp()->TrVars()
->FormulaToUser(formulaAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->SetLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}

View File

@ -231,10 +231,10 @@ void VToolEndLine::SetVisualization()
const bool osSeparator = VAbstractApplication::VApp()->Settings()->GetOsSeparator();
const VTranslateVars *trVars = VAbstractApplication::VApp()->TrVars();
visual->setObject1Id(basePointId);
visual->setLength(trVars->FormulaToUser(formulaLength, osSeparator));
visual->SetBasePointId(basePointId);
visual->SetLength(trVars->FormulaToUser(formulaLength, osSeparator));
visual->SetAngle(trVars->FormulaToUser(formulaAngle, osSeparator));
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->SetLineStyle(LineStyleToPenStyle(m_lineType));
visual->SetMode(Mode::Show);
visual->RefreshGeometry();
}

View File

@ -260,10 +260,10 @@ void VToolHeight::SetVisualization()
auto *visual = qobject_cast<VisToolHeight *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(basePointId);
visual->setLineP1Id(p1LineId);
visual->setLineP2Id(p2LineId);
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->SetBasePointId(basePointId);
visual->SetLineP1Id(p1LineId);
visual->SetLineP2Id(p2LineId);
visual->SetLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}

View File

@ -318,12 +318,12 @@ void VToolLineIntersectAxis::SetVisualization()
auto *visual = qobject_cast<VisToolLineIntersectAxis *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(firstPointId);
visual->setPoint2Id(secondPointId);
visual->setAxisPointId(basePointId);
visual->SetPoint1Id(firstPointId);
visual->SetPoint2Id(secondPointId);
visual->SetAxisPointId(basePointId);
visual->SetAngle(VAbstractApplication::VApp()->TrVars()
->FormulaToUser(formulaAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->SetLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}

View File

@ -45,13 +45,11 @@ template <class T> class QSharedPointer;
struct VToolLinePointInitData : VToolSinglePointInitData
{
VToolLinePointInitData()
: VToolSinglePointInitData(),
typeLine(TypeLineLine),
lineColor(ColorBlack)
: VToolSinglePointInitData()
{}
QString typeLine;
QString lineColor;
QString typeLine{TypeLineLine};
QString lineColor{ColorBlack};
};
/**

View File

@ -271,12 +271,12 @@ void VToolNormal::SetVisualization()
auto *visual = qobject_cast<VisToolNormal *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(basePointId);
visual->setObject2Id(secondPointId);
visual->setLength(VAbstractApplication::VApp()->TrVars()
visual->SetPoint1Id(basePointId);
visual->SetPoint2Id(secondPointId);
visual->SetLength(VAbstractApplication::VApp()->TrVars()
->FormulaToUser(formulaLength, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->SetAngle(angle);
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->SetLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}

View File

@ -321,12 +321,12 @@ void VToolShoulderPoint::SetVisualization()
auto *visual = qobject_cast<VisToolShoulderPoint *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(pShoulder);
visual->setLineP1Id(basePointId);
visual->setLineP2Id(p2Line);
visual->setLength(VAbstractApplication::VApp()->TrVars()
visual->SetLineP1Id(pShoulder);
visual->SetLineP1Id(basePointId);
visual->SetLineP2Id(p2Line);
visual->SetLength(VAbstractApplication::VApp()->TrVars()
->FormulaToUser(formulaLength, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->SetLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}

View File

@ -296,10 +296,10 @@ void VToolLineIntersect::SetVisualization()
auto *visual = qobject_cast<VisToolLineIntersect *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(p1Line1);
visual->setLine1P2Id(p2Line1);
visual->setLine2P1Id(p1Line2);
visual->setLine2P2Id(p2Line2);
visual->SetLine1P1Id(p1Line1);
visual->SetLine1P2Id(p2Line1);
visual->SetLine2P1Id(p1Line2);
visual->SetLine2P2Id(p2Line2);
visual->RefreshGeometry();
}
}

View File

@ -334,9 +334,9 @@ void VToolPointFromArcAndTangent::SetVisualization()
auto *visual = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(tangentPointId);
visual->setArcId(arcId);
visual->setCrossPoint(crossPoint);
visual->SetPointId(tangentPointId);
visual->SetArcId(arcId);
visual->SetCrossPoint(crossPoint);
visual->RefreshGeometry();
}
}

View File

@ -328,10 +328,10 @@ void VToolPointFromCircleAndTangent::SetVisualization()
auto *visual = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(tangentPointId);
visual->setObject2Id(circleCenterId);
visual->setCRadius(circleRadius);
visual->setCrossPoint(crossPoint);
visual->SetPointId(tangentPointId);
visual->SetCenterId(circleCenterId);
visual->SetCRadius(circleRadius);
visual->SetCrossPoint(crossPoint);
visual->RefreshGeometry();
}
}

View File

@ -351,10 +351,10 @@ void VToolPointOfContact::SetVisualization()
auto *visual = qobject_cast<VisToolPointOfContact *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(firstPointId);
visual->setLineP2Id(secondPointId);
visual->setRadiusId(center);
visual->setRadius(VAbstractApplication::VApp()->TrVars()
visual->SetLineP1Id(firstPointId);
visual->SetLineP2Id(secondPointId);
visual->SetRadiusId(center);
visual->SetRadius(VAbstractApplication::VApp()->TrVars()
->FormulaToUser(arcRadius, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
visual->RefreshGeometry();
}

View File

@ -240,8 +240,8 @@ void VToolPointOfIntersection::SetVisualization()
auto *visual = qobject_cast<VisToolPointOfIntersection *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(firstPointId);
visual->setPoint2Id(secondPointId);
visual->SetPoint1Id(firstPointId);
visual->SetPoint2Id(secondPointId);
visual->RefreshGeometry();
}
}

View File

@ -354,9 +354,9 @@ void VToolPointOfIntersectionArcs::SetVisualization()
auto *visual = qobject_cast<VisToolPointOfIntersectionArcs *>(vis);
SCASSERT(visual != nullptr)
visual->setArc1Id(firstArcId);
visual->setArc2Id(secondArcId);
visual->setCrossPoint(crossPoint);
visual->SetArc1Id(firstArcId);
visual->SetArc2Id(secondArcId);
visual->SetCrossPoint(crossPoint);
visual->RefreshGeometry();
}
}

View File

@ -370,15 +370,15 @@ void VToolPointOfIntersectionCircles::SetVisualization()
auto *visual = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(firstCircleCenterId);
visual->setObject2Id(secondCircleCenterId);
visual->SetCircle1Id(firstCircleCenterId);
visual->SetCircle2Id(secondCircleCenterId);
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->SetC1Radius(trVars->FormulaToUser(firstCircleRadius, osSeparator));
visual->SetC2Radius(trVars->FormulaToUser(secondCircleRadius, osSeparator));
visual->SetCrossPoint(crossPoint);
visual->RefreshGeometry();
}
}

View File

@ -469,10 +469,10 @@ void VToolPointOfIntersectionCurves::SetVisualization()
auto visual = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(firstCurveId);
visual->setObject2Id(secondCurveId);
visual->setVCrossPoint(vCrossPoint);
visual->setHCrossPoint(hCrossPoint);
visual->SetCurve1Id(firstCurveId);
visual->SetCurve2Id(secondCurveId);
visual->SetVCrossPoint(vCrossPoint);
visual->SetHCrossPoint(hCrossPoint);
visual->RefreshGeometry();
}
}

View File

@ -35,6 +35,7 @@
#include <QStringData>
#include <QStringDataPtr>
#include <new>
#include <QtMath>
#include "../../../../dialogs/tools/dialogtriangle.h"
#include "../../../../dialogs/tools/dialogtool.h"
@ -50,7 +51,6 @@
#include "../../../vabstracttool.h"
#include "../../vdrawtool.h"
#include "vtoolsinglepoint.h"
#include "../vmisc/vmath.h"
#include "../vmisc/compatibility.h"
template <class T> class QSharedPointer;
@ -341,10 +341,10 @@ void VToolTriangle::SetVisualization()
auto * visual = qobject_cast<VisToolTriangle *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(axisP1Id);
visual->setObject2Id(axisP2Id);
visual->setHypotenuseP1Id(firstPointId);
visual->setHypotenuseP2Id(secondPointId);
visual->SetObject1Id(axisP1Id);
visual->SetObject2Id(axisP2Id);
visual->SetHypotenuseP1Id(firstPointId);
visual->SetHypotenuseP2Id(secondPointId);
visual->RefreshGeometry();
}
}

View File

@ -426,9 +426,9 @@ void VToolLine::SetVisualization()
auto *visual = qobject_cast<VisToolLine *>(vis);
SCASSERT(visual != nullptr)
visual->setObject1Id(firstPoint);
visual->setPoint2Id(secondPoint);
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->SetPoint1Id(firstPoint);
visual->SetPoint2Id(secondPoint);
visual->SetLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}

View File

@ -27,7 +27,6 @@
*************************************************************************/
#include "visoperation.h"
#include "../vgeometry/vabstractcurve.h"
#include "../vgeometry/varc.h"
#include "../vgeometry/vcubicbezier.h"
#include "../vgeometry/vcubicbezierpath.h"
@ -40,73 +39,61 @@
//---------------------------------------------------------------------------------------------------------------------
VisOperation::VisOperation(const VContainer *data, QGraphicsItem *parent)
: VisLine(data, parent),
objects(),
supportColor2(Qt::darkGreen),
supportColor3(Qt::darkBlue),
points(),
curves()
: VisLine(data, parent)
{
SetColor(VColor::SupportColor2, Qt::darkGreen);
SetColor(VColor::SupportColor3, Qt::darkBlue);
}
//---------------------------------------------------------------------------------------------------------------------
VisOperation::~VisOperation()
{
qDeleteAll(points);
qDeleteAll(curves);
qDeleteAll(m_points);
qDeleteAll(m_curves);
}
//---------------------------------------------------------------------------------------------------------------------
void VisOperation::SetObjects(const QVector<quint32> &objects)
{
this->objects = objects;
m_objects = objects;
}
//---------------------------------------------------------------------------------------------------------------------
void VisOperation::VisualMode(const quint32 &pointId)
void VisOperation::VisualMode(quint32 id)
{
Q_UNUSED(pointId)
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
SCASSERT(scene != nullptr)
Visualization::scenePos = scene->getScenePos();
RefreshGeometry();
AddOnScene();
Q_UNUSED(id)
StartVisualMode();
}
//---------------------------------------------------------------------------------------------------------------------
VScaledEllipse *VisOperation::GetPoint(quint32 i, const QColor &color)
auto VisOperation::GetPoint(quint32 i, const QColor &color) -> VScaledEllipse *
{
return GetPointItem(points, i, color, this);
return GetPointItem(m_points, i, color, this);
}
//---------------------------------------------------------------------------------------------------------------------
VCurvePathItem *VisOperation::GetCurve(quint32 i, const QColor &color)
auto VisOperation::GetCurve(quint32 i, const QColor &color) -> VCurvePathItem *
{
if (not curves.isEmpty() && static_cast<quint32>(curves.size() - 1) >= i)
if (!m_curves.isEmpty() && static_cast<quint32>(m_curves.size() - 1) >= i)
{
return curves.at(static_cast<int>(i));
return m_curves.at(static_cast<int>(i));
}
else
{
auto curve = InitItem<VCurvePathItem>(color, this);
curves.append(curve);
auto *curve = InitItem<VCurvePathItem>(color, this);
m_curves.append(curve);
return curve;
}
return nullptr;
}
//---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
void VisOperation::RefreshFlippedObjects(const QPointF &firstPoint, const QPointF &secondPoint)
void VisOperation::RefreshFlippedObjects(quint32 originPointId, const QPointF &firstPoint, const QPointF &secondPoint)
{
int iPoint = -1;
int iCurve = -1;
for (auto id : qAsConst(objects))
for (auto id : qAsConst(m_objects))
{
const QSharedPointer<VGObject> obj = Visualization::data->GetGObject(id);
const QSharedPointer<VGObject> obj = GetData()->GetGObject(id);
// This check helps to find missed objects in the switch
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled.");
@ -115,49 +102,50 @@ void VisOperation::RefreshFlippedObjects(const QPointF &firstPoint, const QPoint
{
case GOType::Point:
{
const QSharedPointer<VPointF> p = Visualization::data->GeometricObject<VPointF>(id);
const QSharedPointer<VPointF> p = GetData()->GeometricObject<VPointF>(id);
++iPoint;
VScaledEllipse *point = GetPoint(static_cast<quint32>(iPoint), supportColor2);
DrawPoint(point, static_cast<QPointF>(*p), supportColor2);
VScaledEllipse *point = GetPoint(static_cast<quint32>(iPoint), Color(VColor::SupportColor2));
DrawPoint(point, static_cast<QPointF>(*p), Color(VColor::SupportColor2));
++iPoint;
point = GetPoint(static_cast<quint32>(iPoint), supportColor);
point = GetPoint(static_cast<quint32>(iPoint), Color(VColor::SupportColor));
if (object1Id != NULL_ID)
if (originPointId != NULL_ID)
{
DrawPoint(point, static_cast<QPointF>(p->Flip(QLineF(firstPoint, secondPoint))), supportColor);
DrawPoint(point, static_cast<QPointF>(p->Flip(QLineF(firstPoint, secondPoint))),
Color(VColor::SupportColor));
}
break;
}
case GOType::Arc:
{
iCurve = AddFlippedCurve<VArc>(firstPoint, secondPoint, id, iCurve);
iCurve = AddFlippedCurve<VArc>(originPointId, firstPoint, secondPoint, id, iCurve);
break;
}
case GOType::EllipticalArc:
{
iCurve = AddFlippedCurve<VEllipticalArc>(firstPoint, secondPoint, id, iCurve);
iCurve = AddFlippedCurve<VEllipticalArc>(originPointId, firstPoint, secondPoint, id, iCurve);
break;
}
case GOType::Spline:
{
iCurve = AddFlippedCurve<VSpline>(firstPoint, secondPoint, id, iCurve);
iCurve = AddFlippedCurve<VSpline>(originPointId, firstPoint, secondPoint, id, iCurve);
break;
}
case GOType::SplinePath:
{
iCurve = AddFlippedCurve<VSplinePath>(firstPoint, secondPoint, id, iCurve);
iCurve = AddFlippedCurve<VSplinePath>(originPointId, firstPoint, secondPoint, id, iCurve);
break;
}
case GOType::CubicBezier:
{
iCurve = AddFlippedCurve<VCubicBezier>(firstPoint, secondPoint, id, iCurve);
iCurve = AddFlippedCurve<VCubicBezier>(originPointId, firstPoint, secondPoint, id, iCurve);
break;
}
case GOType::CubicBezierPath:
{
iCurve = AddFlippedCurve<VCubicBezierPath>(firstPoint, secondPoint, id, iCurve);
iCurve = AddFlippedCurve<VCubicBezierPath>(originPointId, firstPoint, secondPoint, id, iCurve);
break;
}
case GOType::Unknown:

View File

@ -39,52 +39,62 @@ class VisOperation : public VisLine
Q_OBJECT // NOLINT
public:
explicit VisOperation(const VContainer *data, QGraphicsItem *parent = nullptr);
virtual ~VisOperation();
~VisOperation() override;
void SetObjects(const QVector<quint32> &objects);
void VisualMode(quint32 id = NULL_ID) override;
virtual void VisualMode(const quint32 &pointId = NULL_ID) override;
virtual int type() const override {return Type;}
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolRotation)};
protected:
QVector<quint32> objects;
QColor supportColor2;
QColor supportColor3;
QVector<VScaledEllipse *> points;
QVector<VCurvePathItem *> curves;
VScaledEllipse *GetPoint(quint32 i, const QColor &color);
VCurvePathItem *GetCurve(quint32 i, const QColor &color);
auto GetPoint(quint32 i, const QColor &color) -> VScaledEllipse *;
auto GetCurve(quint32 i, const QColor &color) -> VCurvePathItem *;
template <class Item>
int AddFlippedCurve(const QPointF &firstPoint, const QPointF &secondPoint, quint32 id, int i);
auto AddFlippedCurve(quint32 originPointId, const QPointF &firstPoint, const QPointF &secondPoint, quint32 id,
int i) -> int;
void RefreshFlippedObjects(const QPointF &firstPoint, const QPointF &secondPoint);
void RefreshFlippedObjects(quint32 originPointId, const QPointF &firstPoint, const QPointF &secondPoint);
auto Objects() const -> const QVector<quint32> &;
private:
Q_DISABLE_COPY_MOVE(VisOperation) // NOLINT
QVector<quint32> m_objects{};
QVector<VScaledEllipse *> m_points{};
QVector<VCurvePathItem *> m_curves{};
};
//---------------------------------------------------------------------------------------------------------------------
template <class Item>
int VisOperation::AddFlippedCurve(const QPointF &firstPoint, const QPointF &secondPoint, quint32 id, int i)
auto VisOperation::AddFlippedCurve(quint32 originPointId, const QPointF &firstPoint, const QPointF &secondPoint,
quint32 id, int i) -> int
{
const QSharedPointer<Item> curve = Visualization::data->template GeometricObject<Item>(id);
const QSharedPointer<Item> curve = GetData()->template GeometricObject<Item>(id);
++i;
VCurvePathItem *path = GetCurve(static_cast<quint32>(i), supportColor2);
DrawPath(path, curve->GetPath(), curve->DirectionArrows(), supportColor2, Qt::SolidLine, Qt::RoundCap);
VCurvePathItem *path = GetCurve(static_cast<quint32>(i), Color(VColor::SupportColor2));
DrawPath(path, curve->GetPath(), curve->DirectionArrows(), Color(VColor::SupportColor2), Qt::SolidLine,
Qt::RoundCap);
++i;
path = GetCurve(static_cast<quint32>(i), supportColor);
if (object1Id != NULL_ID)
path = GetCurve(static_cast<quint32>(i), Color(VColor::SupportColor));
if (originPointId != NULL_ID)
{
const Item flipped = curve->Flip(QLineF(firstPoint, secondPoint));
DrawPath(path, flipped.GetPath(), flipped.DirectionArrows(), supportColor, Qt::SolidLine, Qt::RoundCap);
DrawPath(path, flipped.GetPath(), flipped.DirectionArrows(), Color(VColor::SupportColor), Qt::SolidLine,
Qt::RoundCap);
}
return i;
}
//---------------------------------------------------------------------------------------------------------------------
inline auto VisOperation::Objects() const -> const QVector<quint32> &
{
return m_objects;
}
#endif // VISOPERATION_H

View File

@ -31,17 +31,15 @@
//---------------------------------------------------------------------------------------------------------------------
VisToolFlippingByAxis::VisToolFlippingByAxis(const VContainer *data, QGraphicsItem *parent)
: VisOperation(data, parent),
m_axisType(AxisType::VerticalAxis),
point1(nullptr)
: VisOperation(data, parent)
{
point1 = InitPoint(supportColor2, this);
m_point1 = InitPoint(Color(VColor::SupportColor2), this);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolFlippingByAxis::RefreshGeometry()
{
if (objects.isEmpty())
if (Objects().isEmpty())
{
return;
}
@ -49,10 +47,10 @@ void VisToolFlippingByAxis::RefreshGeometry()
QPointF firstPoint;
QPointF secondPoint;
if (object1Id != NULL_ID)
if (m_originPointId != NULL_ID)
{
firstPoint = static_cast<QPointF>(*Visualization::data->GeometricObject<VPointF>(object1Id));
DrawPoint(point1, firstPoint, supportColor2);
firstPoint = static_cast<QPointF>(*GetData()->GeometricObject<VPointF>(m_originPointId));
DrawPoint(m_point1, firstPoint, Color(VColor::SupportColor2));
if (m_axisType == AxisType::VerticalAxis)
{
@ -63,20 +61,8 @@ void VisToolFlippingByAxis::RefreshGeometry()
secondPoint = QPointF(firstPoint.x() + 100, firstPoint.y());
}
DrawLine(this, Axis(firstPoint, secondPoint), supportColor2, Qt::DashLine);
DrawLine(this, Axis(firstPoint, secondPoint), Color(VColor::SupportColor2), Qt::DashLine);
}
RefreshFlippedObjects(firstPoint, secondPoint);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolFlippingByAxis::SetOriginPointId(quint32 value)
{
object1Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolFlippingByAxis::SetAxisType(AxisType value)
{
m_axisType = value;
RefreshFlippedObjects(m_originPointId, firstPoint, secondPoint);
}

View File

@ -39,22 +39,36 @@ class VisToolFlippingByAxis : public VisOperation
Q_OBJECT // NOLINT
public:
explicit VisToolFlippingByAxis(const VContainer *data, QGraphicsItem *parent = nullptr);
virtual ~VisToolFlippingByAxis() = default;
~VisToolFlippingByAxis() override = default;
virtual void RefreshGeometry() override;
void RefreshGeometry() override;
void SetOriginPointId(quint32 value);
void SetAxisType(AxisType value);
virtual int type() const override {return Type;}
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolFlippingByAxis)};
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VisToolFlippingByAxis) // NOLINT
AxisType m_axisType;
AxisType m_axisType{AxisType::VerticalAxis};
VScaledEllipse *point1;
VScaledEllipse *m_point1{nullptr};
quint32 m_originPointId{NULL_ID};
};
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolFlippingByAxis::SetOriginPointId(quint32 value)
{
m_originPointId = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolFlippingByAxis::SetAxisType(AxisType value)
{
m_axisType = value;
}
#endif // VISTOOLFLIPPINGBYAXIS_H

View File

@ -31,19 +31,16 @@
//---------------------------------------------------------------------------------------------------------------------
VisToolFlippingByLine::VisToolFlippingByLine(const VContainer *data, QGraphicsItem *parent)
: VisOperation(data, parent),
object2Id(NULL_ID),
point1(nullptr),
point2(nullptr)
: VisOperation(data, parent)
{
point1 = InitPoint(supportColor2, this);
point2 = InitPoint(supportColor2, this);
m_point1 = InitPoint(Color(VColor::SupportColor2), this);
m_point2 = InitPoint(Color(VColor::SupportColor2), this);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolFlippingByLine::RefreshGeometry()
{
if (objects.isEmpty())
if (Objects().isEmpty())
{
return;
}
@ -51,35 +48,23 @@ void VisToolFlippingByLine::RefreshGeometry()
QPointF firstPoint;
QPointF secondPoint;
if (object1Id != NULL_ID)
if (m_lineP1Id != NULL_ID)
{
firstPoint = static_cast<QPointF>(*Visualization::data->GeometricObject<VPointF>(object1Id));
DrawPoint(point1, firstPoint, supportColor2);
firstPoint = static_cast<QPointF>(*GetData()->GeometricObject<VPointF>(m_lineP1Id));
DrawPoint(m_point1, firstPoint, Color(VColor::SupportColor2));
if (object2Id == NULL_ID)
if (m_lineP2Id == NULL_ID)
{
secondPoint = Visualization::scenePos;
secondPoint = ScenePos();
}
else
{
secondPoint = static_cast<QPointF>(*Visualization::data->GeometricObject<VPointF>(object2Id));
DrawPoint(point2, secondPoint, supportColor2);
secondPoint = static_cast<QPointF>(*GetData()->GeometricObject<VPointF>(m_lineP2Id));
DrawPoint(m_point2, secondPoint, Color(VColor::SupportColor2));
}
DrawLine(this, QLineF(firstPoint, secondPoint), supportColor2, Qt::DashLine);
DrawLine(this, QLineF(firstPoint, secondPoint), Color(VColor::SupportColor2), Qt::DashLine);
}
RefreshFlippedObjects(firstPoint, secondPoint);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolFlippingByLine::SetFirstLinePointId(quint32 value)
{
object1Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolFlippingByLine::SetSecondLinePointId(quint32 value)
{
object2Id = value;
RefreshFlippedObjects(m_lineP1Id, firstPoint, secondPoint);
}

View File

@ -38,21 +38,34 @@ class VisToolFlippingByLine : public VisOperation
Q_OBJECT // NOLINT
public:
explicit VisToolFlippingByLine(const VContainer *data, QGraphicsItem *parent = nullptr);
virtual ~VisToolFlippingByLine() = default;
~VisToolFlippingByLine() override = default;
virtual void RefreshGeometry() override;
void RefreshGeometry() override;
void SetFirstLinePointId(quint32 value);
void SetSecondLinePointId(quint32 value);
virtual int type() const override {return Type;}
auto type() const -> int override {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolFlippingByLine)};
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VisToolFlippingByLine) // NOLINT
quint32 object2Id;
VScaledEllipse *point1;
VScaledEllipse *point2;
quint32 m_lineP1Id{NULL_ID};
quint32 m_lineP2Id{NULL_ID};
VScaledEllipse *m_point1{nullptr};
VScaledEllipse *m_point2{nullptr};
};
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolFlippingByLine::SetFirstLinePointId(quint32 value)
{
m_lineP1Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolFlippingByLine::SetSecondLinePointId(quint32 value)
{
m_lineP2Id = value;
}
#endif // VISTOOLFLIPPINGBYLINE_H

View File

@ -62,29 +62,20 @@
//---------------------------------------------------------------------------------------------------------------------
VisToolMove::VisToolMove(const VContainer *data, QGraphicsItem *parent)
: VisOperation(data, parent),
angle(0),
rotationAngle(INT_MIN),
length(0),
pointOrigin(nullptr),
pointRotationOrigin(nullptr),
pointFinish(nullptr),
angleArc(nullptr),
rotationLine(nullptr),
xAxis(nullptr)
: VisOperation(data, parent)
{
pointOrigin = InitPoint(supportColor2, this);
pointRotationOrigin = InitPoint(supportColor2, this);
pointFinish = InitPoint(supportColor, this);
angleArc = InitItem<VCurvePathItem>(supportColor3, this);
rotationLine = InitItem<VScaledLine>(supportColor3, this);
xAxis = InitItem<VScaledLine>(supportColor3, this);
m_pointOrigin = InitPoint(Color(VColor::SupportColor2), this);
m_pointRotationOrigin = InitPoint(Color(VColor::SupportColor2), this);
m_pointFinish = InitPoint(Color(VColor::SupportColor), this);
m_angleArc = InitItem<VCurvePathItem>(Color(VColor::SupportColor3), this);
m_rotationLine = InitItem<VScaledLine>(Color(VColor::SupportColor3), this);
m_xAxis = InitItem<VScaledLine>(Color(VColor::SupportColor3), this);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolMove::RefreshGeometry()
{
if (objects.isEmpty())
if (Objects().isEmpty())
{
return;
}
@ -95,23 +86,23 @@ void VisToolMove::RefreshGeometry()
const QVector<QGraphicsItem *> originObjects = CreateOriginObjects(iPoint, iCurve);
QPointF origin = GetOriginPoint(originObjects);
DrawPoint(pointOrigin, origin, supportColor2);
DrawPoint(m_pointOrigin, origin, Color(VColor::SupportColor2));
qreal tempAngle = 0;
qreal tempLength = 0;
qreal tempRoationAngle = 0;
QLineF line;
if (qFuzzyIsNull(length))
if (qFuzzyIsNull(m_length))
{
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
{
line = QLineF(origin, Visualization::scenePos);
line = QLineF(origin, ScenePos());
line.setAngle(CorrectAngle(line.angle()));
}
else
{
line = QLineF(origin, Visualization::scenePos);
line = QLineF(origin, ScenePos());
}
tempAngle = line.angle();
@ -119,25 +110,25 @@ void VisToolMove::RefreshGeometry()
}
else
{
line = VGObject::BuildLine(origin, length, angle);
tempAngle = angle;
tempLength = length;
line = VGObject::BuildLine(origin, m_length, m_angle);
tempAngle = m_angle;
tempLength = m_length;
if (object1Id != NULL_ID)
if (m_rotationOriginId != NULL_ID)
{
origin = Visualization::data->GeometricObject<VPointF>(object1Id)->toQPointF();
DrawPoint(pointRotationOrigin, origin, supportColor2);
origin = GetData()->GeometricObject<VPointF>(m_rotationOriginId)->toQPointF();
DrawPoint(m_pointRotationOrigin, origin, Color(VColor::SupportColor2));
}
else
{
origin = line.p2();
pointRotationOrigin->setVisible(false);
m_pointRotationOrigin->setVisible(false);
}
QLineF rLine;
if (VFuzzyComparePossibleNulls(rotationAngle, INT_MIN))
if (VFuzzyComparePossibleNulls(m_rotationAngle, INT_MIN))
{
rLine = QLineF(origin, Visualization::scenePos);
rLine = QLineF(origin, ScenePos());
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
{
@ -159,48 +150,48 @@ void VisToolMove::RefreshGeometry()
}
else
{
rLine = QLineF(origin, Ray(origin, rotationAngle));
tempRoationAngle = rotationAngle;
rLine = QLineF(origin, Ray(origin, m_rotationAngle));
tempRoationAngle = m_rotationAngle;
}
DrawLine(rotationLine, rLine, supportColor3, Qt::DashLine);
DrawLine(xAxis, QLineF(origin, Ray(origin, 0)), supportColor3, Qt::DashLine);
DrawLine(m_rotationLine, rLine, Color(VColor::SupportColor3), Qt::DashLine);
DrawLine(m_xAxis, QLineF(origin, Ray(origin, 0)), Color(VColor::SupportColor3), Qt::DashLine);
VArc arc(VPointF(origin),
ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene()))*2, 0, tempRoationAngle);
DrawPath(angleArc, arc.GetPath(), supportColor3, Qt::SolidLine, Qt::RoundCap);
DrawPath(m_angleArc, arc.GetPath(), Color(VColor::SupportColor3), Qt::SolidLine, Qt::RoundCap);
}
DrawLine(this, line, supportColor2, Qt::DashLine);
DrawPoint(pointFinish, line.p2(), supportColor);
DrawLine(this, line, Color(VColor::SupportColor2), Qt::DashLine);
DrawPoint(m_pointFinish, line.p2(), Color(VColor::SupportColor));
static const QString prefix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
if (qFuzzyIsNull(length))
if (qFuzzyIsNull(m_length))
{
Visualization::toolTip = tr("Length = %1%2, angle = %3°, <b>%4</b> - sticking angle, "
SetToolTip(tr("Length = %1%2, angle = %3°, <b>%4</b> - sticking angle, "
"<b>Mouse click</b> - finish selecting a position")
.arg(VAbstractApplication::VApp()->TrVars()->FormulaToUser(
QString::number(VAbstractValApplication::VApp()->fromPixel(tempLength)),
VAbstractApplication::VApp()->Settings()->GetOsSeparator()), prefix)
.arg(tempAngle)
.arg(VModifierKey::Shift());
.arg(VModifierKey::Shift()));
}
else
{
Visualization::toolTip = tr("Length = %1%2, angle = %3°, rotation angle = %4°, <b>%5</b> - sticking angle, "
SetToolTip(tr("Length = %1%2, angle = %3°, rotation angle = %4°, <b>%5</b> - sticking angle, "
"<b>%6</b> - change rotation origin point, <b>Mouse click</b> - finish creating")
.arg(VAbstractApplication::VApp()->TrVars()->FormulaToUser(
QString::number(VAbstractValApplication::VApp()->fromPixel(tempLength)),
VAbstractApplication::VApp()->Settings()->GetOsSeparator()), prefix)
.arg(tempAngle)
.arg(tempRoationAngle)
.arg(VModifierKey::Shift(), VModifierKey::Control());
.arg(VModifierKey::Shift(), VModifierKey::Control()));
}
CreateMovedRotatedObjects(iPoint, iCurve, tempLength, tempAngle, tempRoationAngle, origin);
}
//---------------------------------------------------------------------------------------------------------------------
QString VisToolMove::Angle() const
auto VisToolMove::Angle() const -> QString
{
return QString::number(line().angle());
}
@ -208,29 +199,29 @@ QString VisToolMove::Angle() const
//---------------------------------------------------------------------------------------------------------------------
void VisToolMove::SetAngle(const QString &expression)
{
angle = FindValFromUser(expression, Visualization::data->DataVariables());
m_angle = FindValFromUser(expression, GetData()->DataVariables());
}
//---------------------------------------------------------------------------------------------------------------------
QString VisToolMove::RotationAngle() const
auto VisToolMove::RotationAngle() const -> QString
{
return QString::number(rotationLine->line().angle());
return QString::number(m_rotationLine->line().angle());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolMove::SetRotationAngle(const QString &expression)
{
rotationAngle = FindValFromUser(expression, Visualization::data->DataVariables());
m_rotationAngle = FindValFromUser(expression, GetData()->DataVariables());
}
//---------------------------------------------------------------------------------------------------------------------
QString VisToolMove::Length() const
auto VisToolMove::Length() const -> QString
{
return QString::number(LengthValue());
}
//---------------------------------------------------------------------------------------------------------------------
qreal VisToolMove::LengthValue() const
auto VisToolMove::LengthValue() const -> qreal
{
return VAbstractValApplication::VApp()->fromPixel(line().length());
}
@ -238,48 +229,43 @@ qreal VisToolMove::LengthValue() const
//---------------------------------------------------------------------------------------------------------------------
void VisToolMove::SetLength(const QString &expression)
{
length = FindLengthFromUser(expression, Visualization::data->DataVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolMove::SetRotationOriginPointId(quint32 value)
{
object1Id = value;
m_length = FindLengthFromUser(expression, GetData()->DataVariables());
}
//---------------------------------------------------------------------------------------------------------------------
template <class Item>
QGraphicsPathItem *VisToolMove::AddOriginCurve(quint32 id, int &i)
auto VisToolMove::AddOriginCurve(quint32 id, int &i) -> QGraphicsPathItem *
{
const QSharedPointer<Item> curve = Visualization::data->template GeometricObject<Item>(id);
const QSharedPointer<Item> curve = GetData()->template GeometricObject<Item>(id);
++i;
VCurvePathItem *path = GetCurve(static_cast<quint32>(i), supportColor2);
DrawPath(path, curve->GetPath(), curve->DirectionArrows(), supportColor2, Qt::SolidLine, Qt::RoundCap);
VCurvePathItem *path = GetCurve(static_cast<quint32>(i), Color(VColor::SupportColor2));
DrawPath(path, curve->GetPath(), curve->DirectionArrows(), Color(VColor::SupportColor2), Qt::SolidLine,
Qt::RoundCap);
return path;
}
//---------------------------------------------------------------------------------------------------------------------
template <class Item>
int VisToolMove::AddMovedRotatedCurve(qreal angle, qreal length, quint32 id, int i, qreal rotationAngle,
const QPointF &rotationOrigin)
auto VisToolMove::AddMovedRotatedCurve(qreal angle, qreal length, quint32 id, int i, qreal rotationAngle,
const QPointF &rotationOrigin) -> int
{
const QSharedPointer<Item> curve = Visualization::data->template GeometricObject<Item>(id);
const QSharedPointer<Item> curve = GetData()->template GeometricObject<Item>(id);
++i;
VCurvePathItem *path = GetCurve(static_cast<quint32>(i), supportColor);
VCurvePathItem *path = GetCurve(static_cast<quint32>(i), Color(VColor::SupportColor));
const Item moved = curve->Move(length, angle).Rotate(rotationOrigin, rotationAngle);
DrawPath(path, moved.GetPath(), moved.DirectionArrows(), supportColor, Qt::SolidLine, Qt::RoundCap);
DrawPath(path, moved.GetPath(), moved.DirectionArrows(), Color(VColor::SupportColor), Qt::SolidLine, Qt::RoundCap);
return i;
}
//---------------------------------------------------------------------------------------------------------------------
QPointF VisToolMove::GetOriginPoint(const QVector<QGraphicsItem *> &objects)
auto VisToolMove::GetOriginPoint(const QVector<QGraphicsItem *> &objects) -> QPointF
{
QRectF boundingRect;
for (auto object : qAsConst(objects))
for (auto *object : qAsConst(objects))
{
if (object)
{
@ -303,13 +289,14 @@ QPointF VisToolMove::GetOriginPoint(const QVector<QGraphicsItem *> &objects)
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
QVector<QGraphicsItem *> VisToolMove::CreateOriginObjects(int &iPoint, int &iCurve)
auto VisToolMove::CreateOriginObjects(int &iPoint, int &iCurve) -> QVector<QGraphicsItem *>
{
QVector<QGraphicsItem *> originObjects;
originObjects.reserve(Objects().size());
for (auto id : qAsConst(objects))
for (auto id : Objects())
{
const QSharedPointer<VGObject> obj = Visualization::data->GetGObject(id);
const QSharedPointer<VGObject> obj = GetData()->GetGObject(id);
// This check helps to find missed objects in the switch
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled.");
@ -318,11 +305,11 @@ QVector<QGraphicsItem *> VisToolMove::CreateOriginObjects(int &iPoint, int &iCur
{
case GOType::Point:
{
const QSharedPointer<VPointF> p = Visualization::data->GeometricObject<VPointF>(id);
const QSharedPointer<VPointF> p = GetData()->GeometricObject<VPointF>(id);
++iPoint;
VScaledEllipse *point = GetPoint(static_cast<quint32>(iPoint), supportColor2);
DrawPoint(point, static_cast<QPointF>(*p), supportColor2);
VScaledEllipse *point = GetPoint(static_cast<quint32>(iPoint), Color(VColor::SupportColor2));
DrawPoint(point, static_cast<QPointF>(*p), Color(VColor::SupportColor2));
originObjects.append(point);
break;
@ -364,9 +351,9 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
void VisToolMove::CreateMovedRotatedObjects(int &iPoint, int &iCurve, qreal length, qreal angle, qreal rotationAngle,
const QPointF &rotationOrigin)
{
for (auto id : qAsConst(objects))
for (auto id : Objects())
{
const QSharedPointer<VGObject> obj = Visualization::data->GetGObject(id);
const QSharedPointer<VGObject> obj = GetData()->GetGObject(id);
// This check helps to find missed objects in the switch
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects was handled.");
@ -375,12 +362,12 @@ void VisToolMove::CreateMovedRotatedObjects(int &iPoint, int &iCurve, qreal leng
{
case GOType::Point:
{
const QSharedPointer<VPointF> p = Visualization::data->GeometricObject<VPointF>(id);
const QSharedPointer<VPointF> p = GetData()->GeometricObject<VPointF>(id);
++iPoint;
VScaledEllipse *point = GetPoint(static_cast<quint32>(iPoint), supportColor);
VScaledEllipse *point = GetPoint(static_cast<quint32>(iPoint), Color(VColor::SupportColor));
DrawPoint(point, static_cast<QPointF>(p->Move(length, angle).Rotate(rotationOrigin, rotationAngle)),
supportColor);
Color(VColor::SupportColor));
break;
}
case GOType::Arc:

View File

@ -39,7 +39,6 @@
#include <QVector>
#include <QtGlobal>
#include "../ifc/ifcdef.h"
#include "../vmisc/def.h"
#include "visoperation.h"
@ -48,49 +47,56 @@ class VisToolMove : public VisOperation
Q_OBJECT // NOLINT
public:
explicit VisToolMove(const VContainer *data, QGraphicsItem *parent = nullptr);
virtual ~VisToolMove() = default;
~VisToolMove() override = default;
virtual void RefreshGeometry() override;
void RefreshGeometry() override;
QString Angle() const;
auto Angle() const -> QString;
void SetAngle(const QString &expression);
QString RotationAngle() const;
auto RotationAngle() const -> QString;
void SetRotationAngle(const QString &expression);
QString Length() const;
qreal LengthValue() const;
auto Length() const -> QString;
auto LengthValue() const -> qreal;
void SetLength(const QString &expression);
void SetRotationOriginPointId(quint32 value);
virtual int type() const override {return Type;}
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolMove)};
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VisToolMove) // NOLINT
qreal angle;
qreal rotationAngle;
qreal length;
VScaledEllipse *pointOrigin;
VScaledEllipse *pointRotationOrigin;
VScaledEllipse *pointFinish;
VCurvePathItem *angleArc;
VScaledLine *rotationLine;
VScaledLine *xAxis;
qreal m_angle{0};
qreal m_rotationAngle{INT_MIN};
qreal m_length{0};
VScaledEllipse *m_pointOrigin{nullptr};
VScaledEllipse *m_pointRotationOrigin{nullptr};
VScaledEllipse *m_pointFinish{nullptr};
VCurvePathItem *m_angleArc{nullptr};
VScaledLine *m_rotationLine{nullptr};
VScaledLine *m_xAxis{nullptr};
quint32 m_rotationOriginId{NULL_ID};
template <class Item>
QGraphicsPathItem *AddOriginCurve(quint32 id, int &i);
auto AddOriginCurve(quint32 id, int &i) -> QGraphicsPathItem *;
template <class Item>
int AddMovedRotatedCurve(qreal angle, qreal length, quint32 id, int i, qreal rotationAngle,
const QPointF &rotationOrigin);
auto AddMovedRotatedCurve(qreal angle, qreal length, quint32 id, int i, qreal rotationAngle,
const QPointF &rotationOrigin) -> int;
static QPointF GetOriginPoint(const QVector<QGraphicsItem *> &objects);
static auto GetOriginPoint(const QVector<QGraphicsItem *> &objects) -> QPointF;
QVector<QGraphicsItem *> CreateOriginObjects(int &iPoint, int &iCurve);
auto CreateOriginObjects(int &iPoint, int &iCurve) -> QVector<QGraphicsItem *>;
void CreateMovedRotatedObjects(int &iPoint, int &iCurve, qreal length, qreal angle, qreal rotationAngle,
const QPointF &rotationOrigin);
};
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolMove::SetRotationOriginPointId(quint32 value)
{
m_rotationOriginId = value;
}
#endif // VISTOOLMOVE_H

View File

@ -59,20 +59,11 @@
//---------------------------------------------------------------------------------------------------------------------
VisToolRotation::VisToolRotation(const VContainer *data, QGraphicsItem *parent)
: VisOperation(data, parent),
angle(INT_MIN),
point(nullptr),
angleArc(nullptr),
xAxis(nullptr)
{
point = InitPoint(supportColor2, this);
angleArc = InitItem<VCurvePathItem>(supportColor2, this);
xAxis = InitItem<VScaledLine>(supportColor2, this);
}
//---------------------------------------------------------------------------------------------------------------------
VisToolRotation::~VisToolRotation()
: VisOperation(data, parent)
{
m_point = InitPoint(Color(VColor::SupportColor2), this);
m_angleArc = InitItem<VCurvePathItem>(Color(VColor::SupportColor2), this);
m_xAxis = InitItem<VScaledLine>(Color(VColor::SupportColor2), this);
}
//---------------------------------------------------------------------------------------------------------------------
@ -81,7 +72,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
void VisToolRotation::RefreshGeometry()
{
if (objects.isEmpty())
if (Objects().isEmpty())
{
return;
}
@ -90,15 +81,15 @@ void VisToolRotation::RefreshGeometry()
qreal tempAngle = 0;
if (object1Id != NULL_ID)
if (m_originPointId != NULL_ID)
{
origin = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(point, static_cast<QPointF>(*origin), supportColor2);
origin = GetData()->GeometricObject<VPointF>(m_originPointId);
DrawPoint(m_point, static_cast<QPointF>(*origin), Color(VColor::SupportColor2));
QLineF rLine;
if (VFuzzyComparePossibleNulls(angle, INT_MIN))
if (VFuzzyComparePossibleNulls(m_angle, INT_MIN))
{
rLine = QLineF(static_cast<QPointF>(*origin), Visualization::scenePos);
rLine = QLineF(static_cast<QPointF>(*origin), ScenePos());
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
{
@ -110,28 +101,28 @@ void VisToolRotation::RefreshGeometry()
}
else
{
rLine = QLineF(static_cast<QPointF>(*origin), Ray(static_cast<QPointF>(*origin), angle));
tempAngle = angle;
rLine = QLineF(static_cast<QPointF>(*origin), Ray(static_cast<QPointF>(*origin), m_angle));
tempAngle = m_angle;
}
DrawLine(this, rLine, supportColor2, Qt::DashLine);
DrawLine(xAxis, QLineF(static_cast<QPointF>(*origin), Ray(static_cast<QPointF>(*origin), 0)), supportColor2,
Qt::DashLine);
DrawLine(this, rLine, Color(VColor::SupportColor2), Qt::DashLine);
DrawLine(m_xAxis, QLineF(static_cast<QPointF>(*origin), Ray(static_cast<QPointF>(*origin), 0)),
Color(VColor::SupportColor2), Qt::DashLine);
VArc arc(*origin, ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene()))*2, 0, tempAngle);
DrawPath(angleArc, arc.GetPath(), supportColor2, Qt::SolidLine, Qt::RoundCap);
DrawPath(m_angleArc, arc.GetPath(), Color(VColor::SupportColor2), Qt::SolidLine, Qt::RoundCap);
Visualization::toolTip = tr("Rotating angle = %1°, <b>%2</b> - sticking angle, "
SetToolTip(tr("Rotating angle = %1°, <b>%2</b> - sticking angle, "
"<b>Mouse click</b> - finish creation")
.arg(tempAngle)
.arg(VModifierKey::Shift());
.arg(VModifierKey::Shift()));
}
int iPoint = -1;
int iCurve = -1;
for (auto id : qAsConst(objects))
for (auto id : Objects())
{
const QSharedPointer<VGObject> obj = Visualization::data->GetGObject(id);
const QSharedPointer<VGObject> obj = GetData()->GetGObject(id);
// This check helps to find missed objects in the switch
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects was handled.");
@ -140,19 +131,19 @@ void VisToolRotation::RefreshGeometry()
{
case GOType::Point:
{
const QSharedPointer<VPointF> p = Visualization::data->GeometricObject<VPointF>(id);
const QSharedPointer<VPointF> p = GetData()->GeometricObject<VPointF>(id);
++iPoint;
VScaledEllipse *point = GetPoint(static_cast<quint32>(iPoint), supportColor2);
DrawPoint(point, static_cast<QPointF>(*p), supportColor2);
VScaledEllipse *point = GetPoint(static_cast<quint32>(iPoint), Color(VColor::SupportColor2));
DrawPoint(point, static_cast<QPointF>(*p), Color(VColor::SupportColor2));
++iPoint;
point = GetPoint(static_cast<quint32>(iPoint), supportColor);
point = GetPoint(static_cast<quint32>(iPoint), Color(VColor::SupportColor));
if (object1Id != NULL_ID)
if (m_originPointId != NULL_ID)
{
DrawPoint(point, static_cast<QPointF>(p->Rotate(static_cast<QPointF>(*origin), tempAngle)),
supportColor);
Color(VColor::SupportColor));
}
break;
}
@ -193,16 +184,11 @@ void VisToolRotation::RefreshGeometry()
}
}
}
QT_WARNING_POP
//---------------------------------------------------------------------------------------------------------------------
void VisToolRotation::SetOriginPointId(quint32 value)
{
object1Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
QString VisToolRotation::Angle() const
auto VisToolRotation::Angle() const -> QString
{
return QString::number(line().angle());
}
@ -210,25 +196,27 @@ QString VisToolRotation::Angle() const
//---------------------------------------------------------------------------------------------------------------------
void VisToolRotation::SetAngle(const QString &expression)
{
angle = FindValFromUser(expression, Visualization::data->DataVariables());
m_angle = FindValFromUser(expression, GetData()->DataVariables());
}
//---------------------------------------------------------------------------------------------------------------------
template <class Item>
int VisToolRotation::AddCurve(qreal angle, const QPointF &origin, quint32 id, int i)
auto VisToolRotation::AddCurve(qreal angle, const QPointF &origin, quint32 id, int i) -> int
{
const QSharedPointer<Item> curve = Visualization::data->template GeometricObject<Item>(id);
const QSharedPointer<Item> curve = GetData()->template GeometricObject<Item>(id);
++i;
VCurvePathItem *path = GetCurve(static_cast<quint32>(i), supportColor2);
DrawPath(path, curve->GetPath(), curve->DirectionArrows(), supportColor2, Qt::SolidLine, Qt::RoundCap);
VCurvePathItem *path = GetCurve(static_cast<quint32>(i), Color(VColor::SupportColor2));
DrawPath(path, curve->GetPath(), curve->DirectionArrows(), Color(VColor::SupportColor2), Qt::SolidLine,
Qt::RoundCap);
++i;
path = GetCurve(static_cast<quint32>(i), supportColor);
if (object1Id != NULL_ID)
path = GetCurve(static_cast<quint32>(i), Color(VColor::SupportColor));
if (m_originPointId != NULL_ID)
{
const Item rotated = curve->Rotate(origin, angle);
DrawPath(path, rotated.GetPath(), rotated.DirectionArrows(), supportColor, Qt::SolidLine, Qt::RoundCap);
DrawPath(path, rotated.GetPath(), rotated.DirectionArrows(), Color(VColor::SupportColor), Qt::SolidLine,
Qt::RoundCap);
}
return i;

View File

@ -39,7 +39,6 @@
#include <QVector>
#include <QtGlobal>
#include "../ifc/ifcdef.h"
#include "../vmisc/def.h"
#include "visoperation.h"
@ -48,27 +47,34 @@ class VisToolRotation : public VisOperation
Q_OBJECT // NOLINT
public:
explicit VisToolRotation(const VContainer *data, QGraphicsItem *parent = nullptr);
virtual ~VisToolRotation();
~VisToolRotation() override = default;
virtual void RefreshGeometry() override;
void RefreshGeometry() override;
void SetOriginPointId(quint32 value);
QString Angle() const;
auto Angle() const -> QString;
void SetAngle(const QString &expression);
virtual int type() const override {return Type;}
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolRotation)};
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VisToolRotation) // NOLINT
qreal angle;
VScaledEllipse *point;
VCurvePathItem *angleArc;
VScaledLine *xAxis;
qreal m_angle{INT_MIN};
VScaledEllipse *m_point{nullptr};
VCurvePathItem *m_angleArc{nullptr};
VScaledLine *m_xAxis{nullptr};
quint32 m_originPointId{NULL_ID};
template <class Item>
int AddCurve(qreal angle, const QPointF &origin, quint32 id, int i);
auto AddCurve(qreal angle, const QPointF &origin, quint32 id, int i) -> int;
};
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolRotation::SetOriginPointId(quint32 value)
{
m_originPointId = value;
}
#endif // VISTOOLROTATION_H

View File

@ -32,11 +32,9 @@
#include <QGuiApplication>
#include <QPen>
#include <QRectF>
#include <QtMath>
#include "../ifc/ifcdef.h"
#include "../vgeometry/vgobject.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vmath.h"
#include "../vpatterndb/vcontainer.h"
//---------------------------------------------------------------------------------------------------------------------
@ -48,7 +46,7 @@ VisLine::VisLine(const VContainer *data, QGraphicsItem *parent)
}
//---------------------------------------------------------------------------------------------------------------------
qreal VisLine::CorrectAngle(const qreal &angle)
auto VisLine::CorrectAngle(const qreal &angle) -> qreal
{
qreal ang = angle;
if (angle > 360)
@ -79,11 +77,11 @@ qreal VisLine::CorrectAngle(const qreal &angle)
}
//---------------------------------------------------------------------------------------------------------------------
QPointF VisLine::Ray(const QPointF &firstPoint, const qreal &angle) const
auto VisLine::Ray(const QPointF &firstPoint, const qreal &angle) const -> QPointF
{
if (this->scene() == nullptr)
{
QLineF line = QLineF(firstPoint, Visualization::scenePos);
QLineF line = QLineF(firstPoint, ScenePos());
line.setAngle(angle);
return line.p2();// We can't find ray because item doesn't have scene. We will return cursor position on scene.
}
@ -103,29 +101,25 @@ QPointF VisLine::Ray(const QPointF &firstPoint, const qreal &angle) const
{
return VGObject::BuildRay(firstPoint, CorrectAngle(angle), scRect);
}
else
{
return VGObject::BuildRay(firstPoint, angle, scRect);
}
}
//---------------------------------------------------------------------------------------------------------------------
QPointF VisLine::Ray(const QPointF &firstPoint) const
auto VisLine::Ray(const QPointF &firstPoint) const -> QPointF
{
QLineF line = QLineF(firstPoint, Visualization::scenePos);
QLineF line = QLineF(firstPoint, ScenePos());
return Ray(firstPoint, line.angle());
}
//---------------------------------------------------------------------------------------------------------------------
QLineF VisLine::Axis(const QPointF &p, const qreal &angle) const
auto VisLine::Axis(const QPointF &p, const qreal &angle) const -> QLineF
{
QPointF endP1 = Ray(p, angle+180);
QPointF endP2 = Ray(p, angle);
return QLineF(endP1, endP2);
return {Ray(p, angle+180), Ray(p, angle)};
}
//---------------------------------------------------------------------------------------------------------------------
QLineF VisLine::Axis(const QPointF &p1, const QPointF &p2) const
auto VisLine::Axis(const QPointF &p1, const QPointF &p2) const -> QLineF
{
QLineF line(p1, p2);
return Axis(p1, line.angle());
@ -135,8 +129,8 @@ QLineF VisLine::Axis(const QPointF &p1, const QPointF &p2) const
void VisLine::InitPen()
{
QPen visPen = pen();
visPen.setColor(mainColor);
visPen.setStyle(lineStyle);
visPen.setColor(Color(VColor::MainColor));
visPen.setStyle(LineStyle());
setPen(visPen);
}

View File

@ -50,21 +50,23 @@ class VisLine: public Visualization, public VScaledLine
Q_OBJECT // NOLINT
public:
explicit VisLine(const VContainer *data, QGraphicsItem *parent = nullptr);
virtual ~VisLine() = default;
~VisLine() override = default;
virtual int type() const override {return Type;}
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::Line)};
static qreal CorrectAngle(const qreal &angle);
protected:
QPointF Ray(const QPointF &firstPoint, const qreal &angle) const;
QPointF Ray(const QPointF &firstPoint) const;
QLineF Axis(const QPointF &p, const qreal &angle) const;
QLineF Axis(const QPointF &p1, const QPointF &p2) const;
virtual void InitPen() override;
virtual void AddOnScene() override;
void DrawRay(VScaledLine *lineItem, const QPointF &p, const QPointF &pTangent,
const QColor &color, Qt::PenStyle style);
static auto CorrectAngle(const qreal &angle) -> qreal;
protected:
auto Ray(const QPointF &firstPoint, const qreal &angle) const -> QPointF;
auto Ray(const QPointF &firstPoint) const -> QPointF;
auto Axis(const QPointF &p, const qreal &angle) const -> QLineF;
auto Axis(const QPointF &p1, const QPointF &p2) const -> QLineF;
void InitPen() override;
void AddOnScene() override;
void DrawRay(VScaledLine *lineItem, const QPointF &p, const QPointF &pTangent, const QColor &color,
Qt::PenStyle style);
private:
Q_DISABLE_COPY_MOVE(VisLine) // NOLINT
};

View File

@ -47,70 +47,58 @@
VisToolAlongLine::VisToolAlongLine(const VContainer *data, QGraphicsItem *parent)
: VisLine(data, parent)
{
this->mainColor = Qt::red;
SetMainColor(Qt::red);
this->setZValue(2);// Show on top real tool
m_lineP1 = InitPoint(supportColor, this);
m_lineP2 = InitPoint(supportColor, this); //-V656
m_line = InitItem<VScaledLine>(supportColor, this);
m_point = InitPoint(mainColor, this);
m_lineP1 = InitPoint(Color(VColor::SupportColor), this);
m_lineP2 = InitPoint(Color(VColor::SupportColor), this); //-V656
m_line = InitItem<VScaledLine>(Color(VColor::SupportColor), this);
m_point = InitPoint(Color(VColor::MainColor), this);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolAlongLine::setObject2Id(const quint32 &value)
void VisToolAlongLine::SetLength(const QString &expression)
{
m_object2Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolAlongLine::setLength(const QString &expression)
{
m_length = FindLengthFromUser(expression, Visualization::data->DataVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolAlongLine::setMidPointMode(bool midPointMode)
{
m_midPointMode = midPointMode;
m_length = FindLengthFromUser(expression, GetData()->DataVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolAlongLine::RefreshGeometry()
{
if (object1Id > NULL_ID)
if (m_point1Id > NULL_ID)
{
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(m_lineP1, static_cast<QPointF>(*first), supportColor);
const QSharedPointer<VPointF> first = GetData()->GeometricObject<VPointF>(m_point1Id);
DrawPoint(m_lineP1, static_cast<QPointF>(*first), Color(VColor::SupportColor));
if (m_object2Id <= NULL_ID)
if (m_point2Id <= NULL_ID)
{
QLineF cursorLine (static_cast<QPointF>(*first), Visualization::scenePos);
DrawLine(m_line, cursorLine, supportColor);
QLineF cursorLine (static_cast<QPointF>(*first), ScenePos());
DrawLine(m_line, cursorLine, Color(VColor::SupportColor));
if (m_midPointMode)
{
cursorLine.setLength(cursorLine.length()/2.0);
DrawPoint(m_point, cursorLine.p2(), mainColor);
DrawPoint(m_point, cursorLine.p2(), Color(VColor::MainColor));
}
}
else
{
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(m_object2Id);
DrawPoint(m_lineP2, static_cast<QPointF>(*second), supportColor);
const QSharedPointer<VPointF> second = GetData()->GeometricObject<VPointF>(m_point2Id);
DrawPoint(m_lineP2, static_cast<QPointF>(*second), Color(VColor::SupportColor));
QLineF baseLine(static_cast<QPointF>(*first), static_cast<QPointF>(*second));
DrawLine(m_line, baseLine, supportColor);
DrawLine(m_line, baseLine, Color(VColor::SupportColor));
if (not qFuzzyIsNull(m_length))
{
QLineF mainLine = VGObject::BuildLine(static_cast<QPointF>(*first), m_length, m_line->line().angle());
DrawLine(this, mainLine, mainColor, lineStyle);
DrawLine(this, mainLine, Color(VColor::MainColor), LineStyle());
DrawPoint(m_point, mainLine.p2(), mainColor);
DrawPoint(m_point, mainLine.p2(), Color(VColor::MainColor));
}
else if (mode == Mode::Creation)
else if (GetMode() == Mode::Creation)
{
QLineF cursorLine (static_cast<QPointF>(*first), Visualization::scenePos);
QLineF cursorLine (static_cast<QPointF>(*first), ScenePos());
qreal len = cursorLine.length();
qreal angleTo = baseLine.angleTo(cursorLine);
@ -120,16 +108,23 @@ void VisToolAlongLine::RefreshGeometry()
}
QLineF mainLine = VGObject::BuildLine(static_cast<QPointF>(*first), len, m_line->line().angle());
DrawLine(this, mainLine, mainColor, lineStyle);
DrawLine(this, mainLine, Color(VColor::MainColor), LineStyle());
DrawPoint(m_point, mainLine.p2(), mainColor);
DrawPoint(m_point, mainLine.p2(), Color(VColor::MainColor));
const QString prefix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
Visualization::toolTip = tr("Length = %1%2; "
SetToolTip(tr("Length = %1%2; "
"<b>Mouse click</b> - finish selecting the length, "
"<b>%3</b> - skip")
.arg(NumberToUser(len), prefix, VModifierKey::EnterKey());
.arg(NumberToUser(len), prefix, VModifierKey::EnterKey()));
}
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolAlongLine::VisualMode(quint32 id)
{
m_point1Id = id;
StartVisualMode();
}

View File

@ -47,16 +47,20 @@ public:
~VisToolAlongLine() override = default;
void RefreshGeometry() override;
void setObject2Id(const quint32 &value);
void setLength(const QString &expression);
void setMidPointMode(bool midPointMode);
void VisualMode(quint32 id) override;
void SetPoint1Id(quint32 value);
void SetPoint2Id(quint32 value);
void SetLength(const QString &expression);
void SetMidPointMode(bool midPointMode);
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolAlongLine)};
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VisToolAlongLine) // NOLINT
quint32 m_object2Id{NULL_ID};
quint32 m_point1Id{NULL_ID};
quint32 m_point2Id{NULL_ID};
VScaledEllipse *m_point{nullptr};
VScaledEllipse *m_lineP1{nullptr};
VScaledEllipse *m_lineP2{nullptr};
@ -65,4 +69,22 @@ private:
bool m_midPointMode{false};
};
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolAlongLine::SetPoint1Id(quint32 value)
{
m_point1Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolAlongLine::SetPoint2Id(quint32 value)
{
m_point2Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolAlongLine::SetMidPointMode(bool midPointMode)
{
m_midPointMode = midPointMode;
}
#endif // VISTOOLALONGLINE_H

View File

@ -46,63 +46,53 @@
VisToolBisector::VisToolBisector(const VContainer *data, QGraphicsItem *parent)
:VisLine(data, parent)
{
m_line1P1 = InitPoint(supportColor, this);
m_line1P2 = InitPoint(supportColor, this); //-V656
m_line1 = InitItem<VScaledLine>(supportColor, this);
m_line1P1 = InitPoint(Color(VColor::SupportColor), this);
m_line1P2 = InitPoint(Color(VColor::SupportColor), this); //-V656
m_line1 = InitItem<VScaledLine>(Color(VColor::SupportColor), this);
m_line2P2 = InitPoint(supportColor, this);
m_line2 = InitItem<VScaledLine>(supportColor, this);
m_line2P2 = InitPoint(Color(VColor::SupportColor), this);
m_line2 = InitItem<VScaledLine>(Color(VColor::SupportColor), this);
m_point = InitPoint(mainColor, this);
m_point = InitPoint(Color(VColor::MainColor), this);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolBisector::setObject2Id(const quint32 &value)
void VisToolBisector::SetLength(const QString &expression)
{
m_object2Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolBisector::setObject3Id(const quint32 &value)
{
m_object3Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolBisector::setLength(const QString &expression)
{
m_length = FindLengthFromUser(expression, Visualization::data->DataVariables());
m_length = FindLengthFromUser(expression, GetData()->DataVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolBisector::RefreshGeometry()
{
if (object1Id > NULL_ID)
if (m_point1Id > NULL_ID)
{
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(m_line1P1, static_cast<QPointF>(*first), supportColor);
const QSharedPointer<VPointF> first = GetData()->GeometricObject<VPointF>(m_point1Id);
DrawPoint(m_line1P1, static_cast<QPointF>(*first), Color(VColor::SupportColor));
if (m_object2Id <= NULL_ID)
if (m_point2Id <= NULL_ID)
{
DrawLine(m_line1, QLineF(static_cast<QPointF>(*first), Visualization::scenePos), supportColor);
DrawLine(m_line1, QLineF(static_cast<QPointF>(*first), ScenePos()), Color(VColor::SupportColor));
}
else
{
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(m_object2Id);
DrawPoint(m_line1P2, static_cast<QPointF>(*second), supportColor);
const QSharedPointer<VPointF> second = GetData()->GeometricObject<VPointF>(m_point2Id);
DrawPoint(m_line1P2, static_cast<QPointF>(*second), Color(VColor::SupportColor));
DrawLine(m_line1, QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)), supportColor);
DrawLine(m_line1, QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)),
Color(VColor::SupportColor));
if (m_object3Id <= NULL_ID)
if (m_point3Id <= NULL_ID)
{
DrawLine(m_line2, QLineF(static_cast<QPointF>(*second), Visualization::scenePos), supportColor);
DrawLine(m_line2, QLineF(static_cast<QPointF>(*second), ScenePos()), Color(VColor::SupportColor));
}
else
{
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(m_object3Id);
DrawPoint(m_line2P2, static_cast<QPointF>(*third), supportColor);
const QSharedPointer<VPointF> third = GetData()->GeometricObject<VPointF>(m_point3Id);
DrawPoint(m_line2P2, static_cast<QPointF>(*third), Color(VColor::SupportColor));
DrawLine(m_line2, QLineF(static_cast<QPointF>(*second), static_cast<QPointF>(*third)), supportColor);
DrawLine(m_line2, QLineF(static_cast<QPointF>(*second), static_cast<QPointF>(*third)),
Color(VColor::SupportColor));
if (not qFuzzyIsNull(m_length))
{
@ -110,13 +100,13 @@ void VisToolBisector::RefreshGeometry()
static_cast<QPointF>(*second),
static_cast<QPointF>(*third));
QLineF mainLine = VGObject::BuildLine(static_cast<QPointF>(*second), m_length, angle);
DrawLine(this, mainLine, mainColor, lineStyle);
DrawLine(this, mainLine, Color(VColor::MainColor), LineStyle());
DrawPoint(m_point, mainLine.p2(), mainColor);
DrawPoint(m_point, mainLine.p2(), Color(VColor::MainColor));
}
else if (mode == Mode::Creation)
else if (GetMode() == Mode::Creation)
{
QLineF cursorLine (static_cast<QPointF>(*second), Visualization::scenePos);
QLineF cursorLine (static_cast<QPointF>(*second), ScenePos());
QLineF baseLine(static_cast<QPointF>(*second), static_cast<QPointF>(*third));
qreal angle = VToolBisector::BisectorAngle(static_cast<QPointF>(*first),
@ -134,15 +124,15 @@ void VisToolBisector::RefreshGeometry()
QLineF mainLine = VGObject::BuildLine(static_cast<QPointF>(*second), len, angle);
DrawLine(this, mainLine, mainColor, lineStyle);
DrawLine(this, mainLine, Color(VColor::MainColor), LineStyle());
DrawPoint(m_point, mainLine.p2(), mainColor);
DrawPoint(m_point, mainLine.p2(), Color(VColor::MainColor));
const QString prefix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
Visualization::toolTip = tr("Length = %1%2; "
SetToolTip(tr("Length = %1%2; "
"<b>Mouse click</b> - finish selecting the length, "
"<b>%3</b> - skip")
.arg(NumberToUser(len), prefix, VModifierKey::EnterKey());
.arg(NumberToUser(len), prefix, VModifierKey::EnterKey()));
}
else
{
@ -153,9 +143,16 @@ void VisToolBisector::RefreshGeometry()
QLineF mainLine = VGObject::BuildLine(static_cast<QPointF>(*second),
QLineF(static_cast<QPointF>(*second), endRay).length(),
angle);
DrawLine(this, mainLine, mainColor, lineStyle);
DrawLine(this, mainLine, Color(VColor::MainColor), LineStyle());
}
}
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolBisector::VisualMode(quint32 id)
{
m_point1Id = id;
StartVisualMode();
}

View File

@ -47,16 +47,21 @@ public:
~VisToolBisector() override = default;
void RefreshGeometry() override;
void setObject2Id(const quint32 &value);
void setObject3Id(const quint32 &value);
void setLength(const QString &expression);
void VisualMode(quint32 id) override;
void SetPoint1Id(quint32 value);
void SetPoint2Id(quint32 value);
void SetPoint3Id(quint32 value);
void SetLength(const QString &expression);
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolBisector)};
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VisToolBisector) // NOLINT
quint32 m_object2Id{NULL_ID};
quint32 m_object3Id{NULL_ID};
quint32 m_point1Id{NULL_ID};
quint32 m_point2Id{NULL_ID};
quint32 m_point3Id{NULL_ID};
VScaledEllipse *m_point{nullptr};
VScaledEllipse *m_line1P1{nullptr};
VScaledEllipse *m_line1P2{nullptr};
@ -66,4 +71,22 @@ private:
qreal m_length{0};
};
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolBisector::SetPoint1Id(quint32 value)
{
m_point1Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolBisector::SetPoint2Id(quint32 value)
{
m_point2Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolBisector::SetPoint3Id(quint32 value)
{
m_point3Id = value;
}
#endif // VISTOOLBISECTOR_H

View File

@ -39,7 +39,6 @@
#include <new>
#include "../../tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h"
#include "../ifc/ifcdef.h"
#include "../vgeometry/vabstractcurve.h"
#include "../vgeometry/vpointf.h"
#include "../vpatterndb/vcontainer.h"
@ -49,70 +48,71 @@
//---------------------------------------------------------------------------------------------------------------------
VisToolCurveIntersectAxis::VisToolCurveIntersectAxis(const VContainer *data, QGraphicsItem *parent)
: VisLine(data, parent), axisPointId(NULL_ID), angle(-1), point(nullptr), basePoint(nullptr), baseLine(nullptr),
axisLine(nullptr), visCurve(nullptr)
: VisLine(data, parent)
{
this->mainColor = Qt::red;
SetMainColor(Qt::red);
visCurve = InitItem<VCurvePathItem>(Qt::darkGreen, this);
basePoint = InitPoint(supportColor, this);
baseLine = InitItem<VScaledLine>(supportColor, this);
axisLine = InitItem<VScaledLine>(supportColor, this); //-V656
point = InitPoint(mainColor, this);
m_visCurve = InitItem<VCurvePathItem>(Qt::darkGreen, this);
m_basePoint = InitPoint(Color(VColor::SupportColor), this);
m_baseLine = InitItem<VScaledLine>(Color(VColor::SupportColor), this);
m_axisLine = InitItem<VScaledLine>(Color(VColor::SupportColor), this); //-V656
m_point = InitPoint(Color(VColor::MainColor), this);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolCurveIntersectAxis::RefreshGeometry()
{
if (object1Id > NULL_ID)
if (m_curveId > NULL_ID)
{
const QSharedPointer<VAbstractCurve> curve = Visualization::data->GeometricObject<VAbstractCurve>(object1Id);
DrawPath(visCurve, curve->GetPath(), curve->DirectionArrows(), supportColor, Qt::SolidLine, Qt::RoundCap);
const QSharedPointer<VAbstractCurve> curve = GetData()->GeometricObject<VAbstractCurve>(m_curveId);
DrawPath(m_visCurve, curve->GetPath(), curve->DirectionArrows(), Color(VColor::SupportColor), Qt::SolidLine,
Qt::RoundCap);
if (axisPointId > NULL_ID)
if (m_axisPointId > NULL_ID)
{
QLineF axis;
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(axisPointId);
if (VFuzzyComparePossibleNulls(angle, -1))
const QSharedPointer<VPointF> first = GetData()->GeometricObject<VPointF>(m_axisPointId);
if (VFuzzyComparePossibleNulls(m_angle, -1))
{
axis = Axis(static_cast<QPointF>(*first), Visualization::scenePos);
axis = Axis(static_cast<QPointF>(*first), ScenePos());
}
else
{
axis = Axis(static_cast<QPointF>(*first), angle);
axis = Axis(static_cast<QPointF>(*first), m_angle);
}
DrawPoint(basePoint, static_cast<QPointF>(*first), mainColor);
DrawLine(axisLine, axis, supportColor, Qt::DashLine);
DrawPoint(m_basePoint, static_cast<QPointF>(*first), Color(VColor::MainColor));
DrawLine(m_axisLine, axis, Color(VColor::SupportColor), Qt::DashLine);
QPointF p;
VToolCurveIntersectAxis::FindPoint(static_cast<QPointF>(*first), axis.angle(), curve->GetPoints(), &p);
QLineF axis_line(static_cast<QPointF>(*first), p);
DrawLine(this, axis_line, mainColor, lineStyle);
DrawLine(this, axis_line, Color(VColor::MainColor), LineStyle());
DrawPoint(point, p, mainColor);
DrawPoint(m_point, p, Color(VColor::MainColor));
Visualization::toolTip = tr("<b>Intersection curve and axis</b>: angle = %1°; <b>%2</b> - "
SetToolTip(tr("<b>Intersection curve and axis</b>: angle = %1°; <b>%2</b> - "
"sticking angle, <b>%3</b> - finish creation")
.arg(this->line().angle())
.arg(VModifierKey::Shift(), VModifierKey::EnterKey());
.arg(VModifierKey::Shift(), VModifierKey::EnterKey()));
}
}
}
//---------------------------------------------------------------------------------------------------------------------
QString VisToolCurveIntersectAxis::Angle() const
void VisToolCurveIntersectAxis::VisualMode(quint32 id)
{
return QString("%1").arg(this->line().angle());
m_curveId = id;
StartVisualMode();
}
//---------------------------------------------------------------------------------------------------------------------
auto VisToolCurveIntersectAxis::Angle() const -> QString
{
return QString::number(this->line().angle());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolCurveIntersectAxis::SetAngle(const QString &expression)
{
angle = FindValFromUser(expression, Visualization::data->DataVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolCurveIntersectAxis::setAxisPointId(const quint32 &value)
{
axisPointId = value;
m_angle = FindValFromUser(expression, GetData()->DataVariables());
}

View File

@ -44,26 +44,43 @@ class VisToolCurveIntersectAxis final : public VisLine
Q_OBJECT // NOLINT
public:
explicit VisToolCurveIntersectAxis(const VContainer *data, QGraphicsItem *parent = nullptr);
virtual ~VisToolCurveIntersectAxis() = default;
~VisToolCurveIntersectAxis() override = default;
virtual void RefreshGeometry() override;
void RefreshGeometry() override;
void VisualMode(quint32 id) override;
QString Angle() const;
auto Angle() const -> QString;
void SetAngle(const QString &expression);
void SetCurveId(quint32 newCurveId);
void setAxisPointId(const quint32 &value);
virtual int type() const override {return Type;}
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolLineIntersectAxis)};
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VisToolCurveIntersectAxis) // NOLINT
quint32 axisPointId;
qreal angle;
VScaledEllipse *point;
VScaledEllipse *basePoint;
VScaledLine *baseLine;
VScaledLine *axisLine;
VCurvePathItem *visCurve;
quint32 m_axisPointId{NULL_ID};
qreal m_angle{-1};
VScaledEllipse *m_point{nullptr};
VScaledEllipse *m_basePoint{nullptr};
VScaledLine *m_baseLine{nullptr};
VScaledLine *m_axisLine{nullptr};
VCurvePathItem *m_visCurve{nullptr};
quint32 m_curveId{NULL_ID};
};
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolCurveIntersectAxis::SetCurveId(quint32 newCurveId)
{
m_curveId = newCurveId;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolCurveIntersectAxis::setAxisPointId(const quint32 &value)
{
m_axisPointId = value;
}
#endif // VISTOOLCURVEINTERSECTAXIS_H

View File

@ -36,7 +36,6 @@
#include <Qt>
#include <new>
#include "../ifc/xml/vdomdocument.h"
#include "../vgeometry/vgobject.h"
#include "../vgeometry/vpointf.h"
#include "../vmisc/vabstractapplication.h"
@ -49,55 +48,63 @@
//---------------------------------------------------------------------------------------------------------------------
VisToolEndLine::VisToolEndLine(const VContainer *data, QGraphicsItem *parent)
: VisLine(data, parent), length(0), angle(0), point(nullptr)
: VisLine(data, parent)
{
this->mainColor = Qt::red;
SetMainColor(Qt::red);
point = InitPoint(mainColor, this);
m_point = InitPoint(Color(VColor::MainColor), this);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolEndLine::RefreshGeometry()
{
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
const QSharedPointer<VPointF> first = GetData()->GeometricObject<VPointF>(m_basePointId);
QLineF line;
if (qFuzzyIsNull(length))
if (qFuzzyIsNull(m_length))
{
if (mode == Mode::Creation)
if (GetMode() == Mode::Creation)
{
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
{
line = QLineF(static_cast<QPointF>(*first), Visualization::scenePos);
line = QLineF(static_cast<QPointF>(*first), ScenePos());
line.setAngle(CorrectAngle(line.angle()));
}
else
{
line = QLineF(static_cast<QPointF>(*first), Visualization::scenePos);
line = QLineF(static_cast<QPointF>(*first), ScenePos());
}
}
else
{
DrawPoint(point, static_cast<QPointF>(*first), mainColor);
DrawPoint(m_point, static_cast<QPointF>(*first), Color(VColor::MainColor));
}
}
else
{
line = VGObject::BuildLine(static_cast<QPointF>(*first), length, angle);
DrawPoint(point, line.p2(), mainColor);
line = VGObject::BuildLine(static_cast<QPointF>(*first), m_length, m_angle);
DrawPoint(m_point, line.p2(), Color(VColor::MainColor));
}
DrawLine(this, line, mainColor, lineStyle);
DrawLine(this, line, Color(VColor::MainColor), LineStyle());
static const QString prefix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
Visualization::toolTip = tr("<b>Point at distance and angle</b>: angle = %1°, length = %2%3; "
SetToolTip(tr("<b>Point at distance and angle</b>: angle = %1°, length = %2%3; "
"<b>%4</b> - sticking angle, <b>%5</b> - finish creation")
.arg(this->line().angle())
.arg(VAbstractApplication::VApp()->TrVars()
->FormulaToUser(QString::number(VAbstractValApplication::VApp()->fromPixel(this->line().length())),
->FormulaToUser(
QString::number(VAbstractValApplication::VApp()->fromPixel(this->line().length())),
VAbstractApplication::VApp()->Settings()->GetOsSeparator()),
prefix, VModifierKey::Shift(), VModifierKey::EnterKey());
prefix, VModifierKey::Shift(), VModifierKey::EnterKey()));
}
//---------------------------------------------------------------------------------------------------------------------
QString VisToolEndLine::Angle() const
void VisToolEndLine::VisualMode(quint32 id)
{
m_basePointId = id;
StartVisualMode();
}
//---------------------------------------------------------------------------------------------------------------------
auto VisToolEndLine::Angle() const -> QString
{
return QString::number(this->line().angle());
}
@ -105,17 +112,17 @@ QString VisToolEndLine::Angle() const
//---------------------------------------------------------------------------------------------------------------------
void VisToolEndLine::SetAngle(const QString &expression)
{
angle = FindValFromUser(expression, Visualization::data->DataVariables());
m_angle = FindValFromUser(expression, GetData()->DataVariables());
}
//---------------------------------------------------------------------------------------------------------------------
QString VisToolEndLine::Length() const
auto VisToolEndLine::Length() const -> QString
{
return QString::number(VAbstractValApplication::VApp()->fromPixel(this->line().length()));
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolEndLine::setLength(const QString &expression)
void VisToolEndLine::SetLength(const QString &expression)
{
length = FindLengthFromUser(expression, Visualization::data->DataVariables());
m_length = FindLengthFromUser(expression, GetData()->DataVariables());
}

View File

@ -44,24 +44,34 @@ class VisToolEndLine final : public VisLine
Q_OBJECT // NOLINT
public:
explicit VisToolEndLine(const VContainer *data, QGraphicsItem *parent = nullptr);
virtual ~VisToolEndLine() = default;
~VisToolEndLine() override = default;
virtual void RefreshGeometry() override;
void RefreshGeometry() override;
void VisualMode(quint32 id) override;
QString Angle() const;
auto Angle() const -> QString;
void SetAngle(const QString &expression);
QString Length() const;
void setLength(const QString &expression);
auto Length() const -> QString;
void SetLength(const QString &expression);
virtual int type() const override {return Type;}
void SetBasePointId(quint32 id);
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolEndLine)};
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VisToolEndLine) // NOLINT
qreal length;
qreal angle;
VScaledEllipse *point;
qreal m_length{0};
qreal m_angle{0};
VScaledEllipse *m_point{nullptr};
quint32 m_basePointId{NULL_ID};
};
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolEndLine::SetBasePointId(quint32 id)
{
m_basePointId = id;
}
#endif // VISTOOLENDLINE_H

View File

@ -36,7 +36,6 @@
#include <new>
#include "../../tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h"
#include "../ifc/ifcdef.h"
#include "../vgeometry/vpointf.h"
#include "../vpatterndb/vcontainer.h"
#include "../visualization.h"
@ -47,53 +46,53 @@
VisToolHeight::VisToolHeight(const VContainer *data, QGraphicsItem *parent)
: VisLine(data, parent)
{
base_point = InitPoint(supportColor, this);
lineP1 = InitPoint(supportColor, this);
lineP2 = InitPoint(supportColor, this);
line = InitItem<VScaledLine>(supportColor, this);
line_intersection = InitItem<VScaledLine>(supportColor, this); //-V656
m_basePoint = InitPoint(Color(VColor::SupportColor), this);
m_lineP1 = InitPoint(Color(VColor::SupportColor), this);
m_lineP2 = InitPoint(Color(VColor::SupportColor), this);
m_line = InitItem<VScaledLine>(Color(VColor::SupportColor), this);
m_lineIntersection = InitItem<VScaledLine>(Color(VColor::SupportColor), this); //-V656
point = InitPoint(mainColor, this);
m_point = InitPoint(Color(VColor::MainColor), this);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolHeight::RefreshGeometry()
{
if (object1Id > NULL_ID)
if (m_basePointId > NULL_ID)
{
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(base_point, static_cast<QPointF>(*first), supportColor);
const QSharedPointer<VPointF> first = GetData()->GeometricObject<VPointF>(m_basePointId);
DrawPoint(m_basePoint, static_cast<QPointF>(*first), Color(VColor::SupportColor));
if (lineP1Id <= NULL_ID)
if (m_lineP1Id <= NULL_ID)
{
DrawLine(this, QLineF(static_cast<QPointF>(*first), Visualization::scenePos), mainColor);
DrawLine(this, QLineF(static_cast<QPointF>(*first), ScenePos()), Color(VColor::MainColor));
}
else
{
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(lineP1Id);
DrawPoint(lineP1, static_cast<QPointF>(*second), supportColor);
const QSharedPointer<VPointF> second = GetData()->GeometricObject<VPointF>(m_lineP1Id);
DrawPoint(m_lineP1, static_cast<QPointF>(*second), Color(VColor::SupportColor));
QLineF base_line;
if (lineP2Id <= NULL_ID)
if (m_lineP2Id <= NULL_ID)
{
base_line = QLineF(static_cast<QPointF>(*second), Visualization::scenePos);
DrawLine(line, base_line, supportColor);
base_line = QLineF(static_cast<QPointF>(*second), ScenePos());
DrawLine(m_line, base_line, Color(VColor::SupportColor));
}
else
{
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(lineP2Id);
DrawPoint(lineP2, static_cast<QPointF>(*third), supportColor);
const QSharedPointer<VPointF> third = GetData()->GeometricObject<VPointF>(m_lineP2Id);
DrawPoint(m_lineP2, static_cast<QPointF>(*third), Color(VColor::SupportColor));
base_line = QLineF(static_cast<QPointF>(*second), static_cast<QPointF>(*third));
}
DrawLine(line, base_line, supportColor);
DrawLine(m_line, base_line, Color(VColor::SupportColor));
QPointF height = VToolHeight::FindPoint(base_line, static_cast<QPointF>(*first));
DrawPoint(point, height, mainColor);
DrawPoint(m_point, height, Color(VColor::MainColor));
QLineF height_line(static_cast<QPointF>(*first), height);
DrawLine(this, height_line, mainColor, lineStyle);
DrawLine(this, height_line, Color(VColor::MainColor), LineStyle());
ShowIntersection(height_line, base_line);
}
@ -101,15 +100,10 @@ void VisToolHeight::RefreshGeometry()
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolHeight::setLineP1Id(const quint32 &value)
void VisToolHeight::VisualMode(quint32 id)
{
lineP1Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolHeight::setLineP2Id(const quint32 &value)
{
lineP2Id = value;
m_basePointId = id;
StartVisualMode();
}
//---------------------------------------------------------------------------------------------------------------------
@ -120,11 +114,12 @@ void VisToolHeight::ShowIntersection(const QLineF &height_line, const QLineF &ba
if (intersect == QLineF::UnboundedIntersection)
{
line_intersection->setVisible(true);
DrawLine(line_intersection, QLineF(base_line.p1(), height_line.p2()), supportColor, Qt::DashLine);
m_lineIntersection->setVisible(true);
DrawLine(m_lineIntersection, QLineF(base_line.p1(), height_line.p2()), Color(VColor::SupportColor),
Qt::DashLine);
}
else if (intersect == QLineF::BoundedIntersection)
{
line_intersection->setVisible(false);
m_lineIntersection->setVisible(false);
}
}

View File

@ -45,27 +45,49 @@ class VisToolHeight final : public VisLine
Q_OBJECT // NOLINT
public:
explicit VisToolHeight(const VContainer *data, QGraphicsItem *parent = nullptr);
virtual ~VisToolHeight() = default;
~VisToolHeight() override = default;
virtual void RefreshGeometry() override;
void RefreshGeometry() override;
void VisualMode(quint32 id) override;
void setLineP1Id(const quint32 &value);
void setLineP2Id(const quint32 &value);
virtual int type() const override {return Type;}
void SetBasePointId(quint32 value);
void SetLineP1Id(quint32 value);
void SetLineP2Id(quint32 value);
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolHeight)};
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VisToolHeight) // NOLINT
//base point in parent class
quint32 lineP1Id{NULL_ID};//first point of line
quint32 lineP2Id{NULL_ID};//second point of line
VScaledEllipse *point{nullptr};
VScaledEllipse *base_point{nullptr};
VScaledEllipse *lineP1{nullptr};
VScaledEllipse *lineP2{nullptr};
VScaledLine *line{nullptr};
VScaledLine *line_intersection{nullptr};
quint32 m_basePointId{NULL_ID};
quint32 m_lineP1Id{NULL_ID};//first point of line
quint32 m_lineP2Id{NULL_ID};//second point of line
VScaledEllipse *m_point{nullptr};
VScaledEllipse *m_basePoint{nullptr};
VScaledEllipse *m_lineP1{nullptr};
VScaledEllipse *m_lineP2{nullptr};
VScaledLine *m_line{nullptr};
VScaledLine *m_lineIntersection{nullptr};
void ShowIntersection(const QLineF &height_line, const QLineF &base_line);
};
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolHeight::SetBasePointId(quint32 value)
{
m_basePointId = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolHeight::SetLineP1Id(quint32 value)
{
m_lineP1Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolHeight::SetLineP2Id(quint32 value)
{
m_lineP2Id = value;
}
#endif // VISTOOLHEIGHT_H

View File

@ -34,41 +34,40 @@
#include <QSharedPointer>
#include <new>
#include "../ifc/ifcdef.h"
#include "../vgeometry/vpointf.h"
#include "../vmisc/vabstractapplication.h"
#include "../vpatterndb/vcontainer.h"
#include "../visualization.h"
#include "visualization/line/visline.h"
//---------------------------------------------------------------------------------------------------------------------
VisToolLine::VisToolLine(const VContainer *data, QGraphicsItem *parent)
:VisLine(data, parent), point2Id(NULL_ID)
:VisLine(data, parent)
{
this->mainColor = Qt::red;
SetMainColor(Qt::red);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolLine::RefreshGeometry()
{
QLineF line;
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
if (point2Id == NULL_ID)
const QSharedPointer<VPointF> first = GetData()->GeometricObject<VPointF>(m_point1Id);
if (m_point2Id == NULL_ID)
{
line = QLineF(static_cast<QPointF>(*first), Visualization::scenePos);
line = QLineF(static_cast<QPointF>(*first), ScenePos());
}
else
{
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
const QSharedPointer<VPointF> second = GetData()->GeometricObject<VPointF>(m_point2Id);
line = QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second));
}
DrawLine(this, line, mainColor, lineStyle);
DrawLine(this, line, Color(VColor::MainColor), LineStyle());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolLine::setPoint2Id(const quint32 &value)
void VisToolLine::VisualMode(quint32 id)
{
point2Id = value;
m_point1Id = id;
StartVisualMode();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -47,19 +47,36 @@ class VisToolLine : public VisLine
Q_OBJECT // NOLINT
public:
explicit VisToolLine(const VContainer *data, QGraphicsItem *parent = nullptr);
virtual ~VisToolLine() = default;
~VisToolLine() override = default;
virtual void RefreshGeometry() override;
void setPoint2Id(const quint32 &value);
virtual int type() const override {return Type;}
void RefreshGeometry() override;
void VisualMode(quint32 id) override;
void SetPoint1Id(quint32 value);
void SetPoint2Id(quint32 value);
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolLine)};
protected:
virtual void DrawLine(VScaledLine *lineItem, const QLineF &line, const QColor &color,
void DrawLine(VScaledLine *lineItem, const QLineF &line, const QColor &color,
Qt::PenStyle style = Qt::SolidLine) override;
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VisToolLine) // NOLINT
quint32 point2Id;
quint32 m_point1Id{NULL_ID};
quint32 m_point2Id{NULL_ID};
};
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolLine::SetPoint1Id(quint32 value)
{
m_point1Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolLine::SetPoint2Id(quint32 value)
{
m_point2Id = value;
}
#endif // VGRAPHICSLINEITEM_H

View File

@ -35,7 +35,6 @@
#include <QSharedPointer>
#include <new>
#include "../ifc/ifcdef.h"
#include "../vgeometry/vpointf.h"
#include "../vpatterndb/vcontainer.h"
#include "../visualization.h"
@ -44,63 +43,65 @@
//---------------------------------------------------------------------------------------------------------------------
VisToolLineIntersect::VisToolLineIntersect(const VContainer *data, QGraphicsItem *parent)
:VisLine(data, parent), line1P2Id(NULL_ID), line2P1Id(NULL_ID), line2P2Id(NULL_ID), point(nullptr),
line1P1(nullptr), line1P2(nullptr), line1(nullptr), line2P1(nullptr), line2P2(nullptr)
:VisLine(data, parent)
{
line1P1 = InitPoint(supportColor, this);
line1P2 = InitPoint(supportColor, this);
line1 = InitItem<VScaledLine>(supportColor, this);
m_line1P1 = InitPoint(Color(VColor::SupportColor), this);
m_line1P2 = InitPoint(Color(VColor::SupportColor), this);
m_line1 = InitItem<VScaledLine>(Color(VColor::SupportColor), this);
line2P1 = InitPoint(supportColor, this);
line2P2 = InitPoint(supportColor, this);
m_line2P1 = InitPoint(Color(VColor::SupportColor), this);
m_line2P2 = InitPoint(Color(VColor::SupportColor), this);
point = InitPoint(mainColor, this);
m_point = InitPoint(Color(VColor::MainColor), this);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolLineIntersect::RefreshGeometry()
{
if (object1Id > NULL_ID)
if (m_line1P1Id > NULL_ID)
{
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(line1P1, static_cast<QPointF>(*first), supportColor);
const QSharedPointer<VPointF> first = GetData()->GeometricObject<VPointF>(m_line1P1Id);
DrawPoint(m_line1P1, static_cast<QPointF>(*first), Color(VColor::SupportColor));
if (line1P2Id <= NULL_ID)
if (m_line1P2Id <= NULL_ID)
{
DrawLine(line1, QLineF(static_cast<QPointF>(*first), Visualization::scenePos), supportColor);
DrawLine(m_line1, QLineF(static_cast<QPointF>(*first), ScenePos()), Color(VColor::SupportColor));
}
else
{
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(line1P2Id);
DrawPoint(line1P2, static_cast<QPointF>(*second), supportColor);
const QSharedPointer<VPointF> second = GetData()->GeometricObject<VPointF>(m_line1P2Id);
DrawPoint(m_line1P2, static_cast<QPointF>(*second), Color(VColor::SupportColor));
DrawLine(line1, QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)), supportColor);
DrawLine(m_line1, QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)),
Color(VColor::SupportColor));
if (line2P1Id > NULL_ID)
if (m_line2P1Id > NULL_ID)
{
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(line2P1Id);
DrawPoint(line2P1, static_cast<QPointF>(*third), supportColor);
const QSharedPointer<VPointF> third = GetData()->GeometricObject<VPointF>(m_line2P1Id);
DrawPoint(m_line2P1, static_cast<QPointF>(*third), Color(VColor::SupportColor));
if (line2P2Id <= NULL_ID)
if (m_line2P2Id <= NULL_ID)
{
DrawLine(this, QLineF(static_cast<QPointF>(*third), Visualization::scenePos), supportColor);
DrawLine(this, QLineF(static_cast<QPointF>(*third), ScenePos()),
Color(VColor::SupportColor));
QLineF l1(static_cast<QPointF>(*first), static_cast<QPointF>(*second));
QLineF l2(static_cast<QPointF>(*third), Visualization::scenePos);
QLineF l2(static_cast<QPointF>(*third), ScenePos());
QPointF fPoint;
QLineF::IntersectType intersect = Intersects(l1, l2, &fPoint);
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{
DrawPoint(point, fPoint, mainColor);
DrawPoint(m_point, fPoint, Color(VColor::MainColor));
}
}
else
{
const QSharedPointer<VPointF> forth = Visualization::data->GeometricObject<VPointF>(line2P2Id);
DrawPoint(line2P2, static_cast<QPointF>(*forth), supportColor);
const QSharedPointer<VPointF> forth = GetData()->GeometricObject<VPointF>(m_line2P2Id);
DrawPoint(m_line2P2, static_cast<QPointF>(*forth), Color(VColor::SupportColor));
DrawLine(this, QLineF(static_cast<QPointF>(*third), static_cast<QPointF>(*forth)), supportColor);
DrawLine(this, QLineF(static_cast<QPointF>(*third), static_cast<QPointF>(*forth)),
Color(VColor::SupportColor));
QLineF l1(static_cast<QPointF>(*first), static_cast<QPointF>(*second));
QLineF l2(static_cast<QPointF>(*third), static_cast<QPointF>(*forth));
@ -109,7 +110,7 @@ void VisToolLineIntersect::RefreshGeometry()
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{
DrawPoint(point, fPoint, mainColor);
DrawPoint(m_point, fPoint, Color(VColor::MainColor));
}
}
}
@ -118,19 +119,8 @@ void VisToolLineIntersect::RefreshGeometry()
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolLineIntersect::setLine1P2Id(const quint32 &value)
void VisToolLineIntersect::VisualMode(quint32 id)
{
line1P2Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolLineIntersect::setLine2P1Id(const quint32 &value)
{
line2P1Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolLineIntersect::setLine2P2Id(const quint32 &value)
{
line2P2Id = value;
m_line1P1Id = id;
StartVisualMode();
}

View File

@ -44,27 +44,55 @@ class VisToolLineIntersect :public VisLine
Q_OBJECT // NOLINT
public:
explicit VisToolLineIntersect(const VContainer *data, QGraphicsItem *parent = nullptr);
virtual ~VisToolLineIntersect() = default;
~VisToolLineIntersect() override = default;
virtual void RefreshGeometry() override;
void RefreshGeometry() override;
void VisualMode(quint32 id) override;
void setLine1P2Id(const quint32 &value);
void setLine2P1Id(const quint32 &value);
void setLine2P2Id(const quint32 &value);
virtual int type() const override {return Type;}
void SetLine1P1Id(quint32 value);
void SetLine1P2Id(quint32 value);
void SetLine2P1Id(quint32 value);
void SetLine2P2Id(quint32 value);
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolLineIntersect)};
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VisToolLineIntersect) // NOLINT
quint32 line1P2Id;
quint32 line2P1Id;
quint32 line2P2Id;
VScaledEllipse *point;
VScaledEllipse *line1P1;
VScaledEllipse *line1P2;
VScaledLine *line1;
VScaledEllipse *line2P1;
VScaledEllipse *line2P2;
quint32 m_line1P1Id{NULL_ID};
quint32 m_line1P2Id{NULL_ID};
quint32 m_line2P1Id{NULL_ID};
quint32 m_line2P2Id{NULL_ID};
VScaledEllipse *m_point{nullptr};
VScaledEllipse *m_line1P1{nullptr};
VScaledEllipse *m_line1P2{nullptr};
VScaledLine *m_line1{nullptr};
VScaledEllipse *m_line2P1{nullptr};
VScaledEllipse *m_line2P2{nullptr};
};
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolLineIntersect::SetLine1P1Id(quint32 value)
{
m_line1P1Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolLineIntersect::SetLine1P2Id(quint32 value)
{
m_line1P2Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolLineIntersect::SetLine2P1Id(quint32 value)
{
m_line2P1Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolLineIntersect::SetLine2P2Id(quint32 value)
{
m_line2P2Id = value;
}
#endif // VISTOOLLINEINTERSECT_H

View File

@ -37,7 +37,6 @@
#include <new>
#include "../../tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h"
#include "../ifc/ifcdef.h"
#include "../vgeometry/vpointf.h"
#include "../vpatterndb/vcontainer.h"
#include "../visualization.h"
@ -47,97 +46,91 @@
//---------------------------------------------------------------------------------------------------------------------
VisToolLineIntersectAxis::VisToolLineIntersectAxis(const VContainer *data, QGraphicsItem *parent)
: VisLine(data, parent), point2Id(NULL_ID), axisPointId(NULL_ID), angle(-1), point(nullptr), lineP1(nullptr),
lineP2(nullptr), basePoint(nullptr), baseLine(nullptr), axisLine(nullptr), line_intersection(nullptr)
: VisLine(data, parent)
{
this->mainColor = Qt::red;
SetMainColor(Qt::red);
lineP1 = InitPoint(supportColor, this);
lineP2 = InitPoint(supportColor, this);
basePoint = InitPoint(supportColor, this);
baseLine = InitItem<VScaledLine>(supportColor, this);
axisLine = InitItem<VScaledLine>(supportColor, this);
line_intersection = InitItem<VScaledLine>(supportColor, this);
point = InitPoint(mainColor, this);
m_lineP1 = InitPoint(Color(VColor::SupportColor), this);
m_lineP2 = InitPoint(Color(VColor::SupportColor), this);
m_basePoint = InitPoint(Color(VColor::SupportColor), this);
m_baseLine = InitItem<VScaledLine>(Color(VColor::SupportColor), this);
m_axisLine = InitItem<VScaledLine>(Color(VColor::SupportColor), this);
m_lineIntersection = InitItem<VScaledLine>(Color(VColor::SupportColor), this);
m_point = InitPoint(Color(VColor::MainColor), this);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolLineIntersectAxis::RefreshGeometry()
{
if (object1Id > NULL_ID)
if (m_point1Id > NULL_ID)
{
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(lineP1, static_cast<QPointF>(*first), supportColor);
const QSharedPointer<VPointF> first = GetData()->GeometricObject<VPointF>(m_point1Id);
DrawPoint(m_lineP1, static_cast<QPointF>(*first), Color(VColor::SupportColor));
if (point2Id <= NULL_ID)
if (m_point2Id <= NULL_ID)
{
DrawLine(baseLine, QLineF(static_cast<QPointF>(*first), Visualization::scenePos), supportColor);
DrawLine(m_baseLine, QLineF(static_cast<QPointF>(*first), ScenePos()), Color(VColor::SupportColor));
}
else
{
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
DrawPoint(lineP2, static_cast<QPointF>(*second), supportColor);
const QSharedPointer<VPointF> second = GetData()->GeometricObject<VPointF>(m_point2Id);
DrawPoint(m_lineP2, static_cast<QPointF>(*second), Color(VColor::SupportColor));
const QLineF base_line(static_cast<QPointF>(*first), static_cast<QPointF>(*second));
DrawLine(baseLine, base_line, supportColor);
DrawLine(m_baseLine, base_line, Color(VColor::SupportColor));
if (axisPointId > NULL_ID)
if (m_axisPointId > NULL_ID)
{
QLineF axis;
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(axisPointId);
if (VFuzzyComparePossibleNulls(angle, -1))
const QSharedPointer<VPointF> third = GetData()->GeometricObject<VPointF>(m_axisPointId);
if (VFuzzyComparePossibleNulls(m_angle, -1))
{
axis = Axis(static_cast<QPointF>(*third), Visualization::scenePos);
axis = Axis(static_cast<QPointF>(*third), ScenePos());
}
else
{
axis = Axis(static_cast<QPointF>(*third), angle);
axis = Axis(static_cast<QPointF>(*third), m_angle);
}
DrawPoint(basePoint, static_cast<QPointF>(*third), mainColor);
DrawLine(axisLine, axis, supportColor, Qt::DashLine);
DrawPoint(m_basePoint, static_cast<QPointF>(*third), Color(VColor::MainColor));
DrawLine(m_axisLine, axis, Color(VColor::SupportColor), Qt::DashLine);
QPointF p;
VToolLineIntersectAxis::FindPoint(axis, base_line, &p);
QLineF axis_line(static_cast<QPointF>(*third), p);
if (not axis_line.isNull())
{
DrawLine(this, axis_line, mainColor, lineStyle);
DrawLine(this, axis_line, Color(VColor::MainColor), LineStyle());
}
DrawPoint(point, p, mainColor);
DrawPoint(m_point, p, Color(VColor::MainColor));
ShowIntersection(axis_line, base_line);
Visualization::toolTip = tr("<b>Intersection line and axis</b>: angle = %1°; <b>%2</b> - "
SetToolTip(tr("<b>Intersection line and axis</b>: angle = %1°; <b>%2</b> - "
"sticking angle, <b>%3</b> - finish creation")
.arg(this->line().angle())
.arg(VModifierKey::Shift(), VModifierKey::EnterKey());
.arg(VModifierKey::Shift(), VModifierKey::EnterKey()));
}
}
}
}
//---------------------------------------------------------------------------------------------------------------------
QString VisToolLineIntersectAxis::Angle() const
void VisToolLineIntersectAxis::VisualMode(quint32 id)
{
return QString("%1").arg(this->line().angle());
m_point1Id = id;
StartVisualMode();
}
//---------------------------------------------------------------------------------------------------------------------
auto VisToolLineIntersectAxis::Angle() const -> QString
{
return QString::number(this->line().angle());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolLineIntersectAxis::SetAngle(const QString &expression)
{
angle = FindValFromUser(expression, Visualization::data->DataVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolLineIntersectAxis::setPoint2Id(const quint32 &value)
{
point2Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolLineIntersectAxis::setAxisPointId(const quint32 &value)
{
axisPointId = value;
m_angle = FindValFromUser(expression, GetData()->DataVariables());
}
//---------------------------------------------------------------------------------------------------------------------
@ -148,11 +141,11 @@ void VisToolLineIntersectAxis::ShowIntersection(const QLineF &axis_line, const Q
if (intersect == QLineF::UnboundedIntersection)
{
line_intersection->setVisible(true);
DrawLine(line_intersection, QLineF(base_line.p1(), axis_line.p2()), supportColor, Qt::DashLine);
m_lineIntersection->setVisible(true);
DrawLine(m_lineIntersection, QLineF(base_line.p1(), axis_line.p2()), Color(VColor::SupportColor), Qt::DashLine);
}
else if (intersect == QLineF::BoundedIntersection || intersect == QLineF::NoIntersection)
{
line_intersection->setVisible(false);
m_lineIntersection->setVisible(false);
}
}

View File

@ -45,31 +45,53 @@ class VisToolLineIntersectAxis : public VisLine
Q_OBJECT // NOLINT
public:
explicit VisToolLineIntersectAxis(const VContainer *data, QGraphicsItem *parent = nullptr);
virtual ~VisToolLineIntersectAxis() = default;
~VisToolLineIntersectAxis() override = default;
virtual void RefreshGeometry() override;
void RefreshGeometry() override;
void VisualMode(quint32 id) override;
QString Angle() const;
auto Angle() const -> QString;
void SetAngle(const QString &expression);
void setPoint2Id(const quint32 &value);
void setAxisPointId(const quint32 &value);
void SetPoint1Id(quint32 value);
void SetPoint2Id(quint32 value);
void SetAxisPointId(quint32 value);
virtual int type() const override {return Type;}
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolLineIntersectAxis)};
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VisToolLineIntersectAxis) // NOLINT
quint32 point2Id;
quint32 axisPointId;
qreal angle;
VScaledEllipse *point;
VScaledEllipse *lineP1;
VScaledEllipse *lineP2;
VScaledEllipse *basePoint;
VScaledLine *baseLine;
VScaledLine *axisLine;
VScaledLine *line_intersection;
quint32 m_point1Id{NULL_ID};
quint32 m_point2Id{NULL_ID};
quint32 m_axisPointId{NULL_ID};
qreal m_angle{-1};
VScaledEllipse *m_point{nullptr};
VScaledEllipse *m_lineP1{nullptr};
VScaledEllipse *m_lineP2{nullptr};
VScaledEllipse *m_basePoint{nullptr};
VScaledLine *m_baseLine{nullptr};
VScaledLine *m_axisLine{nullptr};
VScaledLine *m_lineIntersection{nullptr};
void ShowIntersection(const QLineF &axis_line, const QLineF &base_line);
};
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolLineIntersectAxis::SetPoint1Id(quint32 value)
{
m_point1Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolLineIntersectAxis::SetPoint2Id(quint32 value)
{
m_point2Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolLineIntersectAxis::SetAxisPointId(quint32 value)
{
m_axisPointId = value;
}
#endif // VISTOOLLINEINTERSECTAXIS_H

View File

@ -47,52 +47,52 @@
VisToolNormal::VisToolNormal(const VContainer *data, QGraphicsItem *parent)
: VisLine(data, parent)
{
this->mainColor = Qt::red;
SetMainColor(Qt::red);
m_lineP1 = InitPoint(supportColor, this);
m_lineP2 = InitPoint(supportColor, this); //-V656
m_line = InitItem<VScaledLine>(supportColor, this);
m_lineP1 = InitPoint(Color(VColor::SupportColor), this);
m_lineP2 = InitPoint(Color(VColor::SupportColor), this); //-V656
m_line = InitItem<VScaledLine>(Color(VColor::SupportColor), this);
m_point = InitPoint(mainColor, this);
m_point = InitPoint(Color(VColor::MainColor), this);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolNormal::RefreshGeometry()
{
if (object1Id > NULL_ID)
if (m_object1Id > NULL_ID)
{
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(m_lineP1, static_cast<QPointF>(*first), supportColor);
const QSharedPointer<VPointF> first = GetData()->GeometricObject<VPointF>(m_object1Id);
DrawPoint(m_lineP1, static_cast<QPointF>(*first), Color(VColor::SupportColor));
if (m_object2Id <= NULL_ID)
{
QLineF line_mouse(static_cast<QPointF>(*first), Visualization::scenePos);
DrawLine(m_line, line_mouse, supportColor);
QLineF line_mouse(static_cast<QPointF>(*first), ScenePos());
DrawLine(m_line, line_mouse, Color(VColor::SupportColor));
QLineF normal = line_mouse.normalVector();
QPointF endRay = Ray(normal.p1(), normal.angle());
DrawLine(this, QLineF(normal.p1(), endRay), mainColor);
DrawLine(this, QLineF(normal.p1(), endRay), Color(VColor::MainColor));
}
else
{
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(m_object2Id);
DrawPoint(m_lineP2, static_cast<QPointF>(*second), supportColor);
const QSharedPointer<VPointF> second = GetData()->GeometricObject<VPointF>(m_object2Id);
DrawPoint(m_lineP2, static_cast<QPointF>(*second), Color(VColor::SupportColor));
QLineF line_mouse(static_cast<QPointF>(*first), static_cast<QPointF>(*second));
DrawLine(m_line, line_mouse, supportColor);
DrawLine(m_line, line_mouse, Color(VColor::SupportColor));
if (not qFuzzyIsNull(m_length))
{
QPointF fPoint = VToolNormal::FindPoint(static_cast<QPointF>(*first), static_cast<QPointF>(*second),
m_length, m_angle);
QLineF mainLine = QLineF(static_cast<QPointF>(*first), fPoint);
DrawLine(this, mainLine, mainColor, lineStyle);
DrawLine(this, mainLine, Color(VColor::MainColor), LineStyle());
DrawPoint(m_point, mainLine.p2(), mainColor);
DrawPoint(m_point, mainLine.p2(), Color(VColor::MainColor));
}
else if (mode == Mode::Creation)
else if (GetMode() == Mode::Creation)
{
QLineF cursorLine (static_cast<QPointF>(*first), Visualization::scenePos);
QLineF cursorLine (static_cast<QPointF>(*first), ScenePos());
QLineF normal = line_mouse.normalVector();
qreal len = cursorLine.length();
@ -105,36 +105,37 @@ void VisToolNormal::RefreshGeometry()
QPointF fPoint = VToolNormal::FindPoint(static_cast<QPointF>(*first), static_cast<QPointF>(*second),
len, m_angle);
QLineF mainLine = QLineF(static_cast<QPointF>(*first), fPoint);
DrawLine(this, mainLine, mainColor, lineStyle);
DrawLine(this, mainLine, Color(VColor::MainColor), LineStyle());
DrawPoint(m_point, mainLine.p2(), mainColor);
DrawPoint(m_point, mainLine.p2(), Color(VColor::MainColor));
const QString prefix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
Visualization::toolTip = tr("Length = %1%2; "
SetToolTip(tr("Length = %1%2; "
"<b>Mouse click</b> - finish selecting the length, "
"<b>%3</b> - skip")
.arg(NumberToUser(len), prefix, VModifierKey::EnterKey());
.arg(NumberToUser(len), prefix, VModifierKey::EnterKey()));
}
else
{
QLineF normal = line_mouse.normalVector();
QPointF endRay = Ray(normal.p1(), normal.angle());
DrawLine(this, QLineF(normal.p1(), endRay), mainColor);
DrawLine(this, QLineF(normal.p1(), endRay), Color(VColor::MainColor));
}
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolNormal::setObject2Id(const quint32 &value)
void VisToolNormal::VisualMode(quint32 id)
{
m_object2Id = value;
m_object1Id = id;
StartVisualMode();
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolNormal::setLength(const QString &expression)
void VisToolNormal::SetLength(const QString &expression)
{
m_length = FindLengthFromUser(expression, Visualization::data->DataVariables());
m_length = FindLengthFromUser(expression, GetData()->DataVariables());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -47,17 +47,21 @@ public:
~VisToolNormal() override = default;
void RefreshGeometry() override;
void VisualMode(quint32 id) override;
void setObject2Id(const quint32 &value);
void setLength(const QString &expression);
void SetPoint1Id(quint32 value);
void SetPoint2Id(quint32 value);
void SetLength(const QString &expression);
auto GetAngle() const -> qreal;
void SetAngle(const qreal &value);
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolNormal)};
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VisToolNormal) // NOLINT
quint32 m_object1Id{NULL_ID};
quint32 m_object2Id{NULL_ID};
VScaledEllipse *m_point{nullptr};
VScaledEllipse *m_lineP1{nullptr};
@ -65,7 +69,18 @@ private:
VScaledLine *m_line{nullptr};
qreal m_length{0};
qreal m_angle{0};
};
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolNormal::SetPoint1Id(quint32 value)
{
m_object1Id = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolNormal::SetPoint2Id(quint32 value)
{
m_object2Id = value;
}
#endif // VISTOOLNORMAL_H

View File

@ -37,7 +37,6 @@
#include <new>
#include "../../tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h"
#include "../ifc/ifcdef.h"
#include "../vgeometry/vabstractcurve.h"
#include "../vgeometry/varc.h"
#include "../vgeometry/vgobject.h"
@ -48,46 +47,40 @@
//---------------------------------------------------------------------------------------------------------------------
VisToolPointFromArcAndTangent::VisToolPointFromArcAndTangent(const VContainer *data, QGraphicsItem *parent)
: VisLine(data, parent), arcId(NULL_ID), crossPoint(CrossCirclesPoint::FirstPoint),
point(nullptr), tangent(nullptr), arcPath(nullptr)
: VisLine(data, parent)
{
arcPath = InitItem<VCurvePathItem>(Qt::darkGreen, this);
point = InitPoint(mainColor, this);
tangent = InitPoint(supportColor, this);
m_arcPath = InitItem<VCurvePathItem>(Qt::darkGreen, this);
m_point = InitPoint(Color(VColor::MainColor), this);
m_tangent = InitPoint(Color(VColor::SupportColor), this);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolPointFromArcAndTangent::RefreshGeometry()
{
if (object1Id > NULL_ID)// tangent point
if (m_pointId > NULL_ID)// tangent point
{
const QSharedPointer<VPointF> tan = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(tangent, static_cast<QPointF>(*tan), supportColor);
const QSharedPointer<VPointF> tan = GetData()->GeometricObject<VPointF>(m_pointId);
DrawPoint(m_tangent, static_cast<QPointF>(*tan), Color(VColor::SupportColor));
if (arcId > NULL_ID)// circle center
if (m_arcId > NULL_ID)// circle center
{
const QSharedPointer<VArc> arc = Visualization::data->GeometricObject<VArc>(arcId);
DrawPath(arcPath, arc->GetPath(), arc->DirectionArrows(), Qt::darkGreen, Qt::SolidLine, Qt::RoundCap);
const QSharedPointer<VArc> arc = GetData()->GeometricObject<VArc>(m_arcId);
DrawPath(m_arcPath, arc->GetPath(), arc->DirectionArrows(), Qt::darkGreen, Qt::SolidLine, Qt::RoundCap);
FindRays(static_cast<QPointF>(*tan), arc.data());
QPointF fPoint;
VToolPointFromArcAndTangent::FindPoint(static_cast<QPointF>(*tan), arc.data(), crossPoint, &fPoint);
DrawPoint(point, fPoint, mainColor);
VToolPointFromArcAndTangent::FindPoint(static_cast<QPointF>(*tan), arc.data(), m_crossPoint, &fPoint);
DrawPoint(m_point, fPoint, Color(VColor::MainColor));
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolPointFromArcAndTangent::setArcId(const quint32 &value)
void VisToolPointFromArcAndTangent::VisualMode(quint32 id)
{
arcId = value;
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolPointFromArcAndTangent::setCrossPoint(const CrossCirclesPoint &value)
{
crossPoint = value;
m_pointId = id;
StartVisualMode();
}
//---------------------------------------------------------------------------------------------------------------------
@ -125,10 +118,11 @@ void VisToolPointFromArcAndTangent::FindRays(const QPointF &p, const VArc *arc)
switch(localRes)
{
case 2:
DrawRay(this, p, crossPoint == CrossCirclesPoint::FirstPoint ? p1 : p2, supportColor, Qt::DashLine);
DrawRay(this, p, m_crossPoint == CrossCirclesPoint::FirstPoint ? p1 : p2,
Color(VColor::SupportColor), Qt::DashLine);
break;
case 1:
DrawRay(this, p, flagP1 ? p1 : p2, supportColor, Qt::DashLine);
DrawRay(this, p, flagP1 ? p1 : p2, Color(VColor::SupportColor), Qt::DashLine);
break;
case 0:
default:
@ -139,7 +133,7 @@ void VisToolPointFromArcAndTangent::FindRays(const QPointF &p, const VArc *arc)
break;
}
case 1:
DrawRay(this, p, p1, supportColor, Qt::DashLine);
DrawRay(this, p, p1, Color(VColor::SupportColor), Qt::DashLine);
break;
case 3:
case 0:

View File

@ -48,25 +48,47 @@ class VisToolPointFromArcAndTangent : public VisLine
Q_OBJECT // NOLINT
public:
explicit VisToolPointFromArcAndTangent(const VContainer *data, QGraphicsItem *parent = nullptr);
virtual ~VisToolPointFromArcAndTangent() = default;
~VisToolPointFromArcAndTangent() override = default;
virtual void RefreshGeometry() override;
void RefreshGeometry() override;
void VisualMode(quint32 id) override;
void setArcId(const quint32 &value);
void setCrossPoint(const CrossCirclesPoint &value);
void SetPointId(quint32 newPointId);
void SetArcId(const quint32 &value);
void SetCrossPoint(const CrossCirclesPoint &value);
virtual int type() const override {return Type;}
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolPointFromArcAndTangent)};
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VisToolPointFromArcAndTangent) // NOLINT
quint32 arcId;
CrossCirclesPoint crossPoint;
VScaledEllipse *point;
VScaledEllipse *tangent;
VCurvePathItem *arcPath;
quint32 m_arcId{NULL_ID};
CrossCirclesPoint m_crossPoint{CrossCirclesPoint::FirstPoint};
VScaledEllipse *m_point{nullptr};
VScaledEllipse *m_tangent{nullptr};
VCurvePathItem *m_arcPath{nullptr};
quint32 m_pointId{NULL_ID};
void FindRays(const QPointF &p, const VArc *arc);
};
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolPointFromArcAndTangent::SetPointId(quint32 newPointId)
{
m_pointId = newPointId;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolPointFromArcAndTangent::SetArcId(const quint32 &value)
{
m_arcId = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolPointFromArcAndTangent::SetCrossPoint(const CrossCirclesPoint &value)
{
m_crossPoint = value;
}
#endif // VISTOOLPOINTFROMARCANDTANGENT_H

View File

@ -44,61 +44,55 @@
//---------------------------------------------------------------------------------------------------------------------
VisToolPointFromCircleAndTangent::VisToolPointFromCircleAndTangent(const VContainer *data, QGraphicsItem *parent)
: VisLine(data, parent), object2Id(NULL_ID), cRadius(0), crossPoint(CrossCirclesPoint::FirstPoint),
point(nullptr), tangent(nullptr), cCenter(nullptr), cPath(nullptr), tangent2(nullptr)
: VisLine(data, parent)
{
cPath = InitItem<QGraphicsEllipseItem>(Qt::darkGreen, this);
point = InitPoint(mainColor, this);
tangent = InitPoint(supportColor, this);
cCenter = InitPoint(supportColor, this); //-V656
tangent2 = InitItem<VScaledLine>(supportColor, this);
m_cPath = InitItem<QGraphicsEllipseItem>(Qt::darkGreen, this);
m_point = InitPoint(Color(VColor::MainColor), this);
m_tangent = InitPoint(Color(VColor::SupportColor), this);
m_cCenter = InitPoint(Color(VColor::SupportColor), this); //-V656
m_tangent2 = InitItem<VScaledLine>(Color(VColor::SupportColor), this);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolPointFromCircleAndTangent::RefreshGeometry()
{
if (object1Id > NULL_ID)// tangent point
if (m_pointId > NULL_ID)// tangent point
{
const QSharedPointer<VPointF> tan = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(tangent, static_cast<QPointF>(*tan), supportColor);
const QSharedPointer<VPointF> tan = GetData()->GeometricObject<VPointF>(m_pointId);
DrawPoint(m_tangent, static_cast<QPointF>(*tan), Color(VColor::SupportColor));
if (object2Id > NULL_ID)// circle center
if (m_centerId > NULL_ID)// circle center
{
const QSharedPointer<VPointF> center = Visualization::data->GeometricObject<VPointF>(object2Id);
DrawPoint(cCenter, static_cast<QPointF>(*center), supportColor);
const QSharedPointer<VPointF> center = GetData()->GeometricObject<VPointF>(m_centerId);
DrawPoint(m_cCenter, static_cast<QPointF>(*center), Color(VColor::SupportColor));
if (cRadius > 0)
if (m_cRadius > 0)
{
cPath->setRect(PointRect(cRadius));
DrawPoint(cPath, static_cast<QPointF>(*center), Qt::darkGreen, Qt::DashLine);
m_cPath->setRect(PointRect(m_cRadius));
DrawPoint(m_cPath, static_cast<QPointF>(*center), Qt::darkGreen, Qt::DashLine);
FindRays(static_cast<QPointF>(*tan), static_cast<QPointF>(*center), cRadius);
FindRays(static_cast<QPointF>(*tan), static_cast<QPointF>(*center), m_cRadius);
QPointF fPoint;
VToolPointFromCircleAndTangent::FindPoint(static_cast<QPointF>(*tan), static_cast<QPointF>(*center),
cRadius, crossPoint, &fPoint);
DrawPoint(point, fPoint, mainColor);
m_cRadius, m_crossPoint, &fPoint);
DrawPoint(m_point, fPoint, Color(VColor::MainColor));
}
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolPointFromCircleAndTangent::setObject2Id(const quint32 &value)
void VisToolPointFromCircleAndTangent::VisualMode(quint32 id)
{
object2Id = value;
m_pointId = id;
StartVisualMode();
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolPointFromCircleAndTangent::setCRadius(const QString &value)
void VisToolPointFromCircleAndTangent::SetCRadius(const QString &value)
{
cRadius = FindLengthFromUser(value, Visualization::data->DataVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolPointFromCircleAndTangent::setCrossPoint(const CrossCirclesPoint &value)
{
crossPoint = value;
m_cRadius = FindLengthFromUser(value, GetData()->DataVariables());
}
//---------------------------------------------------------------------------------------------------------------------
@ -110,16 +104,16 @@ void VisToolPointFromCircleAndTangent::FindRays(const QPointF &p, const QPointF
switch(res)
{
case 2:
DrawRay(this, p, p1, supportColor, Qt::DashLine);
DrawRay(tangent2, p, p2, supportColor, Qt::DashLine);
DrawRay(this, p, p1, Color(VColor::SupportColor), Qt::DashLine);
DrawRay(m_tangent2, p, p2, Color(VColor::SupportColor), Qt::DashLine);
break;
case 1:
DrawRay(this, p, p1, supportColor, Qt::DashLine);
tangent2->setVisible(false);
DrawRay(this, p, p1, Color(VColor::SupportColor), Qt::DashLine);
m_tangent2->setVisible(false);
break;
default:
this->setVisible(false);
tangent2->setVisible(false);
m_tangent2->setVisible(false);
break;
}
}

View File

@ -46,29 +46,50 @@ class VisToolPointFromCircleAndTangent : public VisLine
Q_OBJECT // NOLINT
public:
explicit VisToolPointFromCircleAndTangent(const VContainer *data, QGraphicsItem *parent = nullptr);
virtual ~VisToolPointFromCircleAndTangent() = default;
~VisToolPointFromCircleAndTangent() override = default;
virtual void RefreshGeometry() override;
void RefreshGeometry() override;
void VisualMode(quint32 id) override;
void setObject2Id(const quint32 &value);
void setCRadius(const QString &value);
void setCrossPoint(const CrossCirclesPoint &value);
void SetPointId(quint32 value);
void SetCenterId(quint32 value);
void SetCRadius(const QString &value);
void SetCrossPoint(CrossCirclesPoint value);
virtual int type() const override {return Type;}
auto type() const -> int override {return Type;}
enum {Type = UserType + static_cast<int>(Vis::ToolPointFromCircleAndTangent)};
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VisToolPointFromCircleAndTangent) // NOLINT
quint32 object2Id;
qreal cRadius;
CrossCirclesPoint crossPoint;
VScaledEllipse *point;
VScaledEllipse *tangent;
VScaledEllipse *cCenter;
QGraphicsEllipseItem *cPath;
VScaledLine *tangent2;
quint32 m_centerId{NULL_ID};
qreal m_cRadius{0};
CrossCirclesPoint m_crossPoint{CrossCirclesPoint::FirstPoint};
VScaledEllipse *m_point{nullptr};
VScaledEllipse *m_tangent{nullptr};
VScaledEllipse *m_cCenter{nullptr};
QGraphicsEllipseItem *m_cPath{nullptr};
VScaledLine *m_tangent2{nullptr};
quint32 m_pointId{NULL_ID};
void FindRays(const QPointF &p, const QPointF &center, qreal radius);
};
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolPointFromCircleAndTangent::SetPointId(quint32 value)
{
m_pointId = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolPointFromCircleAndTangent::SetCenterId(quint32 value)
{
m_centerId = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VisToolPointFromCircleAndTangent::SetCrossPoint(CrossCirclesPoint value)
{
m_crossPoint = value;
}
#endif // VISTOOLPOINTFROMCIRCLEANDTANGENT_H

View File

@ -44,49 +44,49 @@
//---------------------------------------------------------------------------------------------------------------------
VisToolPointOfContact::VisToolPointOfContact(const VContainer *data, QGraphicsItem *parent)
:VisLine(data, parent), lineP2Id(NULL_ID), radiusId(NULL_ID), point(nullptr), lineP1(nullptr), lineP2(nullptr),
arc_point(nullptr), circle(nullptr), radius(0)
:VisLine(data, parent)
{
arc_point = InitPoint(supportColor, this);
lineP1 = InitPoint(supportColor, this);
lineP2 = InitPoint(supportColor, this);
circle = InitItem<QGraphicsEllipseItem>(supportColor, this);
m_arcPoint = InitPoint(Color(VColor::SupportColor), this);
m_lineP1 = InitPoint(Color(VColor::SupportColor), this);
m_lineP2 = InitPoint(Color(VColor::SupportColor), this);
m_circle = InitItem<QGraphicsEllipseItem>(Color(VColor::SupportColor), this);
point = InitPoint(mainColor, this);
m_point = InitPoint(Color(VColor::MainColor), this);
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolPointOfContact::RefreshGeometry()
{
if (object1Id > NULL_ID)
if (m_lineP1Id > NULL_ID)
{
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(lineP1, static_cast<QPointF>(*first), supportColor);
const QSharedPointer<VPointF> first = GetData()->GeometricObject<VPointF>(m_lineP1Id);
DrawPoint(m_lineP1, static_cast<QPointF>(*first), Color(VColor::SupportColor));
if (lineP2Id <= NULL_ID)
if (m_lineP2Id <= NULL_ID)
{
DrawLine(this, QLineF(static_cast<QPointF>(*first), Visualization::scenePos), supportColor);
DrawLine(this, QLineF(static_cast<QPointF>(*first), ScenePos()), Color(VColor::SupportColor));
}
else
{
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(lineP2Id);
DrawPoint(lineP2, static_cast<QPointF>(*second), supportColor);
DrawLine(this, QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)), supportColor);
const QSharedPointer<VPointF> second = GetData()->GeometricObject<VPointF>(m_lineP2Id);
DrawPoint(m_lineP2, static_cast<QPointF>(*second), Color(VColor::SupportColor));
DrawLine(this, QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)),
Color(VColor::SupportColor));
if (radiusId > NULL_ID)
if (m_radiusId > NULL_ID)
{
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(radiusId);
DrawPoint(arc_point, static_cast<QPointF>(*third), supportColor);
const QSharedPointer<VPointF> third = GetData()->GeometricObject<VPointF>(m_radiusId);
DrawPoint(m_arcPoint, static_cast<QPointF>(*third), Color(VColor::SupportColor));
if (not qFuzzyIsNull(radius))
if (not qFuzzyIsNull(m_radius))
{
QPointF fPoint;
VToolPointOfContact::FindPoint(radius, static_cast<QPointF>(*third), static_cast<QPointF>(*first),
VToolPointOfContact::FindPoint(m_radius, static_cast<QPointF>(*third), static_cast<QPointF>(*first),
static_cast<QPointF>(*second), &fPoint);
DrawPoint(point, fPoint, mainColor);
DrawPoint(m_point, fPoint, Color(VColor::MainColor));
circle->setRect(PointRect(radius));
DrawPoint(circle, static_cast<QPointF>(*third), supportColor, Qt::DashLine);
m_circle->setRect(PointRect(m_radius));
DrawPoint(m_circle, static_cast<QPointF>(*third), Color(VColor::SupportColor), Qt::DashLine);
}
}
}
@ -94,19 +94,14 @@ void VisToolPointOfContact::RefreshGeometry()
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolPointOfContact::setLineP2Id(const quint32 &value)
void VisToolPointOfContact::VisualMode(quint32 id)
{
lineP2Id = value;
m_lineP1Id = id;
StartVisualMode();
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolPointOfContact::setRadiusId(const quint32 &value)
void VisToolPointOfContact::SetRadius(const QString &expression)
{
radiusId = value;
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolPointOfContact::setRadius(const QString &expression)
{
radius = FindLengthFromUser(expression, Visualization::data->DataVariables());
m_radius = FindLengthFromUser(expression, GetData()->DataVariables());
}

Some files were not shown because too many files have changed in this diff Show More