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