Refactoring. Deleted additional variables for storing ids.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-02-03 10:17:59 +02:00
parent d5836e2fb3
commit 493f607cac
38 changed files with 201 additions and 434 deletions

View File

@ -42,8 +42,7 @@
*/ */
DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogAlongLine), number(0), :DialogTool(data, toolId, parent), ui(new Ui::DialogAlongLine), number(0),
typeLine(QString()), formula(QString()), firstPointId(NULL_ID), secondPointId(NULL_ID), formulaBaseHeight(0), typeLine(QString()), formula(QString()), formulaBaseHeight(0), line(nullptr), lineColor(VAbstractTool::ColorBlack)
line(nullptr), lineColor(VAbstractTool::ColorBlack)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);
@ -184,11 +183,9 @@ void DialogAlongLine::SaveData()
typeLine = GetTypeLine(ui->comboBoxLineType); typeLine = GetTypeLine(ui->comboBoxLineType);
formula = ui->plainTextEditFormula->toPlainText(); formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " "); formula.replace("\n", " ");
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
line->setPoint1Id(firstPointId); line->setPoint1Id(getFirstPointId());
line->setPoint2Id(secondPointId); line->setPoint2Id(getSecondPointId());
line->setLength(formula); line->setLength(formula);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->RefreshGeometry(); line->RefreshGeometry();
@ -208,7 +205,7 @@ void DialogAlongLine::closeEvent(QCloseEvent *event)
*/ */
void DialogAlongLine::setSecondPointId(const quint32 &value) void DialogAlongLine::setSecondPointId(const quint32 &value)
{ {
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value); setCurrentPointId(ui->comboBoxSecondPoint, value);
line->setPoint2Id(value); line->setPoint2Id(value);
} }
@ -219,7 +216,7 @@ void DialogAlongLine::setSecondPointId(const quint32 &value)
*/ */
void DialogAlongLine::setFirstPointId(const quint32 &value) void DialogAlongLine::setFirstPointId(const quint32 &value)
{ {
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value); setCurrentPointId(ui->comboBoxFirstPoint, value);
line->setPoint1Id(value); line->setPoint1Id(value);
} }
@ -304,7 +301,7 @@ QString DialogAlongLine::getFormula() const
*/ */
quint32 DialogAlongLine::getFirstPointId() const quint32 DialogAlongLine::getFirstPointId() const
{ {
return firstPointId; return getCurrentObjectId(ui->comboBoxFirstPoint);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -314,5 +311,5 @@ quint32 DialogAlongLine::getFirstPointId() const
*/ */
quint32 DialogAlongLine::getSecondPointId() const quint32 DialogAlongLine::getSecondPointId() const
{ {
return secondPointId; return getCurrentObjectId(ui->comboBoxSecondPoint);
} }

View File

@ -97,12 +97,6 @@ private:
/** @brief formula formula */ /** @brief formula formula */
QString formula; QString formula;
/** @brief firstPointId id first point of line */
quint32 firstPointId;
/** @brief secondPointId id second point of line */
quint32 secondPointId;
/** @brief formulaBaseHeight base height defined by dialogui */ /** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight; int formulaBaseHeight;
VisToolAlongLine *line; VisToolAlongLine *line;

View File

@ -45,9 +45,9 @@
*/ */
DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false), :DialogTool(data, toolId, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false),
timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), center(NULL_ID), radius(QString()), timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), radius(QString()), f1(QString()), f2(QString()),
f1(QString()), f2(QString()), formulaBaseHeight(0), formulaBaseHeightF1(0), formulaBaseHeightF2(0), path(nullptr), formulaBaseHeight(0), formulaBaseHeightF1(0), formulaBaseHeightF2(0), path(nullptr), angleF1(INT_MIN),
angleF1(INT_MIN), angleF2(INT_MIN) angleF2(INT_MIN)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -132,9 +132,8 @@ DialogArc::~DialogArc()
*/ */
void DialogArc::SetCenter(const quint32 &value) void DialogArc::SetCenter(const quint32 &value)
{ {
center = value; ChangeCurrentData(ui->comboBoxBasePoint, value);
ChangeCurrentData(ui->comboBoxBasePoint, center); path->setPoint1Id(value);
path->setPoint1Id(center);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -235,9 +234,8 @@ void DialogArc::SaveData()
f1.replace("\n", " "); f1.replace("\n", " ");
f2 = ui->plainTextEditF2->toPlainText(); f2 = ui->plainTextEditF2->toPlainText();
f2.replace("\n", " "); f2.replace("\n", " ");
center = getCurrentObjectId(ui->comboBoxBasePoint);
path->setPoint1Id(center); path->setPoint1Id(GetCenter());
path->setRadius(radius); path->setRadius(radius);
path->setF1(f1); path->setF1(f1);
path->setF2(f2); path->setF2(f2);
@ -445,7 +443,7 @@ void DialogArc::CheckAngles()
*/ */
quint32 DialogArc::GetCenter() const quint32 DialogArc::GetCenter() const
{ {
return center; return getCurrentObjectId(ui->comboBoxBasePoint);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -108,9 +108,6 @@ private:
/** @brief timerF2 timer of check formula of second angle */ /** @brief timerF2 timer of check formula of second angle */
QTimer *timerF2; QTimer *timerF2;
/** @brief center id of center point */
quint32 center;
/** @brief radius formula of radius */ /** @brief radius formula of radius */
QString radius; QString radius;

View File

@ -43,8 +43,7 @@
*/ */
DialogBisector::DialogBisector(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogBisector::DialogBisector(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogBisector), number(0), typeLine(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogBisector), number(0), typeLine(QString()),
formula(QString()), firstPointId(NULL_ID), secondPointId(NULL_ID), thirdPointId(NULL_ID), formulaBaseHeight(0), formula(QString()), formulaBaseHeight(0), line(nullptr)
line(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);
@ -247,8 +246,8 @@ void DialogBisector::setFormula(const QString &value)
*/ */
void DialogBisector::setFirstPointId(const quint32 &value) void DialogBisector::setFirstPointId(const quint32 &value)
{ {
setPointId(ui->comboBoxFirstPoint, firstPointId, value); setCurrentPointId(ui->comboBoxFirstPoint, value);
line->setPoint1Id(firstPointId); line->setPoint1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -258,8 +257,8 @@ void DialogBisector::setFirstPointId(const quint32 &value)
*/ */
void DialogBisector::setSecondPointId(const quint32 &value) void DialogBisector::setSecondPointId(const quint32 &value)
{ {
setPointId(ui->comboBoxSecondPoint, secondPointId, value); setCurrentPointId(ui->comboBoxSecondPoint, value);
line->setPoint2Id(secondPointId); line->setPoint2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -269,8 +268,8 @@ void DialogBisector::setSecondPointId(const quint32 &value)
*/ */
void DialogBisector::setThirdPointId(const quint32 &value) void DialogBisector::setThirdPointId(const quint32 &value)
{ {
setPointId(ui->comboBoxThirdPoint, thirdPointId, value); setCurrentPointId(ui->comboBoxThirdPoint, value);
line->setPoint3Id(thirdPointId); line->setPoint3Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -280,13 +279,10 @@ void DialogBisector::SaveData()
typeLine = GetTypeLine(ui->comboBoxLineType); typeLine = GetTypeLine(ui->comboBoxLineType);
formula = ui->plainTextEditFormula->toPlainText(); formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " "); formula.replace("\n", " ");
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
thirdPointId = getCurrentObjectId(ui->comboBoxThirdPoint);
line->setPoint1Id(firstPointId); line->setPoint1Id(getFirstPointId());
line->setPoint2Id(secondPointId); line->setPoint2Id(getSecondPointId());
line->setPoint3Id(thirdPointId); line->setPoint3Id(getThirdPointId());
line->setLength(formula); line->setLength(formula);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->RefreshGeometry(); line->RefreshGeometry();
@ -326,7 +322,7 @@ QString DialogBisector::getFormula() const
*/ */
quint32 DialogBisector::getFirstPointId() const quint32 DialogBisector::getFirstPointId() const
{ {
return firstPointId; return getCurrentObjectId(ui->comboBoxFirstPoint);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -336,7 +332,7 @@ quint32 DialogBisector::getFirstPointId() const
*/ */
quint32 DialogBisector::getSecondPointId() const quint32 DialogBisector::getSecondPointId() const
{ {
return secondPointId; return getCurrentObjectId(ui->comboBoxSecondPoint);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -346,5 +342,5 @@ quint32 DialogBisector::getSecondPointId() const
*/ */
quint32 DialogBisector::getThirdPointId() const quint32 DialogBisector::getThirdPointId() const
{ {
return thirdPointId; return getCurrentObjectId(ui->comboBoxThirdPoint);
} }

View File

@ -98,15 +98,6 @@ private:
/** @brief formula formula */ /** @brief formula formula */
QString formula; QString formula;
/** @brief firstPointId id of first point */
quint32 firstPointId;
/** @brief secondPointId id of second point */
quint32 secondPointId;
/** @brief thirdPointId id of third point */
quint32 thirdPointId;
/** @brief formulaBaseHeight base height defined by dialogui */ /** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight; int formulaBaseHeight;
VisToolBisector *line; VisToolBisector *line;

View File

@ -39,7 +39,7 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogCurveIntersectAxis), number(0), typeLine(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogCurveIntersectAxis), number(0), typeLine(QString()),
formulaAngle(QString()), basePointId(NULL_ID), curveId(NULL_ID), formulaBaseHeightAngle(0), line(nullptr) formulaAngle(QString()), formulaBaseHeightAngle(0), line(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -125,26 +125,26 @@ void DialogCurveIntersectAxis::setAngle(const QString &value)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
quint32 DialogCurveIntersectAxis::getBasePointId() const quint32 DialogCurveIntersectAxis::getBasePointId() const
{ {
return basePointId; return getCurrentObjectId(ui->comboBoxAxisPoint);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogCurveIntersectAxis::setBasePointId(const quint32 &value) void DialogCurveIntersectAxis::setBasePointId(const quint32 &value)
{ {
setCurrentPointId(ui->comboBoxAxisPoint, basePointId, value); setCurrentPointId(ui->comboBoxAxisPoint, value);
line->setAxisPointId(value); line->setAxisPointId(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
quint32 DialogCurveIntersectAxis::getCurveId() const quint32 DialogCurveIntersectAxis::getCurveId() const
{ {
return curveId; return getCurrentObjectId(ui->comboBoxCurve);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogCurveIntersectAxis::setCurveId(const quint32 &value) void DialogCurveIntersectAxis::setCurveId(const quint32 &value)
{ {
setCurrentCurveId(ui->comboBoxCurve, curveId, value); setCurrentCurveId(ui->comboBoxCurve, value);
line->setPoint1Id(value); line->setPoint1Id(value);
} }
@ -158,7 +158,7 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
/*We will ignore click if poinet is in point circle*/ /*We will ignore click if poinet is in point circle*/
VMainGraphicsScene *scene = qApp->getCurrentScene(); VMainGraphicsScene *scene = qApp->getCurrentScene();
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr);
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(basePointId); const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(getBasePointId());
QLineF line = QLineF(point->toQPointF(), scene->getScenePos()); QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes. //Radius of point circle, but little bigger. Need handle with hover sizes.
@ -199,7 +199,6 @@ void DialogCurveIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
{ {
if (SetObject(id, ui->comboBoxAxisPoint, "")) if (SetObject(id, ui->comboBoxAxisPoint, ""))
{ {
basePointId = id;
line->setAxisPointId(id); line->setAxisPointId(id);
line->RefreshGeometry(); line->RefreshGeometry();
prepare = true; prepare = true;
@ -258,11 +257,8 @@ void DialogCurveIntersectAxis::SaveData()
formulaAngle = ui->plainTextEditFormula->toPlainText(); formulaAngle = ui->plainTextEditFormula->toPlainText();
formulaAngle.replace("\n", " "); formulaAngle.replace("\n", " ");
basePointId = getCurrentObjectId(ui->comboBoxAxisPoint); line->setPoint1Id(getCurveId());
curveId = getCurrentObjectId(ui->comboBoxCurve); line->setAxisPointId(getBasePointId());
line->setPoint1Id(curveId);
line->setAxisPointId(basePointId);
line->setAngle(formulaAngle); line->setAngle(formulaAngle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->RefreshGeometry(); line->RefreshGeometry();

View File

@ -84,8 +84,6 @@ private:
QString typeLine; QString typeLine;
QString formulaAngle; QString formulaAngle;
quint32 basePointId;
quint32 curveId;
int formulaBaseHeightAngle; int formulaBaseHeightAngle;
VisToolCurveIntersectAxis *line; VisToolCurveIntersectAxis *line;

View File

@ -42,8 +42,8 @@
* @param parent parent widget * @param parent parent widget
*/ */
DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
: DialogTool(data, toolId, parent), ui(new Ui::DialogCutArc), formula(QString()), : DialogTool(data, toolId, parent), ui(new Ui::DialogCutArc), formula(QString()), formulaBaseHeight(0),
arcId(NULL_ID), formulaBaseHeight(0), path(nullptr) path(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);
@ -133,9 +133,8 @@ void DialogCutArc::SaveData()
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
formula = ui->plainTextEditFormula->toPlainText(); formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " "); formula.replace("\n", " ");
arcId = getCurrentObjectId(ui->comboBoxArc);
path->setPoint1Id(arcId); path->setPoint1Id(getArcId());
path->setLength(formula); path->setLength(formula);
path->RefreshGeometry(); path->RefreshGeometry();
} }
@ -154,8 +153,8 @@ void DialogCutArc::closeEvent(QCloseEvent *event)
*/ */
void DialogCutArc::setArcId(const quint32 &value) void DialogCutArc::setArcId(const quint32 &value)
{ {
setCurrentArcId(ui->comboBoxArc, arcId, value, ComboBoxCutArc::CutArc); setCurrentArcId(ui->comboBoxArc, value, ComboBoxCutArc::CutArc);
path->setPoint1Id(arcId); path->setPoint1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -204,5 +203,5 @@ QString DialogCutArc::getFormula() const
*/ */
quint32 DialogCutArc::getArcId() const quint32 DialogCutArc::getArcId() const
{ {
return arcId; return getCurrentObjectId(ui->comboBoxArc);
} }

View File

@ -81,9 +81,6 @@ private:
/** @brief formula string with formula */ /** @brief formula string with formula */
QString formula; QString formula;
/** @brief arcId keep id of arc */
quint32 arcId;
/** @brief formulaBaseHeight base height defined by dialogui */ /** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight; int formulaBaseHeight;

View File

@ -41,8 +41,8 @@
* @param parent parent widget * @param parent parent widget
*/ */
DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogCutSpline), formula(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogCutSpline), formula(QString()), formulaBaseHeight(0),
splineId(NULL_ID), formulaBaseHeight(0), path(nullptr) path(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);
@ -115,8 +115,8 @@ void DialogCutSpline::setFormula(const QString &value)
*/ */
void DialogCutSpline::setSplineId(const quint32 &value) void DialogCutSpline::setSplineId(const quint32 &value)
{ {
setCurrentSplineId(ui->comboBoxSpline, splineId, value, ComboBoxCutSpline::CutSpline); setCurrentSplineId(ui->comboBoxSpline, value, ComboBoxCutSpline::CutSpline);
path->setPoint1Id(splineId); path->setPoint1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -148,9 +148,8 @@ void DialogCutSpline::SaveData()
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
formula = ui->plainTextEditFormula->toPlainText(); formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " "); formula.replace("\n", " ");
splineId = getCurrentObjectId(ui->comboBoxSpline);
path->setPoint1Id(splineId); path->setPoint1Id(getSplineId());
path->setLength(formula); path->setLength(formula);
path->RefreshGeometry(); path->RefreshGeometry();
} }
@ -197,5 +196,5 @@ QString DialogCutSpline::getFormula() const
*/ */
quint32 DialogCutSpline::getSplineId() const quint32 DialogCutSpline::getSplineId() const
{ {
return splineId; return getCurrentObjectId(ui->comboBoxSpline);
} }

View File

@ -77,9 +77,6 @@ private:
/** @brief formula string with formula */ /** @brief formula string with formula */
QString formula; QString formula;
/** @brief splineId keep id of spline */
quint32 splineId;
/** @brief formulaBaseHeight base height defined by dialogui */ /** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight; int formulaBaseHeight;

View File

@ -41,8 +41,8 @@
* @param parent parent widget * @param parent parent widget
*/ */
DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogCutSplinePath), formula(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogCutSplinePath), formula(QString()), formulaBaseHeight(0),
splinePathId(NULL_ID), formulaBaseHeight(0), path(nullptr) path(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);
@ -115,8 +115,8 @@ void DialogCutSplinePath::setFormula(const QString &value)
*/ */
void DialogCutSplinePath::setSplinePathId(const quint32 &value) void DialogCutSplinePath::setSplinePathId(const quint32 &value)
{ {
setCurrentSplinePathId(ui->comboBoxSplinePath, splinePathId, value, ComboBoxCutSpline::CutSpline); setCurrentSplinePathId(ui->comboBoxSplinePath, value, ComboBoxCutSpline::CutSpline);
path->setPoint1Id(splinePathId); path->setPoint1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -148,9 +148,8 @@ void DialogCutSplinePath::SaveData()
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
formula = ui->plainTextEditFormula->toPlainText(); formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " "); formula.replace("\n", " ");
splinePathId = getCurrentObjectId(ui->comboBoxSplinePath);
path->setPoint1Id(splinePathId); path->setPoint1Id(getSplinePathId());
path->setLength(formula); path->setLength(formula);
path->RefreshGeometry(); path->RefreshGeometry();
} }
@ -197,5 +196,5 @@ QString DialogCutSplinePath::getFormula() const
*/ */
quint32 DialogCutSplinePath::getSplinePathId() const quint32 DialogCutSplinePath::getSplinePathId() const
{ {
return splinePathId; return getCurrentObjectId(ui->comboBoxSplinePath);
} }

View File

@ -77,9 +77,6 @@ private:
/** @brief formula string with formula */ /** @brief formula string with formula */
QString formula; QString formula;
/** @brief splinePathId keep id of splinePath */
quint32 splinePathId;
/** @brief formulaBaseHeight base height defined by dialogui */ /** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight; int formulaBaseHeight;

View File

@ -44,8 +44,7 @@
*/ */
DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogEndLine), typeLine(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogEndLine), typeLine(QString()),
formulaLength(QString()), formulaAngle(QString()), basePointId(NULL_ID), formulaBaseHeight(0), formulaLength(QString()), formulaAngle(QString()), formulaBaseHeight(0), formulaBaseHeightAngle(0), line(nullptr)
formulaBaseHeightAngle(0), line(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);
@ -145,7 +144,6 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
{ {
if (SetObject(id, ui->comboBoxBasePoint, "")) if (SetObject(id, ui->comboBoxBasePoint, ""))
{ {
basePointId = id;
line->VisualMode(id); line->VisualMode(id);
connect(line, &VisToolEndLine::ToolTip, this, &DialogTool::ShowVisToolTip); connect(line, &VisToolEndLine::ToolTip, this, &DialogTool::ShowVisToolTip);
prepare = true; prepare = true;
@ -222,7 +220,7 @@ void DialogEndLine::setAngle(const QString &value)
*/ */
void DialogEndLine::setBasePointId(const quint32 &value) void DialogEndLine::setBasePointId(const quint32 &value)
{ {
setCurrentPointId(ui->comboBoxBasePoint, basePointId, value); setCurrentPointId(ui->comboBoxBasePoint, value);
line->setPoint1Id(value); line->setPoint1Id(value);
} }
@ -240,7 +238,7 @@ void DialogEndLine::ShowDialog(bool click)
/*We will ignore click if poinet is in point circle*/ /*We will ignore click if poinet is in point circle*/
VMainGraphicsScene *scene = qApp->getCurrentScene(); VMainGraphicsScene *scene = qApp->getCurrentScene();
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr);
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(basePointId); const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(getBasePointId());
QLineF line = QLineF(point->toQPointF(), scene->getScenePos()); QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes. //Radius of point circle, but little bigger. Need handle with hover sizes.
@ -283,9 +281,7 @@ void DialogEndLine::SaveData()
formulaAngle = ui->plainTextEditAngle->toPlainText(); formulaAngle = ui->plainTextEditAngle->toPlainText();
formulaAngle.replace("\n", " "); formulaAngle.replace("\n", " ");
basePointId = getCurrentObjectId(ui->comboBoxBasePoint); line->setPoint1Id(getBasePointId());
line->setPoint1Id(basePointId);
line->setLength(formulaLength); line->setLength(formulaLength);
line->setAngle(formulaAngle); line->setAngle(formulaAngle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
@ -347,5 +343,5 @@ QString DialogEndLine::getAngle() const
*/ */
quint32 DialogEndLine::getBasePointId() const quint32 DialogEndLine::getBasePointId() const
{ {
return basePointId; return getCurrentObjectId(ui->comboBoxBasePoint);
} }

View File

@ -61,6 +61,7 @@ public:
quint32 getBasePointId() const; quint32 getBasePointId() const;
void setBasePointId(const quint32 &value); void setBasePointId(const quint32 &value);
virtual void ShowDialog(bool click); virtual void ShowDialog(bool click);
public slots: public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type); virtual void ChosenObject(quint32 id, const SceneObject &type);
@ -98,9 +99,6 @@ private:
/** @brief angle angle of line */ /** @brief angle angle of line */
QString formulaAngle; QString formulaAngle;
/** @brief basePointId id base point of line */
quint32 basePointId;
/** @brief formulaBaseHeight base height defined by dialogui */ /** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight; int formulaBaseHeight;
int formulaBaseHeightAngle; int formulaBaseHeightAngle;

View File

@ -42,8 +42,7 @@
* @param parent parent widget * @param parent parent widget
*/ */
DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogHeight), number(0), :DialogTool(data, toolId, parent), ui(new Ui::DialogHeight), number(0), typeLine(QString()), line(nullptr)
typeLine(QString()), basePointId(NULL_ID), p1LineId(NULL_ID), p2LineId(NULL_ID), line(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
@ -108,8 +107,8 @@ void DialogHeight::setTypeLine(const QString &value)
*/ */
void DialogHeight::setBasePointId(const quint32 &value) void DialogHeight::setBasePointId(const quint32 &value)
{ {
setPointId(ui->comboBoxBasePoint, basePointId, value); setCurrentPointId(ui->comboBoxBasePoint, value);
line->setPoint1Id(basePointId); line->setPoint1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -119,8 +118,8 @@ void DialogHeight::setBasePointId(const quint32 &value)
*/ */
void DialogHeight::setP1LineId(const quint32 &value) void DialogHeight::setP1LineId(const quint32 &value)
{ {
setPointId(ui->comboBoxP1Line, p1LineId, value); setCurrentPointId(ui->comboBoxP1Line, value);
line->setLineP1Id(p1LineId); line->setLineP1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -130,8 +129,8 @@ void DialogHeight::setP1LineId(const quint32 &value)
*/ */
void DialogHeight::setP2LineId(const quint32 &value) void DialogHeight::setP2LineId(const quint32 &value)
{ {
setPointId(ui->comboBoxP2Line, p2LineId, value); setCurrentPointId(ui->comboBoxP2Line, value);
line->setLineP2Id(p2LineId); line->setLineP2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -198,13 +197,10 @@ void DialogHeight::SaveData()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType); typeLine = GetTypeLine(ui->comboBoxLineType);
basePointId = getCurrentObjectId(ui->comboBoxBasePoint);
p1LineId = getCurrentObjectId(ui->comboBoxP1Line);
p2LineId = getCurrentObjectId(ui->comboBoxP2Line);
line->setPoint1Id(basePointId); line->setPoint1Id(getBasePointId());
line->setLineP1Id(p1LineId); line->setLineP1Id(getP1LineId());
line->setLineP2Id(p2LineId); line->setLineP2Id(getP2LineId());
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->RefreshGeometry(); line->RefreshGeometry();
} }
@ -281,7 +277,7 @@ QString DialogHeight::getTypeLine() const
*/ */
quint32 DialogHeight::getBasePointId() const quint32 DialogHeight::getBasePointId() const
{ {
return basePointId; return getCurrentObjectId(ui->comboBoxBasePoint);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -291,7 +287,7 @@ quint32 DialogHeight::getBasePointId() const
*/ */
quint32 DialogHeight::getP1LineId() const quint32 DialogHeight::getP1LineId() const
{ {
return p1LineId; return getCurrentObjectId(ui->comboBoxP1Line);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -301,5 +297,5 @@ quint32 DialogHeight::getP1LineId() const
*/ */
quint32 DialogHeight::getP2LineId() const quint32 DialogHeight::getP2LineId() const
{ {
return p2LineId; return getCurrentObjectId(ui->comboBoxP2Line);
} }

View File

@ -83,14 +83,6 @@ private:
/** @brief typeLine type of line */ /** @brief typeLine type of line */
QString typeLine; QString typeLine;
/** @brief basePointId id base point of height */
quint32 basePointId;
/** @brief p1LineId id first point of line */
quint32 p1LineId;
/** @brief p2LineId id second point of line */
quint32 p2LineId;
VisToolHeight *line; VisToolHeight *line;
}; };

View File

@ -43,8 +43,7 @@
* @param parent parent widget * @param parent parent widget
*/ */
DialogLine::DialogLine(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogLine::DialogLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogLine), number(0), firstPoint(NULL_ID), secondPoint(NULL_ID), :DialogTool(data, toolId, parent), ui(new Ui::DialogLine), number(0), typeLine(QString()), line(nullptr)
typeLine(QString()), line(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
InitOkCancelApply(ui); InitOkCancelApply(ui);
@ -84,7 +83,7 @@ DialogLine::~DialogLine()
*/ */
void DialogLine::setSecondPoint(const quint32 &value) void DialogLine::setSecondPoint(const quint32 &value)
{ {
setPointId(ui->comboBoxSecondPoint, secondPoint, value); setCurrentPointId(ui->comboBoxSecondPoint, value);
line->setPoint2Id(value); line->setPoint2Id(value);
} }
@ -107,7 +106,7 @@ void DialogLine::setTypeLine(const QString &value)
*/ */
void DialogLine::setFirstPoint(const quint32 &value) void DialogLine::setFirstPoint(const quint32 &value)
{ {
setPointId(ui->comboBoxFirstPoint, firstPoint, value); setCurrentPointId(ui->comboBoxFirstPoint, value);
line->setPoint1Id(value); line->setPoint1Id(value);
} }
@ -154,14 +153,10 @@ void DialogLine::ShowVisualization()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogLine::SaveData() void DialogLine::SaveData()
{ {
qint32 index = ui->comboBoxFirstPoint->currentIndex();
firstPoint = qvariant_cast<quint32>(ui->comboBoxFirstPoint->itemData(index));
index = ui->comboBoxSecondPoint->currentIndex();
secondPoint = qvariant_cast<quint32>(ui->comboBoxSecondPoint->itemData(index));
typeLine = GetTypeLine(ui->comboBoxLineType); typeLine = GetTypeLine(ui->comboBoxLineType);
line->setPoint1Id(firstPoint); line->setPoint1Id(getFirstPoint());
line->setPoint2Id(secondPoint); line->setPoint2Id(getSecondPoint());
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->RefreshGeometry(); line->RefreshGeometry();
} }
@ -212,7 +207,7 @@ void DialogLine::ChosenObject(quint32 id, const SceneObject &type)
*/ */
quint32 DialogLine::getFirstPoint() const quint32 DialogLine::getFirstPoint() const
{ {
return firstPoint; return qvariant_cast<quint32>(ui->comboBoxFirstPoint->currentData());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -222,7 +217,7 @@ quint32 DialogLine::getFirstPoint() const
*/ */
quint32 DialogLine::getSecondPoint() const quint32 DialogLine::getSecondPoint() const
{ {
return secondPoint; return qvariant_cast<quint32>(ui->comboBoxSecondPoint->currentData());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -75,12 +75,6 @@ private:
/** @brief number number of handled objects */ /** @brief number number of handled objects */
qint32 number; qint32 number;
/** @brief firstPoint id first point */
quint32 firstPoint;
/** @brief secondPoint id second point */
quint32 secondPoint;
/** @brief typeLine type of line */ /** @brief typeLine type of line */
QString typeLine; QString typeLine;
VisToolLine *line; VisToolLine *line;

View File

@ -42,8 +42,7 @@
* @param parent parent widget * @param parent parent widget
*/ */
DialogLineIntersect::DialogLineIntersect(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogLineIntersect::DialogLineIntersect(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogLineIntersect), number(0), :DialogTool(data, toolId, parent), ui(new Ui::DialogLineIntersect), number(0), flagPoint(true), line(nullptr)
p1Line1(NULL_ID), p2Line1(NULL_ID), p1Line2(NULL_ID), p2Line2(NULL_ID), flagPoint(true), line(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
number = 0; number = 0;
@ -97,7 +96,6 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxP1Line1, tr("Select second point of first line"))) if (SetObject(id, ui->comboBoxP1Line1, tr("Select second point of first line")))
{ {
number++; number++;
p1Line1 = id;
line->VisualMode(id); line->VisualMode(id);
} }
break; break;
@ -107,7 +105,6 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxP2Line1, tr("Select first point of second line"))) if (SetObject(id, ui->comboBoxP2Line1, tr("Select first point of second line")))
{ {
number++; number++;
p2Line1 = id;
line->setLine1P2Id(id); line->setLine1P2Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
} }
@ -117,7 +114,6 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxP1Line2, tr("Select second point of second line"))) if (SetObject(id, ui->comboBoxP1Line2, tr("Select second point of second line")))
{ {
number++; number++;
p1Line2 = id;
line->setLine2P1Id(id); line->setLine2P1Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
} }
@ -134,7 +130,6 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
{ {
if (SetObject(id, ui->comboBoxP2Line2, "")) if (SetObject(id, ui->comboBoxP2Line2, ""))
{ {
p2Line2 = id;
line->setLine2P2Id(id); line->setLine2P2Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
prepare = true; prepare = true;
@ -144,16 +139,16 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
this->show(); this->show();
connect(ui->comboBoxP1Line1, connect(ui->comboBoxP1Line1,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogLineIntersect::P1Line1Changed); &DialogLineIntersect::PointChanged);
connect(ui->comboBoxP2Line1, connect(ui->comboBoxP2Line1,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogLineIntersect::P2Line1Changed); &DialogLineIntersect::PointChanged);
connect(ui->comboBoxP1Line2, connect(ui->comboBoxP1Line2,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogLineIntersect::P1Line2Changed); &DialogLineIntersect::PointChanged);
connect(ui->comboBoxP2Line2, connect(ui->comboBoxP2Line2,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogLineIntersect::P2Line2Changed); &DialogLineIntersect::PointChanged);
} }
} }
} }
@ -169,15 +164,11 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
void DialogLineIntersect::SaveData() void DialogLineIntersect::SaveData()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
p1Line1 = getCurrentObjectId(ui->comboBoxP1Line1);
p2Line1 = getCurrentObjectId(ui->comboBoxP2Line1);
p1Line2 = getCurrentObjectId(ui->comboBoxP1Line2);
p2Line2 = getCurrentObjectId(ui->comboBoxP2Line2);
line->setPoint1Id(p1Line1); line->setPoint1Id(getP1Line1());
line->setLine1P2Id(p2Line1); line->setLine1P2Id(getP2Line1());
line->setLine2P1Id(p1Line2); line->setLine2P1Id(getP1Line2());
line->setLine2P2Id(p2Line2); line->setLine2P2Id(getP2Line2());
line->RefreshGeometry(); line->RefreshGeometry();
} }
@ -186,55 +177,10 @@ void DialogLineIntersect::SaveData()
* @brief P1Line1Changed changed first point of first line * @brief P1Line1Changed changed first point of first line
* @param index index in list * @param index index in list
*/ */
void DialogLineIntersect::P1Line1Changed( int index) void DialogLineIntersect::PointChanged()
{ {
p1Line1 = qvariant_cast<quint32>(ui->comboBoxP1Line1->itemData(index));
flagPoint = CheckIntersecion(); flagPoint = CheckIntersecion();
CheckState(); CheckState();
line->setPoint1Id(p1Line1);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief P2Line1Changed changed second point of first line
* @param index index in list
*/
void DialogLineIntersect::P2Line1Changed(int index)
{
p2Line1 = qvariant_cast<quint32>(ui->comboBoxP2Line1->itemData(index));
flagPoint = CheckIntersecion();
CheckState();
line->setLine1P2Id(p2Line1);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief P1Line2Changed changed first point of second line
* @param index index in list
*/
void DialogLineIntersect::P1Line2Changed(int index)
{
p1Line2 = qvariant_cast<quint32>(ui->comboBoxP1Line2->itemData(index));
flagPoint = CheckIntersecion();
CheckState();
line->setLine2P1Id(p1Line2);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief P2Line2Changed changed second point of second line
* @param index index in list
*/
void DialogLineIntersect::P2Line2Changed(int index)
{
p2Line2 = qvariant_cast<quint32>(ui->comboBoxP2Line2->itemData(index));
flagPoint = CheckIntersecion();
CheckState();
line->setLine2P2Id(p2Line2);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -317,10 +263,10 @@ void DialogLineIntersect::CheckState()
*/ */
bool DialogLineIntersect::CheckIntersecion() bool DialogLineIntersect::CheckIntersecion()
{ {
const QSharedPointer<VPointF> p1L1 = data->GeometricObject<VPointF>(p1Line1); const QSharedPointer<VPointF> p1L1 = data->GeometricObject<VPointF>(getP1Line1());
const QSharedPointer<VPointF> p2L1 = data->GeometricObject<VPointF>(p2Line1); const QSharedPointer<VPointF> p2L1 = data->GeometricObject<VPointF>(getP2Line1());
const QSharedPointer<VPointF> p1L2 = data->GeometricObject<VPointF>(p1Line2); const QSharedPointer<VPointF> p1L2 = data->GeometricObject<VPointF>(getP1Line2());
const QSharedPointer<VPointF> p2L2 = data->GeometricObject<VPointF>(p2Line2); const QSharedPointer<VPointF> p2L2 = data->GeometricObject<VPointF>(getP2Line2());
QLineF line1(p1L1->toQPointF(), p2L1->toQPointF()); QLineF line1(p1L1->toQPointF(), p2L1->toQPointF());
QLineF line2(p1L2->toQPointF(), p2L2->toQPointF()); QLineF line2(p1L2->toQPointF(), p2L2->toQPointF());
@ -343,8 +289,8 @@ bool DialogLineIntersect::CheckIntersecion()
*/ */
void DialogLineIntersect::setP2Line2(const quint32 &value) void DialogLineIntersect::setP2Line2(const quint32 &value)
{ {
setPointId(ui->comboBoxP2Line2, p2Line2, value); setCurrentPointId(ui->comboBoxP2Line2, value);
line->setLine2P2Id(p2Line2); line->setLine2P2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -354,8 +300,8 @@ void DialogLineIntersect::setP2Line2(const quint32 &value)
*/ */
void DialogLineIntersect::setP1Line2(const quint32 &value) void DialogLineIntersect::setP1Line2(const quint32 &value)
{ {
setPointId(ui->comboBoxP1Line2, p1Line2, value); setCurrentPointId(ui->comboBoxP1Line2, value);
line->setLine2P1Id(p1Line2); line->setLine2P1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -365,8 +311,8 @@ void DialogLineIntersect::setP1Line2(const quint32 &value)
*/ */
void DialogLineIntersect::setP2Line1(const quint32 &value) void DialogLineIntersect::setP2Line1(const quint32 &value)
{ {
setPointId(ui->comboBoxP2Line1, p2Line1, value); setCurrentPointId(ui->comboBoxP2Line1, value);
line->setLine1P2Id(p2Line1); line->setLine1P2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -376,8 +322,8 @@ void DialogLineIntersect::setP2Line1(const quint32 &value)
*/ */
void DialogLineIntersect::setP1Line1(const quint32 &value) void DialogLineIntersect::setP1Line1(const quint32 &value)
{ {
setPointId(ui->comboBoxP1Line1, p1Line1, value); setCurrentPointId(ui->comboBoxP1Line1, value);
line->setPoint1Id(p1Line1); line->setPoint1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -398,7 +344,7 @@ void DialogLineIntersect::setPointName(const QString &value)
*/ */
quint32 DialogLineIntersect::getP1Line1() const quint32 DialogLineIntersect::getP1Line1() const
{ {
return p1Line1; return getCurrentObjectId(ui->comboBoxP1Line1);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -408,7 +354,7 @@ quint32 DialogLineIntersect::getP1Line1() const
*/ */
quint32 DialogLineIntersect::getP2Line1() const quint32 DialogLineIntersect::getP2Line1() const
{ {
return p2Line1; return getCurrentObjectId(ui->comboBoxP2Line1);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -418,7 +364,7 @@ quint32 DialogLineIntersect::getP2Line1() const
*/ */
quint32 DialogLineIntersect::getP1Line2() const quint32 DialogLineIntersect::getP1Line2() const
{ {
return p1Line2; return getCurrentObjectId(ui->comboBoxP1Line2);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -428,5 +374,5 @@ quint32 DialogLineIntersect::getP1Line2() const
*/ */
quint32 DialogLineIntersect::getP2Line2() const quint32 DialogLineIntersect::getP2Line2() const
{ {
return p2Line2; return getCurrentObjectId(ui->comboBoxP2Line2);
} }

View File

@ -63,10 +63,7 @@ public:
void setPointName(const QString &value); void setPointName(const QString &value);
public slots: public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type); virtual void ChosenObject(quint32 id, const SceneObject &type);
void P1Line1Changed( int index); void PointChanged();
void P2Line1Changed( int index);
void P1Line2Changed( int index);
void P2Line2Changed( int index);
virtual void PointNameChanged(); virtual void PointNameChanged();
virtual void UpdateList(); virtual void UpdateList();
protected: protected:
@ -84,18 +81,6 @@ private:
/** @brief number number of handled objects */ /** @brief number number of handled objects */
qint32 number; qint32 number;
/** @brief p1Line1 id first point of first line */
quint32 p1Line1;
/** @brief p2Line1 id second point of first line */
quint32 p2Line1;
/** @brief p1Line2 id first point of second line */
quint32 p1Line2;
/** @brief p2Line2 id second point of second line */
quint32 p2Line2;
/** @brief flagPoint keep state of point */ /** @brief flagPoint keep state of point */
bool flagPoint; bool flagPoint;

View File

@ -39,8 +39,7 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogLineIntersectAxis), number(0), typeLine(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogLineIntersectAxis), number(0), typeLine(QString()),
formulaAngle(QString()), basePointId(NULL_ID), firstPointId(NULL_ID), secondPointId(NULL_ID), formulaAngle(QString()), formulaBaseHeightAngle(0), line(nullptr)
formulaBaseHeightAngle(0), line(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);
@ -134,39 +133,39 @@ void DialogLineIntersectAxis::setAngle(const QString &value)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
quint32 DialogLineIntersectAxis::getBasePointId() const quint32 DialogLineIntersectAxis::getBasePointId() const
{ {
return basePointId; return getCurrentObjectId(ui->comboBoxAxisPoint);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersectAxis::setBasePointId(const quint32 &value) void DialogLineIntersectAxis::setBasePointId(const quint32 &value)
{ {
setCurrentPointId(ui->comboBoxAxisPoint, basePointId, value); setCurrentPointId(ui->comboBoxAxisPoint, value);
line->setAxisPointId(value); line->setAxisPointId(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
quint32 DialogLineIntersectAxis::getFirstPointId() const quint32 DialogLineIntersectAxis::getFirstPointId() const
{ {
return firstPointId; return getCurrentObjectId(ui->comboBoxFirstLinePoint);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersectAxis::setFirstPointId(const quint32 &value) void DialogLineIntersectAxis::setFirstPointId(const quint32 &value)
{ {
setCurrentPointId(ui->comboBoxFirstLinePoint, firstPointId, value); setCurrentPointId(ui->comboBoxFirstLinePoint, value);
line->setPoint1Id(value); line->setPoint1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
quint32 DialogLineIntersectAxis::getSecondPointId() const quint32 DialogLineIntersectAxis::getSecondPointId() const
{ {
return secondPointId; return getCurrentObjectId(ui->comboBoxSecondLinePoint);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersectAxis::setSecondPointId(const quint32 &value) void DialogLineIntersectAxis::setSecondPointId(const quint32 &value)
{ {
setCurrentPointId(ui->comboBoxSecondLinePoint, secondPointId, value); setCurrentPointId(ui->comboBoxSecondLinePoint, value);
line->setPoint2Id(value); line->setPoint2Id(value);
} }
@ -180,7 +179,7 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
/*We will ignore click if poinet is in point circle*/ /*We will ignore click if poinet is in point circle*/
VMainGraphicsScene *scene = qApp->getCurrentScene(); VMainGraphicsScene *scene = qApp->getCurrentScene();
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr);
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(basePointId); const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(getBasePointId());
QLineF line = QLineF(point->toQPointF(), scene->getScenePos()); QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes. //Radius of point circle, but little bigger. Need handle with hover sizes.
@ -237,7 +236,6 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
{ {
if (SetObject(id, ui->comboBoxAxisPoint, "")) if (SetObject(id, ui->comboBoxAxisPoint, ""))
{ {
basePointId = id;
line->setAxisPointId(id); line->setAxisPointId(id);
line->RefreshGeometry(); line->RefreshGeometry();
prepare = true; prepare = true;
@ -323,13 +321,9 @@ void DialogLineIntersectAxis::SaveData()
formulaAngle = ui->plainTextEditFormula->toPlainText(); formulaAngle = ui->plainTextEditFormula->toPlainText();
formulaAngle.replace("\n", " "); formulaAngle.replace("\n", " ");
basePointId = getCurrentObjectId(ui->comboBoxAxisPoint); line->setPoint1Id(getFirstPointId());
firstPointId = getCurrentObjectId(ui->comboBoxFirstLinePoint); line->setPoint2Id(getSecondPointId());
secondPointId = getCurrentObjectId(ui->comboBoxSecondLinePoint); line->setAxisPointId(getBasePointId());
line->setPoint1Id(firstPointId);
line->setPoint2Id(secondPointId);
line->setAxisPointId(basePointId);
line->setAngle(formulaAngle); line->setAngle(formulaAngle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->RefreshGeometry(); line->RefreshGeometry();

View File

@ -88,9 +88,6 @@ private:
QString typeLine; QString typeLine;
QString formulaAngle; QString formulaAngle;
quint32 basePointId;
quint32 firstPointId;
quint32 secondPointId;
int formulaBaseHeightAngle; int formulaBaseHeightAngle;
VisToolLineIntersectAxis *line; VisToolLineIntersectAxis *line;

View File

@ -40,7 +40,7 @@
*/ */
DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogNormal), number(0), typeLine(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogNormal), number(0), typeLine(QString()),
formula(QString()), angle(0), firstPointId(NULL_ID), secondPointId(NULL_ID), formulaBaseHeight(0), line(nullptr) formula(QString()), angle(0), formulaBaseHeight(0), line(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);
@ -177,11 +177,9 @@ void DialogNormal::SaveData()
formula = ui->plainTextEditFormula->toPlainText(); formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " "); formula.replace("\n", " ");
angle = ui->doubleSpinBoxAngle->value(); angle = ui->doubleSpinBoxAngle->value();
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
line->setPoint1Id(firstPointId); line->setPoint1Id(getFirstPointId());
line->setPoint2Id(secondPointId); line->setPoint2Id(getSecondPointId());
line->setLength(formula); line->setLength(formula);
line->setAngle(angle); line->setAngle(angle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
@ -202,7 +200,7 @@ void DialogNormal::closeEvent(QCloseEvent *event)
*/ */
void DialogNormal::setSecondPointId(const quint32 &value) void DialogNormal::setSecondPointId(const quint32 &value)
{ {
setPointId(ui->comboBoxSecondPoint, secondPointId, value); setCurrentPointId(ui->comboBoxSecondPoint, value);
line->setPoint2Id(value); line->setPoint2Id(value);
} }
@ -213,7 +211,7 @@ void DialogNormal::setSecondPointId(const quint32 &value)
*/ */
void DialogNormal::setFirstPointId(const quint32 &value) void DialogNormal::setFirstPointId(const quint32 &value)
{ {
setPointId(ui->comboBoxFirstPoint, firstPointId, value); setCurrentPointId(ui->comboBoxFirstPoint, value);
line->setPoint1Id(value); line->setPoint1Id(value);
} }
@ -307,7 +305,7 @@ qreal DialogNormal::getAngle() const
*/ */
quint32 DialogNormal::getFirstPointId() const quint32 DialogNormal::getFirstPointId() const
{ {
return firstPointId; return getCurrentObjectId(ui->comboBoxFirstPoint);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -317,5 +315,5 @@ quint32 DialogNormal::getFirstPointId() const
*/ */
quint32 DialogNormal::getSecondPointId() const quint32 DialogNormal::getSecondPointId() const
{ {
return secondPointId; return getCurrentObjectId(ui->comboBoxSecondPoint);
} }

View File

@ -100,12 +100,6 @@ private:
/** @brief angle aditional angle of normal */ /** @brief angle aditional angle of normal */
qreal angle; qreal angle;
/** @brief firstPointId id first point of line */
quint32 firstPointId;
/** @brief secondPointId id second point of line */
quint32 secondPointId;
/** @brief formulaBaseHeight base height defined by dialogui */ /** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight; int formulaBaseHeight;

View File

@ -42,7 +42,7 @@
*/ */
DialogPointOfContact::DialogPointOfContact(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogPointOfContact::DialogPointOfContact(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogPointOfContact), number(0), :DialogTool(data, toolId, parent), ui(new Ui::DialogPointOfContact), number(0),
radius(QString()), center(NULL_ID), firstPoint(NULL_ID), secondPoint(NULL_ID), formulaBaseHeight(0), line(nullptr) radius(QString()), formulaBaseHeight(0), line(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);
@ -217,13 +217,10 @@ void DialogPointOfContact::SaveData()
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
radius = ui->plainTextEditFormula->toPlainText(); radius = ui->plainTextEditFormula->toPlainText();
radius.replace("\n", " "); radius.replace("\n", " ");
center = getCurrentObjectId(ui->comboBoxCenter);
firstPoint = getCurrentObjectId(ui->comboBoxFirstPoint);
secondPoint = getCurrentObjectId(ui->comboBoxSecondPoint);
line->setPoint1Id(firstPoint); line->setPoint1Id(getFirstPoint());
line->setLineP2Id(secondPoint); line->setLineP2Id(getSecondPoint());
line->setRadiusId(center); line->setRadiusId(getCenter());
line->setRadius(radius); line->setRadius(radius);
line->RefreshGeometry(); line->RefreshGeometry();
} }
@ -242,8 +239,8 @@ void DialogPointOfContact::closeEvent(QCloseEvent *event)
*/ */
void DialogPointOfContact::setSecondPoint(const quint32 &value) void DialogPointOfContact::setSecondPoint(const quint32 &value)
{ {
setPointId(ui->comboBoxSecondPoint, secondPoint, value); setCurrentPointId(ui->comboBoxSecondPoint, value);
line->setLineP2Id(secondPoint); line->setLineP2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -253,8 +250,8 @@ void DialogPointOfContact::setSecondPoint(const quint32 &value)
*/ */
void DialogPointOfContact::setFirstPoint(const quint32 &value) void DialogPointOfContact::setFirstPoint(const quint32 &value)
{ {
setPointId(ui->comboBoxFirstPoint, firstPoint, value); setCurrentPointId(ui->comboBoxFirstPoint, value);
line->setPoint1Id(firstPoint); line->setPoint1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -264,8 +261,8 @@ void DialogPointOfContact::setFirstPoint(const quint32 &value)
*/ */
void DialogPointOfContact::setCenter(const quint32 &value) void DialogPointOfContact::setCenter(const quint32 &value)
{ {
setPointId(ui->comboBoxCenter, center, value); setCurrentPointId(ui->comboBoxCenter, value);
line->setRadiusId(center); line->setRadiusId(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -314,7 +311,7 @@ QString DialogPointOfContact::getRadius() const
*/ */
quint32 DialogPointOfContact::getCenter() const quint32 DialogPointOfContact::getCenter() const
{ {
return center; return getCurrentObjectId(ui->comboBoxCenter);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -324,7 +321,7 @@ quint32 DialogPointOfContact::getCenter() const
*/ */
quint32 DialogPointOfContact::getFirstPoint() const quint32 DialogPointOfContact::getFirstPoint() const
{ {
return firstPoint; return getCurrentObjectId(ui->comboBoxFirstPoint);;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -334,5 +331,5 @@ quint32 DialogPointOfContact::getFirstPoint() const
*/ */
quint32 DialogPointOfContact::getSecondPoint() const quint32 DialogPointOfContact::getSecondPoint() const
{ {
return secondPoint; return getCurrentObjectId(ui->comboBoxSecondPoint);
} }

View File

@ -92,15 +92,6 @@ private:
/** @brief radius radius of arc */ /** @brief radius radius of arc */
QString radius; QString radius;
/** @brief center id center point of arc */
quint32 center;
/** @brief firstPoint id first point of line */
quint32 firstPoint;
/** @brief secondPoint id second point of line */
quint32 secondPoint;
/** @brief formulaBaseHeight base height defined by dialogui */ /** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight; int formulaBaseHeight;

View File

@ -42,8 +42,7 @@
* @param parent parent widget * @param parent parent widget
*/ */
DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogPointOfIntersection), number(0), :DialogTool(data, toolId, parent), ui(new Ui::DialogPointOfIntersection), number(0), line(nullptr)
firstPointId(NULL_ID), secondPointId(NULL_ID), line(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
@ -82,8 +81,8 @@ DialogPointOfIntersection::~DialogPointOfIntersection()
*/ */
void DialogPointOfIntersection::setSecondPointId(const quint32 &value) void DialogPointOfIntersection::setSecondPointId(const quint32 &value)
{ {
setPointId(ui->comboBoxSecondPoint, secondPointId, value); setCurrentPointId(ui->comboBoxSecondPoint, value);
line->setPoint2Id(secondPointId); line->setPoint2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -132,11 +131,9 @@ void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type
void DialogPointOfIntersection::SaveData() void DialogPointOfIntersection::SaveData()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
line->setPoint1Id(firstPointId); line->setPoint1Id(getFirstPointId());
line->setPoint2Id(secondPointId); line->setPoint2Id(getSecondPointId());
line->RefreshGeometry(); line->RefreshGeometry();
} }
@ -186,8 +183,8 @@ void DialogPointOfIntersection::ShowVisualization()
*/ */
void DialogPointOfIntersection::setFirstPointId(const quint32 &value) void DialogPointOfIntersection::setFirstPointId(const quint32 &value)
{ {
setPointId(ui->comboBoxFirstPoint, firstPointId, value); setCurrentPointId(ui->comboBoxFirstPoint, value);
line->setPoint1Id(firstPointId); line->setPoint1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -208,7 +205,7 @@ void DialogPointOfIntersection::setPointName(const QString &value)
*/ */
quint32 DialogPointOfIntersection::getFirstPointId() const quint32 DialogPointOfIntersection::getFirstPointId() const
{ {
return firstPointId; return getCurrentObjectId(ui->comboBoxFirstPoint);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -218,5 +215,5 @@ quint32 DialogPointOfIntersection::getFirstPointId() const
*/ */
quint32 DialogPointOfIntersection::getSecondPointId() const quint32 DialogPointOfIntersection::getSecondPointId() const
{ {
return secondPointId; return getCurrentObjectId(ui->comboBoxSecondPoint);
} }

View File

@ -74,11 +74,6 @@ private:
/** @brief number number of handled objects */ /** @brief number number of handled objects */
qint32 number; qint32 number;
/** @brief firstPointId id first point of line */
quint32 firstPointId;
/** @brief secondPointId id second point of line */
quint32 secondPointId;
VisToolPointOfIntersection *line; VisToolPointOfIntersection *line;
}; };

View File

@ -43,8 +43,7 @@
*/ */
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogShoulderPoint), number(0), :DialogTool(data, toolId, parent), ui(new Ui::DialogShoulderPoint), number(0),
typeLine(QString()), formula(QString()), p1Line(NULL_ID), p2Line(NULL_ID), pShoulder(NULL_ID), formulaBaseHeight(0), typeLine(QString()), formula(QString()), formulaBaseHeight(0), line (nullptr)
line (nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);
@ -205,13 +204,10 @@ void DialogShoulderPoint::SaveData()
typeLine = GetTypeLine(ui->comboBoxLineType); typeLine = GetTypeLine(ui->comboBoxLineType);
formula = ui->plainTextEditFormula->toPlainText(); formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " "); formula.replace("\n", " ");
p1Line = getCurrentObjectId(ui->comboBoxP1Line);
p2Line = getCurrentObjectId(ui->comboBoxP2Line);
pShoulder = getCurrentObjectId(ui->comboBoxP3);
line->setPoint1Id(pShoulder); line->setPoint1Id(getP3());
line->setLineP1Id(p1Line); line->setLineP1Id(getP1Line());
line->setLineP2Id(p2Line); line->setLineP2Id(getP2Line());
line->setLength(formula); line->setLength(formula);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->RefreshGeometry(); line->RefreshGeometry();
@ -231,8 +227,8 @@ void DialogShoulderPoint::closeEvent(QCloseEvent *event)
*/ */
void DialogShoulderPoint::setP3(const quint32 &value) void DialogShoulderPoint::setP3(const quint32 &value)
{ {
setPointId(ui->comboBoxP3, pShoulder, value); setCurrentPointId(ui->comboBoxP3, value);
line->setPoint1Id(pShoulder); line->setPoint1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -242,8 +238,8 @@ void DialogShoulderPoint::setP3(const quint32 &value)
*/ */
void DialogShoulderPoint::setP2Line(const quint32 &value) void DialogShoulderPoint::setP2Line(const quint32 &value)
{ {
setPointId(ui->comboBoxP2Line, p2Line, value); setCurrentPointId(ui->comboBoxP2Line, value);
line->setLineP2Id(p2Line); line->setLineP2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -253,8 +249,8 @@ void DialogShoulderPoint::setP2Line(const quint32 &value)
*/ */
void DialogShoulderPoint::setP1Line(const quint32 &value) void DialogShoulderPoint::setP1Line(const quint32 &value)
{ {
setPointId(ui->comboBoxP1Line, p1Line, value); setCurrentPointId(ui->comboBoxP1Line, value);
line->setLineP1Id(p1Line); line->setLineP1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -325,7 +321,7 @@ QString DialogShoulderPoint::getFormula() const
*/ */
quint32 DialogShoulderPoint::getP1Line() const quint32 DialogShoulderPoint::getP1Line() const
{ {
return p1Line; return getCurrentObjectId(ui->comboBoxP1Line);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -335,7 +331,7 @@ quint32 DialogShoulderPoint::getP1Line() const
*/ */
quint32 DialogShoulderPoint::getP2Line() const quint32 DialogShoulderPoint::getP2Line() const
{ {
return p2Line; return getCurrentObjectId(ui->comboBoxP2Line);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -345,5 +341,5 @@ quint32 DialogShoulderPoint::getP2Line() const
*/ */
quint32 DialogShoulderPoint::getP3() const quint32 DialogShoulderPoint::getP3() const
{ {
return pShoulder; return getCurrentObjectId(ui->comboBoxP3);
} }

View File

@ -97,15 +97,6 @@ private:
/** @brief formula formula */ /** @brief formula formula */
QString formula; QString formula;
/** @brief p1Line id first point of line */
quint32 p1Line;
/** @brief p2Line id second point of line */
quint32 p2Line;
/** @brief pShoulder id shoulder point */
quint32 pShoulder;
/** @brief formulaBaseHeight base height defined by dialogui */ /** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight; int formulaBaseHeight;
VisToolShoulderPoint *line; VisToolShoulderPoint *line;

View File

@ -41,8 +41,8 @@
* @param parent parent widget * @param parent parent widget
*/ */
DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogSpline), number(0), p1(NULL_ID), p4(NULL_ID), angle1(0), :DialogTool(data, toolId, parent), ui(new Ui::DialogSpline), number(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1),
angle2(0), kAsm1(1), kAsm2(1), kCurve(1), path(nullptr) kCurve(1), path(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
InitOkCancelApply(ui); InitOkCancelApply(ui);
@ -76,7 +76,7 @@ DialogSpline::~DialogSpline()
*/ */
quint32 DialogSpline::getP1() const quint32 DialogSpline::getP1() const
{ {
return p1; return getCurrentObjectId(ui->comboBoxP1);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -141,16 +141,14 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogSpline::SaveData() void DialogSpline::SaveData()
{ {
p1 = getCurrentObjectId(ui->comboBoxP1);
p4 = getCurrentObjectId(ui->comboBoxP4);
angle1 = ui->spinBoxAngle1->value(); angle1 = ui->spinBoxAngle1->value();
angle2 = ui->spinBoxAngle2->value(); angle2 = ui->spinBoxAngle2->value();
kAsm1 = ui->doubleSpinBoxKasm1->value(); kAsm1 = ui->doubleSpinBoxKasm1->value();
kAsm2 = ui->doubleSpinBoxKasm2->value(); kAsm2 = ui->doubleSpinBoxKasm2->value();
kCurve = ui->doubleSpinBoxKcurve->value(); kCurve = ui->doubleSpinBoxKcurve->value();
path->setPoint1Id(p1); path->setPoint1Id(getP1());
path->setPoint4Id(p4); path->setPoint4Id(getP4());
path->setAngle1(angle1); path->setAngle1(angle1);
path->setAngle2(angle2); path->setAngle2(angle2);
path->setKAsm1(kAsm1); path->setKAsm1(kAsm1);
@ -270,8 +268,8 @@ void DialogSpline::setAngle1(const qreal &value)
*/ */
void DialogSpline::setP4(const quint32 &value) void DialogSpline::setP4(const quint32 &value)
{ {
setPointId(ui->comboBoxP4, p4, value); setCurrentPointId(ui->comboBoxP4, value);
path->setPoint4Id(p4); path->setPoint4Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -281,8 +279,8 @@ void DialogSpline::setP4(const quint32 &value)
*/ */
void DialogSpline::setP1(const quint32 &value) void DialogSpline::setP1(const quint32 &value)
{ {
setPointId(ui->comboBoxP1, p1, value); setCurrentPointId(ui->comboBoxP1, value);
path->setPoint1Id(p1); path->setPoint1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -292,7 +290,7 @@ void DialogSpline::setP1(const quint32 &value)
*/ */
quint32 DialogSpline::getP4() const quint32 DialogSpline::getP4() const
{ {
return p4; return getCurrentObjectId(ui->comboBoxP4);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -87,12 +87,6 @@ private:
/** @brief number number of handled objects */ /** @brief number number of handled objects */
qint32 number; qint32 number;
/** @brief p1 id first point of spline */
quint32 p1;
/** @brief p4 id fourth point of spline */
quint32 p4;
/** @brief angle1 first angle of spline in degree */ /** @brief angle1 first angle of spline in degree */
qreal angle1; qreal angle1;

View File

@ -582,28 +582,29 @@ qreal DialogTool::Eval(const QString &text, bool &flag, QLabel *label, const QSt
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogTool::setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value) const void DialogTool::setCurrentPointId(QComboBox *box, const quint32 &value) const
{ {
SCASSERT(box != nullptr); SCASSERT(box != nullptr);
box->blockSignals(true);
FillComboBoxPoints(box); FillComboBoxPoints(box);
pointId = value;
ChangeCurrentData(box, value); ChangeCurrentData(box, value);
box->blockSignals(false);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief setCurrentSplineId set current spline id in combobox * @brief setCurrentSplineId set current spline id in combobox
* @param box combobox * @param box combobox
* @param splineId save current spline id
* @param value spline id * @param value spline id
* @param cut if set to ComboMode::CutSpline don't show id+1 and id+2 * @param cut if set to ComboMode::CutSpline don't show id+1 and id+2
*/ */
void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value, void DialogTool::setCurrentSplineId(QComboBox *box, const quint32 &value, ComboBoxCutSpline cut) const
ComboBoxCutSpline cut) const
{ {
SCASSERT(box != nullptr); SCASSERT(box != nullptr);
FillComboBoxSplines(box, cut); FillComboBoxSplines(box, cut);
splineId = value;
ChangeCurrentData(box, value); ChangeCurrentData(box, value);
} }
@ -611,15 +612,13 @@ void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const qui
/** /**
* @brief setCurrentArcId * @brief setCurrentArcId
* @param box combobox * @param box combobox
* @param arcId save current arc id
* @param value arc id * @param value arc id
* @param cut if set to ComboMode::CutArc don't show id+1 and id+2 * @param cut if set to ComboMode::CutArc don't show id+1 and id+2
*/ */
void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &value, ComboBoxCutArc cut) const void DialogTool::setCurrentArcId(QComboBox *box, const quint32 &value, ComboBoxCutArc cut) const
{ {
SCASSERT(box != nullptr); SCASSERT(box != nullptr);
FillComboBoxArcs(box, cut); FillComboBoxArcs(box, cut);
arcId = value;
ChangeCurrentData(box, value); ChangeCurrentData(box, value);
} }
@ -627,25 +626,21 @@ void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &
/** /**
* @brief setCurrentSplinePathId set current splinePath id in combobox * @brief setCurrentSplinePathId set current splinePath id in combobox
* @param box combobox * @param box combobox
* @param splinePathId save current splinePath id
* @param value splinePath id * @param value splinePath id
* @param cut if set to ComboMode::CutSpline don't show id+1 and id+2 * @param cut if set to ComboMode::CutSpline don't show id+1 and id+2
*/ */
void DialogTool::setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value, void DialogTool::setCurrentSplinePathId(QComboBox *box, const quint32 &value, ComboBoxCutSpline cut) const
ComboBoxCutSpline cut) const
{ {
SCASSERT(box != nullptr); SCASSERT(box != nullptr);
FillComboBoxSplinesPath(box, cut); FillComboBoxSplinesPath(box, cut);
splinePathId = value;
ChangeCurrentData(box, value); ChangeCurrentData(box, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogTool::setCurrentCurveId(QComboBox *box, quint32 &curveId, const quint32 &value) const void DialogTool::setCurrentCurveId(QComboBox *box, const quint32 &value) const
{ {
SCASSERT(box != nullptr); SCASSERT(box != nullptr);
FillComboBoxCurves(box); FillComboBoxCurves(box);
curveId = value;
ChangeCurrentData(box, value); ChangeCurrentData(box, value);
} }
@ -800,15 +795,6 @@ void DialogTool::ChangeColor(QWidget *widget, const QColor &color)
widget->setPalette(palette); widget->setPalette(palette);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::setPointId(QComboBox *box, quint32 &pointId, const quint32 &value)
{
SCASSERT(box != nullptr);
box->blockSignals(true);
setCurrentPointId(box, pointId, value);
box->blockSignals(false);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.

View File

@ -233,14 +233,14 @@ protected:
void ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer * timer); void ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer * timer);
qreal Eval(const QString &text, bool &flag, QLabel *label, const QString &postfix, qreal Eval(const QString &text, bool &flag, QLabel *label, const QString &postfix,
bool checkZero = true); bool checkZero = true);
void setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value) const; void setCurrentPointId(QComboBox *box, const quint32 &value) const;
void setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value, void setCurrentSplineId(QComboBox *box, const quint32 &value,
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline) const; ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline) const;
void setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &value, void setCurrentArcId(QComboBox *box, const quint32 &value,
ComboBoxCutArc cut = ComboBoxCutArc::NoCutArc) const; ComboBoxCutArc cut = ComboBoxCutArc::NoCutArc) const;
void setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value, void setCurrentSplinePathId(QComboBox *box, const quint32 &value,
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline) const; ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline) const;
void setCurrentCurveId(QComboBox *box, quint32 &curveId, const quint32 &value) const; void setCurrentCurveId(QComboBox *box, const quint32 &value) const;
quint32 getCurrentObjectId(QComboBox *box) const; quint32 getCurrentObjectId(QComboBox *box) const;
bool SetObject(const quint32 &id, QComboBox *box, const QString &toolTip); bool SetObject(const quint32 &id, QComboBox *box, const QString &toolTip);
void DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight); void DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight);
@ -333,7 +333,6 @@ protected:
} }
void ChangeColor(QWidget *widget, const QColor &color); void ChangeColor(QWidget *widget, const QColor &color);
void setPointId(QComboBox *box, quint32 &pointId, const quint32 &value);
virtual void ShowVisualization(){} virtual void ShowVisualization(){}
/** /**
* @brief SaveData Put dialog data in local variables * @brief SaveData Put dialog data in local variables

View File

@ -41,8 +41,7 @@
* @param parent parent widget * @param parent parent widget
*/ */
DialogTriangle::DialogTriangle(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogTriangle::DialogTriangle(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogTriangle), number(0), axisP1Id(NULL_ID), :DialogTool(data, toolId, parent), ui(new Ui::DialogTriangle), number(0), line (nullptr)
axisP2Id(NULL_ID), firstPointId(NULL_ID), secondPointId(NULL_ID), line (nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
@ -161,15 +160,11 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
void DialogTriangle::SaveData() void DialogTriangle::SaveData()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
axisP1Id = getCurrentObjectId(ui->comboBoxAxisP1);
axisP2Id = getCurrentObjectId(ui->comboBoxAxisP2);
line->setPoint1Id(axisP1Id); line->setPoint1Id(getAxisP1Id());
line->setPoint2Id(axisP2Id); line->setPoint2Id(getAxisP2Id());
line->setHypotenuseP1Id(firstPointId); line->setHypotenuseP1Id(getFirstPointId());
line->setHypotenuseP2Id(secondPointId); line->setHypotenuseP2Id(getSecondPointId());
line->RefreshGeometry(); line->RefreshGeometry();
} }
@ -239,8 +234,8 @@ void DialogTriangle::setPointName(const QString &value)
*/ */
void DialogTriangle::setSecondPointId(const quint32 &value) void DialogTriangle::setSecondPointId(const quint32 &value)
{ {
setPointId(ui->comboBoxSecondPoint, secondPointId, value); setCurrentPointId(ui->comboBoxSecondPoint, value);
line->setHypotenuseP2Id(secondPointId); line->setHypotenuseP2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -250,8 +245,8 @@ void DialogTriangle::setSecondPointId(const quint32 &value)
*/ */
void DialogTriangle::setFirstPointId(const quint32 &value) void DialogTriangle::setFirstPointId(const quint32 &value)
{ {
setPointId(ui->comboBoxFirstPoint, firstPointId, value); setCurrentPointId(ui->comboBoxFirstPoint, value);
line->setHypotenuseP1Id(firstPointId); line->setHypotenuseP1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -261,8 +256,8 @@ void DialogTriangle::setFirstPointId(const quint32 &value)
*/ */
void DialogTriangle::setAxisP2Id(const quint32 &value) void DialogTriangle::setAxisP2Id(const quint32 &value)
{ {
setPointId(ui->comboBoxAxisP2, axisP2Id, value); setCurrentPointId(ui->comboBoxAxisP2, value);
line->setPoint2Id(axisP2Id); line->setPoint2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -272,8 +267,8 @@ void DialogTriangle::setAxisP2Id(const quint32 &value)
*/ */
void DialogTriangle::setAxisP1Id(const quint32 &value) void DialogTriangle::setAxisP1Id(const quint32 &value)
{ {
setPointId(ui->comboBoxAxisP1, axisP1Id, value); setCurrentPointId(ui->comboBoxAxisP1, value);
line->setPoint1Id(axisP1Id); line->setPoint1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -283,7 +278,7 @@ void DialogTriangle::setAxisP1Id(const quint32 &value)
*/ */
quint32 DialogTriangle::getAxisP1Id() const quint32 DialogTriangle::getAxisP1Id() const
{ {
return axisP1Id; return getCurrentObjectId(ui->comboBoxAxisP1);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -293,7 +288,7 @@ quint32 DialogTriangle::getAxisP1Id() const
*/ */
quint32 DialogTriangle::getAxisP2Id() const quint32 DialogTriangle::getAxisP2Id() const
{ {
return axisP2Id; return getCurrentObjectId(ui->comboBoxAxisP2);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -303,7 +298,7 @@ quint32 DialogTriangle::getAxisP2Id() const
*/ */
quint32 DialogTriangle::getFirstPointId() const quint32 DialogTriangle::getFirstPointId() const
{ {
return firstPointId; return getCurrentObjectId(ui->comboBoxFirstPoint);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -313,5 +308,5 @@ quint32 DialogTriangle::getFirstPointId() const
*/ */
quint32 DialogTriangle::getSecondPointId() const quint32 DialogTriangle::getSecondPointId() const
{ {
return secondPointId; return getCurrentObjectId(ui->comboBoxSecondPoint);
} }

View File

@ -80,18 +80,6 @@ private:
/** @brief number number of handled objects */ /** @brief number number of handled objects */
qint32 number; qint32 number;
/** @brief axisP1Id id first point of axis */
quint32 axisP1Id;
/** @brief axisP2Id id second point of axis */
quint32 axisP2Id;
/** @brief firstPointId id first point of line */
quint32 firstPointId;
/** @brief secondPointId id second point of line */
quint32 secondPointId;
VisToolTriangle *line; VisToolTriangle *line;
}; };