Refactoring.
This commit is contained in:
parent
4fb6dfbd92
commit
097b08af6f
|
@ -45,7 +45,6 @@
|
|||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../../visualization/visualization.h"
|
||||
#include "../../visualization/line/vistoolpointofintersectioncircles.h"
|
||||
#include "../ifc/xml/vdomdocument.h"
|
||||
#include "../support/dialogeditwrongformula.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vcommonsettings.h"
|
||||
|
@ -56,17 +55,8 @@ DialogPointOfIntersectionCircles::DialogPointOfIntersectionCircles(const VContai
|
|||
QWidget *parent)
|
||||
: DialogTool(data, toolId, parent),
|
||||
ui(new Ui::DialogPointOfIntersectionCircles),
|
||||
timerCircle1Radius(new QTimer(this)),
|
||||
timerCircle2Radius(new QTimer(this)),
|
||||
circle1Radius(),
|
||||
circle2Radius(),
|
||||
formulaBaseHeightCircle1Radius(0),
|
||||
formulaBaseHeightCircle2Radius(0),
|
||||
pointName(),
|
||||
flagCircle1Radius(false),
|
||||
flagCircle2Radius(false),
|
||||
flagName(true),
|
||||
flagError(true)
|
||||
m_timerCircle1Radius(new QTimer(this)),
|
||||
m_timerCircle2Radius(new QTimer(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -75,17 +65,17 @@ DialogPointOfIntersectionCircles::DialogPointOfIntersectionCircles(const VContai
|
|||
ui->lineEditNamePoint->setText(
|
||||
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
|
||||
this->formulaBaseHeightCircle1Radius = ui->plainTextEditCircle1Radius->height();
|
||||
this->formulaBaseHeightCircle2Radius = ui->plainTextEditCircle2Radius->height();
|
||||
this->m_formulaBaseHeightCircle1Radius = ui->plainTextEditCircle1Radius->height();
|
||||
this->m_formulaBaseHeightCircle2Radius = ui->plainTextEditCircle2Radius->height();
|
||||
|
||||
ui->plainTextEditCircle1Radius->installEventFilter(this);
|
||||
ui->plainTextEditCircle2Radius->installEventFilter(this);
|
||||
|
||||
timerCircle1Radius->setSingleShot(true);
|
||||
connect(timerCircle1Radius, &QTimer::timeout, this, &DialogPointOfIntersectionCircles::EvalCircle1Radius);
|
||||
m_timerCircle1Radius->setSingleShot(true);
|
||||
connect(m_timerCircle1Radius, &QTimer::timeout, this, &DialogPointOfIntersectionCircles::EvalCircle1Radius);
|
||||
|
||||
timerCircle2Radius->setSingleShot(true);
|
||||
connect(timerCircle2Radius, &QTimer::timeout, this, &DialogPointOfIntersectionCircles::EvalCircle2Radius);
|
||||
m_timerCircle2Radius->setSingleShot(true);
|
||||
connect(m_timerCircle2Radius, &QTimer::timeout, this, &DialogPointOfIntersectionCircles::EvalCircle2Radius);
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
|
||||
|
@ -95,7 +85,7 @@ DialogPointOfIntersectionCircles::DialogPointOfIntersectionCircles(const VContai
|
|||
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, [this]()
|
||||
{
|
||||
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, pointName, this->data, flagName);
|
||||
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, m_pointName, this->data, m_flagName);
|
||||
CheckState();
|
||||
});
|
||||
connect(ui->comboBoxCircle1Center, &QComboBox::currentTextChanged,
|
||||
|
@ -110,12 +100,12 @@ DialogPointOfIntersectionCircles::DialogPointOfIntersectionCircles(const VContai
|
|||
|
||||
connect(ui->plainTextEditCircle1Radius, &QPlainTextEdit::textChanged, this, [this]()
|
||||
{
|
||||
timerCircle1Radius->start(formulaTimerTimeout);
|
||||
m_timerCircle1Radius->start(formulaTimerTimeout);
|
||||
});
|
||||
|
||||
connect(ui->plainTextEditCircle2Radius, &QPlainTextEdit::textChanged, this, [this]()
|
||||
{
|
||||
timerCircle2Radius->start(formulaTimerTimeout);
|
||||
m_timerCircle2Radius->start(formulaTimerTimeout);
|
||||
});
|
||||
|
||||
connect(ui->pushButtonGrowCircle1Radius, &QPushButton::clicked, this,
|
||||
|
@ -136,20 +126,20 @@ DialogPointOfIntersectionCircles::~DialogPointOfIntersectionCircles()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogPointOfIntersectionCircles::GetPointName() const
|
||||
auto DialogPointOfIntersectionCircles::GetPointName() const -> QString
|
||||
{
|
||||
return pointName;
|
||||
return m_pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionCircles::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
m_pointName = value;
|
||||
ui->lineEditNamePoint->setText(m_pointName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 DialogPointOfIntersectionCircles::GetFirstCircleCenterId() const
|
||||
auto DialogPointOfIntersectionCircles::GetFirstCircleCenterId() const -> quint32
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxCircle1Center);
|
||||
}
|
||||
|
@ -159,13 +149,13 @@ void DialogPointOfIntersectionCircles::SetFirstCircleCenterId(const quint32 &val
|
|||
{
|
||||
setCurrentPointId(ui->comboBoxCircle1Center, value);
|
||||
|
||||
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
auto *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
SCASSERT(point != nullptr)
|
||||
point->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 DialogPointOfIntersectionCircles::GetSecondCircleCenterId() const
|
||||
auto DialogPointOfIntersectionCircles::GetSecondCircleCenterId() const -> quint32
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxCircle2Center);
|
||||
}
|
||||
|
@ -175,13 +165,13 @@ void DialogPointOfIntersectionCircles::SetSecondCircleCenterId(const quint32 &va
|
|||
{
|
||||
setCurrentPointId(ui->comboBoxCircle2Center, value);
|
||||
|
||||
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
auto *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
SCASSERT(point != nullptr)
|
||||
point->setObject2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogPointOfIntersectionCircles::GetFirstCircleRadius() const
|
||||
auto DialogPointOfIntersectionCircles::GetFirstCircleRadius() const -> QString
|
||||
{
|
||||
return VTranslateVars::TryFormulaFromUser(ui->plainTextEditCircle1Radius->toPlainText(),
|
||||
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
|
@ -199,7 +189,7 @@ void DialogPointOfIntersectionCircles::SetFirstCircleRadius(const QString &value
|
|||
}
|
||||
ui->plainTextEditCircle1Radius->setPlainText(formula);
|
||||
|
||||
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
auto *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
SCASSERT(point != nullptr)
|
||||
point->setC1Radius(formula);
|
||||
|
||||
|
@ -207,7 +197,7 @@ void DialogPointOfIntersectionCircles::SetFirstCircleRadius(const QString &value
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogPointOfIntersectionCircles::GetSecondCircleRadius() const
|
||||
auto DialogPointOfIntersectionCircles::GetSecondCircleRadius() const -> QString
|
||||
{
|
||||
return VTranslateVars::TryFormulaFromUser(ui->plainTextEditCircle2Radius->toPlainText(),
|
||||
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
|
@ -225,7 +215,7 @@ void DialogPointOfIntersectionCircles::SetSecondCircleRadius(const QString &valu
|
|||
}
|
||||
ui->plainTextEditCircle2Radius->setPlainText(formula);
|
||||
|
||||
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
auto *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
SCASSERT(point != nullptr)
|
||||
point->setC2Radius(formula);
|
||||
|
||||
|
@ -233,7 +223,7 @@ void DialogPointOfIntersectionCircles::SetSecondCircleRadius(const QString &valu
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
CrossCirclesPoint DialogPointOfIntersectionCircles::GetCrossCirclesPoint() const
|
||||
auto DialogPointOfIntersectionCircles::GetCrossCirclesPoint() const -> CrossCirclesPoint
|
||||
{
|
||||
return getCurrentCrossPoint<CrossCirclesPoint>(ui->comboBoxResult);
|
||||
}
|
||||
|
@ -246,7 +236,7 @@ void DialogPointOfIntersectionCircles::SetCrossCirclesPoint(const CrossCirclesPo
|
|||
{
|
||||
ui->comboBoxResult->setCurrentIndex(index);
|
||||
|
||||
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
auto *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
SCASSERT(point != nullptr)
|
||||
point->setCrossPoint(p);
|
||||
}
|
||||
|
@ -255,11 +245,14 @@ void DialogPointOfIntersectionCircles::SetCrossCirclesPoint(const CrossCirclesPo
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionCircles::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (prepare == false)// After first choose we ignore all objects
|
||||
if (prepare)// After first choose we ignore all objects
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
auto *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
SCASSERT(point != nullptr)
|
||||
|
||||
switch (number)
|
||||
|
@ -289,7 +282,6 @@ void DialogPointOfIntersectionCircles::ChosenObject(quint32 id, const SceneObjec
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -298,12 +290,12 @@ void DialogPointOfIntersectionCircles::PointChanged()
|
|||
QColor color;
|
||||
if (getCurrentObjectId(ui->comboBoxCircle1Center) == getCurrentObjectId(ui->comboBoxCircle2Center))
|
||||
{
|
||||
flagError = false;
|
||||
m_flagError = false;
|
||||
color = errorColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
flagError = true;
|
||||
m_flagError = true;
|
||||
color = OkColor(this);
|
||||
}
|
||||
ChangeColor(ui->labelCircle1Center, color);
|
||||
|
@ -314,19 +306,19 @@ void DialogPointOfIntersectionCircles::PointChanged()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionCircles::DeployCircle1RadiusTextEdit()
|
||||
{
|
||||
DeployFormula(this, ui->plainTextEditCircle1Radius, ui->pushButtonGrowCircle1Radius, formulaBaseHeightCircle1Radius);
|
||||
DeployFormula(this, ui->plainTextEditCircle1Radius, ui->pushButtonGrowCircle1Radius, m_formulaBaseHeightCircle1Radius);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionCircles::DeployCircle2RadiusTextEdit()
|
||||
{
|
||||
DeployFormula(this, ui->plainTextEditCircle2Radius, ui->pushButtonGrowCircle2Radius, formulaBaseHeightCircle2Radius);
|
||||
DeployFormula(this, ui->plainTextEditCircle2Radius, ui->pushButtonGrowCircle2Radius, m_formulaBaseHeightCircle2Radius);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionCircles::FXCircle1Radius()
|
||||
{
|
||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||
auto *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||
dialog->setWindowTitle(tr("Edit first circle radius"));
|
||||
dialog->SetFormula(GetFirstCircleRadius());
|
||||
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||
|
@ -340,7 +332,7 @@ void DialogPointOfIntersectionCircles::FXCircle1Radius()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionCircles::FXCircle2Radius()
|
||||
{
|
||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||
auto *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||
dialog->setWindowTitle(tr("Edit second circle radius"));
|
||||
dialog->SetFormula(GetSecondCircleRadius());
|
||||
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||
|
@ -361,11 +353,11 @@ void DialogPointOfIntersectionCircles::EvalCircle1Radius()
|
|||
formulaData.labelResult = ui->labelResultCircle1Radius;
|
||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||
|
||||
const qreal radius = Eval(formulaData, flagCircle1Radius);
|
||||
const qreal radius = Eval(formulaData, m_flagCircle1Radius);
|
||||
|
||||
if (radius < 0)
|
||||
{
|
||||
flagCircle2Radius = false;
|
||||
m_flagCircle2Radius = false;
|
||||
ChangeColor(ui->labelEditCircle1Radius, errorColor);
|
||||
ui->labelResultCircle1Radius->setText(tr("Error"));
|
||||
ui->labelResultCircle1Radius->setToolTip(tr("Radius can't be negative"));
|
||||
|
@ -384,11 +376,11 @@ void DialogPointOfIntersectionCircles::EvalCircle2Radius()
|
|||
formulaData.labelResult = ui->labelResultCircle2Radius;
|
||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||
|
||||
const qreal radius = Eval(formulaData, flagCircle2Radius);
|
||||
const qreal radius = Eval(formulaData, m_flagCircle2Radius);
|
||||
|
||||
if (radius < 0)
|
||||
{
|
||||
flagCircle2Radius = false;
|
||||
m_flagCircle2Radius = false;
|
||||
ChangeColor(ui->labelEditCircle2Radius, errorColor);
|
||||
ui->labelResultCircle2Radius->setText(tr("Error"));
|
||||
ui->labelResultCircle2Radius->setToolTip(tr("Radius can't be negative"));
|
||||
|
@ -406,9 +398,9 @@ void DialogPointOfIntersectionCircles::ShowVisualization()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionCircles::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
m_pointName = ui->lineEditNamePoint->text();
|
||||
|
||||
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
auto *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
SCASSERT(point != nullptr)
|
||||
|
||||
point->setObject1Id(GetFirstCircleCenterId());
|
||||
|
@ -434,7 +426,7 @@ void DialogPointOfIntersectionCircles::SetNotes(const QString ¬es)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogPointOfIntersectionCircles::GetNotes() const
|
||||
auto DialogPointOfIntersectionCircles::GetNotes() const -> QString
|
||||
{
|
||||
return ui->plainTextEditToolNotes->toPlainText();
|
||||
}
|
||||
|
|
|
@ -50,31 +50,31 @@ class DialogPointOfIntersectionCircles : public DialogTool
|
|||
|
||||
public:
|
||||
DialogPointOfIntersectionCircles(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
|
||||
virtual ~DialogPointOfIntersectionCircles() override;
|
||||
~DialogPointOfIntersectionCircles() override;
|
||||
|
||||
QString GetPointName() const;
|
||||
auto GetPointName() const -> QString;
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
quint32 GetFirstCircleCenterId() const;
|
||||
auto GetFirstCircleCenterId() const -> quint32;
|
||||
void SetFirstCircleCenterId(const quint32 &value);
|
||||
|
||||
quint32 GetSecondCircleCenterId() const;
|
||||
auto GetSecondCircleCenterId() const -> quint32;
|
||||
void SetSecondCircleCenterId(const quint32 &value);
|
||||
|
||||
QString GetFirstCircleRadius() const;
|
||||
auto GetFirstCircleRadius() const -> QString;
|
||||
void SetFirstCircleRadius(const QString &value);
|
||||
|
||||
QString GetSecondCircleRadius() const;
|
||||
auto GetSecondCircleRadius() const -> QString;
|
||||
void SetSecondCircleRadius(const QString &value);
|
||||
|
||||
CrossCirclesPoint GetCrossCirclesPoint() const;
|
||||
auto GetCrossCirclesPoint() const -> CrossCirclesPoint;
|
||||
void SetCrossCirclesPoint(const CrossCirclesPoint &p);
|
||||
|
||||
void SetNotes(const QString ¬es);
|
||||
QString GetNotes() const;
|
||||
auto GetNotes() const -> QString;
|
||||
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type) override;
|
||||
void ChosenObject(quint32 id, const SceneObject &type) override;
|
||||
void PointChanged();
|
||||
|
||||
void DeployCircle1RadiusTextEdit();
|
||||
|
@ -87,40 +87,40 @@ public slots:
|
|||
void EvalCircle2Radius();
|
||||
|
||||
protected:
|
||||
virtual void ShowVisualization() override;
|
||||
void ShowVisualization() override;
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
virtual void SaveData() override;
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual bool IsValid() const final;
|
||||
void SaveData() override;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
auto IsValid() const -> bool final;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY_MOVE(DialogPointOfIntersectionCircles) // NOLINT
|
||||
|
||||
Ui::DialogPointOfIntersectionCircles *ui;
|
||||
|
||||
QTimer *timerCircle1Radius;
|
||||
QTimer *timerCircle2Radius;
|
||||
QTimer *m_timerCircle1Radius;
|
||||
QTimer *m_timerCircle2Radius;
|
||||
|
||||
QString circle1Radius;
|
||||
QString circle2Radius;
|
||||
QString m_circle1Radius{};
|
||||
QString m_circle2Radius{};
|
||||
|
||||
int formulaBaseHeightCircle1Radius;
|
||||
int formulaBaseHeightCircle2Radius;
|
||||
int m_formulaBaseHeightCircle1Radius{0};
|
||||
int m_formulaBaseHeightCircle2Radius{0};
|
||||
|
||||
QString pointName;
|
||||
QString m_pointName{};
|
||||
|
||||
bool flagCircle1Radius;
|
||||
bool flagCircle2Radius;
|
||||
bool flagName;
|
||||
bool flagError;
|
||||
bool m_flagCircle1Radius{false};
|
||||
bool m_flagCircle2Radius{false};
|
||||
bool m_flagName{true};
|
||||
bool m_flagError{true};
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline bool DialogPointOfIntersectionCircles::IsValid() const
|
||||
inline auto DialogPointOfIntersectionCircles::IsValid() const -> bool
|
||||
{
|
||||
return flagCircle1Radius && flagCircle2Radius && flagName && flagError;
|
||||
return m_flagCircle1Radius && m_flagCircle2Radius && m_flagName && m_flagError;
|
||||
}
|
||||
|
||||
#endif // DIALOGPOINTOFINTERSECTIONCIRCLES_H
|
||||
|
|
|
@ -36,9 +36,7 @@
|
|||
#include <new>
|
||||
|
||||
#include "../../tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h"
|
||||
#include "../ifc/ifcdef.h"
|
||||
#include "../vgeometry/vpointf.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vwidgets/vmaingraphicsscene.h"
|
||||
#include "../visualization.h"
|
||||
|
@ -46,17 +44,15 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisToolPointOfIntersectionCircles::VisToolPointOfIntersectionCircles(const VContainer *data, QGraphicsItem *parent)
|
||||
: VisLine(data, parent), object2Id(NULL_ID), c1Radius(0), c2Radius(0),
|
||||
crossPoint(CrossCirclesPoint::FirstPoint), point(nullptr), c1Center(nullptr), c2Center(nullptr), c1Path(nullptr),
|
||||
c2Path(nullptr)
|
||||
: VisLine(data, parent)
|
||||
{
|
||||
this->setPen(QPen(Qt::NoPen)); // don't use parent this time
|
||||
|
||||
c1Path = InitItem<QGraphicsEllipseItem>(Qt::darkGreen, this);
|
||||
c2Path = InitItem<QGraphicsEllipseItem>(Qt::darkRed, this);
|
||||
point = InitPoint(mainColor, this);
|
||||
c1Center = InitPoint(supportColor, this);
|
||||
c2Center = InitPoint(supportColor, this); //-V656
|
||||
m_c1Path = InitItem<QGraphicsEllipseItem>(Qt::darkGreen, this);
|
||||
m_c2Path = InitItem<QGraphicsEllipseItem>(Qt::darkRed, this);
|
||||
m_point = InitPoint(mainColor, this);
|
||||
m_c1Center = InitPoint(supportColor, this);
|
||||
m_c2Center = InitPoint(supportColor, this); //-V656
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -65,26 +61,26 @@ void VisToolPointOfIntersectionCircles::RefreshGeometry()
|
|||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(c1Center, static_cast<QPointF>(*first), supportColor);
|
||||
DrawPoint(m_c1Center, static_cast<QPointF>(*first), supportColor);
|
||||
|
||||
if (object2Id > NULL_ID)
|
||||
if (m_object2Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(object2Id);
|
||||
DrawPoint(c2Center, static_cast<QPointF>(*second), supportColor);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(m_object2Id);
|
||||
DrawPoint(m_c2Center, static_cast<QPointF>(*second), supportColor);
|
||||
|
||||
if (c1Radius > 0 && c2Radius > 0)
|
||||
if (m_c1Radius > 0 && m_c2Radius > 0)
|
||||
{
|
||||
c1Path->setRect(PointRect(c1Radius));
|
||||
DrawPoint(c1Path, static_cast<QPointF>(*first), Qt::darkGreen, Qt::DashLine);
|
||||
m_c1Path->setRect(PointRect(m_c1Radius));
|
||||
DrawPoint(m_c1Path, static_cast<QPointF>(*first), Qt::darkGreen, Qt::DashLine);
|
||||
|
||||
c2Path->setRect(PointRect(c2Radius));
|
||||
DrawPoint(c2Path, static_cast<QPointF>(*second), Qt::darkRed, Qt::DashLine);
|
||||
m_c2Path->setRect(PointRect(m_c2Radius));
|
||||
DrawPoint(m_c2Path, static_cast<QPointF>(*second), Qt::darkRed, Qt::DashLine);
|
||||
|
||||
QPointF fPoint;
|
||||
VToolPointOfIntersectionCircles::FindPoint(static_cast<QPointF>(*first),
|
||||
static_cast<QPointF>(*second),
|
||||
c1Radius, c2Radius, crossPoint, &fPoint);
|
||||
DrawPoint(point, fPoint, mainColor);
|
||||
m_c1Radius, m_c2Radius, m_crossPoint, &fPoint);
|
||||
DrawPoint(m_point, fPoint, mainColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +89,7 @@ void VisToolPointOfIntersectionCircles::RefreshGeometry()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionCircles::VisualMode(const quint32 &id)
|
||||
{
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
||||
auto *scene = qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
|
||||
this->object1Id = id;
|
||||
|
@ -106,23 +102,23 @@ void VisToolPointOfIntersectionCircles::VisualMode(const quint32 &id)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionCircles::setObject2Id(const quint32 &value)
|
||||
{
|
||||
object2Id = value;
|
||||
m_object2Id = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionCircles::setC1Radius(const QString &value)
|
||||
{
|
||||
c1Radius = FindLengthFromUser(value, Visualization::data->DataVariables());
|
||||
m_c1Radius = FindLengthFromUser(value, Visualization::data->DataVariables());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionCircles::setC2Radius(const QString &value)
|
||||
{
|
||||
c2Radius = FindLengthFromUser(value, Visualization::data->DataVariables());
|
||||
m_c2Radius = FindLengthFromUser(value, Visualization::data->DataVariables());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionCircles::setCrossPoint(const CrossCirclesPoint &value)
|
||||
{
|
||||
crossPoint = value;
|
||||
m_crossPoint = value;
|
||||
}
|
||||
|
|
|
@ -45,30 +45,30 @@ class VisToolPointOfIntersectionCircles : public VisLine
|
|||
Q_OBJECT // NOLINT
|
||||
public:
|
||||
explicit VisToolPointOfIntersectionCircles(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||
virtual ~VisToolPointOfIntersectionCircles() = default;
|
||||
~VisToolPointOfIntersectionCircles() override = default;
|
||||
|
||||
virtual void RefreshGeometry() override;
|
||||
virtual void VisualMode(const quint32 &id) override;
|
||||
void RefreshGeometry() override;
|
||||
void VisualMode(const quint32 &id) override;
|
||||
|
||||
void setObject2Id(const quint32 &value);
|
||||
void setC1Radius(const QString &value);
|
||||
void setC2Radius(const QString &value);
|
||||
void setCrossPoint(const CrossCirclesPoint &value);
|
||||
|
||||
virtual int type() const override {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Vis::ToolPointOfIntersectionCircles)};
|
||||
auto type() const -> int override {return Type;}
|
||||
enum {Type = UserType + static_cast<int>(Vis::ToolPointOfIntersectionCircles)};
|
||||
private:
|
||||
// cppcheck-suppress unknownMacro
|
||||
Q_DISABLE_COPY_MOVE(VisToolPointOfIntersectionCircles) // NOLINT
|
||||
quint32 object2Id;
|
||||
qreal c1Radius;
|
||||
qreal c2Radius;
|
||||
CrossCirclesPoint crossPoint;
|
||||
VScaledEllipse *point;
|
||||
VScaledEllipse *c1Center;
|
||||
VScaledEllipse *c2Center;
|
||||
QGraphicsEllipseItem *c1Path;
|
||||
QGraphicsEllipseItem *c2Path;
|
||||
quint32 m_object2Id{NULL_ID};
|
||||
qreal m_c1Radius{0};
|
||||
qreal m_c2Radius{0};
|
||||
CrossCirclesPoint m_crossPoint{CrossCirclesPoint::FirstPoint};
|
||||
VScaledEllipse *m_point{nullptr};
|
||||
VScaledEllipse *m_c1Center{nullptr};
|
||||
VScaledEllipse *m_c2Center{nullptr};
|
||||
QGraphicsEllipseItem *m_c1Path{nullptr};
|
||||
QGraphicsEllipseItem *m_c2Path{nullptr};
|
||||
};
|
||||
|
||||
#endif // VISTOOLPOINTOFINTERSECTIONCIRCLES_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user