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

View file

@ -97,12 +97,6 @@ private:
/** @brief formula 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 */
int formulaBaseHeight;
VisToolAlongLine *line;

View file

@ -45,9 +45,9 @@
*/
DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
: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()),
f1(QString()), f2(QString()), formulaBaseHeight(0), formulaBaseHeightF1(0), formulaBaseHeightF2(0), path(nullptr),
angleF1(INT_MIN), angleF2(INT_MIN)
timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), radius(QString()), f1(QString()), f2(QString()),
formulaBaseHeight(0), formulaBaseHeightF1(0), formulaBaseHeightF2(0), path(nullptr), angleF1(INT_MIN),
angleF2(INT_MIN)
{
ui->setupUi(this);
@ -132,9 +132,8 @@ DialogArc::~DialogArc()
*/
void DialogArc::SetCenter(const quint32 &value)
{
center = value;
ChangeCurrentData(ui->comboBoxBasePoint, center);
path->setPoint1Id(center);
ChangeCurrentData(ui->comboBoxBasePoint, value);
path->setPoint1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -235,9 +234,8 @@ void DialogArc::SaveData()
f1.replace("\n", " ");
f2 = ui->plainTextEditF2->toPlainText();
f2.replace("\n", " ");
center = getCurrentObjectId(ui->comboBoxBasePoint);
path->setPoint1Id(center);
path->setPoint1Id(GetCenter());
path->setRadius(radius);
path->setF1(f1);
path->setF2(f2);
@ -445,7 +443,7 @@ void DialogArc::CheckAngles()
*/
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 */
QTimer *timerF2;
/** @brief center id of center point */
quint32 center;
/** @brief radius formula of radius */
QString radius;

View file

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

View file

@ -98,15 +98,6 @@ private:
/** @brief formula 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 */
int formulaBaseHeight;
VisToolBisector *line;

View file

@ -39,7 +39,7 @@
//---------------------------------------------------------------------------------------------------------------------
DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent)
: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);
@ -125,26 +125,26 @@ void DialogCurveIntersectAxis::setAngle(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogCurveIntersectAxis::getBasePointId() const
{
return basePointId;
return getCurrentObjectId(ui->comboBoxAxisPoint);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCurveIntersectAxis::setBasePointId(const quint32 &value)
{
setCurrentPointId(ui->comboBoxAxisPoint, basePointId, value);
setCurrentPointId(ui->comboBoxAxisPoint, value);
line->setAxisPointId(value);
}
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogCurveIntersectAxis::getCurveId() const
{
return curveId;
return getCurrentObjectId(ui->comboBoxCurve);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCurveIntersectAxis::setCurveId(const quint32 &value)
{
setCurrentCurveId(ui->comboBoxCurve, curveId, value);
setCurrentCurveId(ui->comboBoxCurve, value);
line->setPoint1Id(value);
}
@ -158,7 +158,7 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
/*We will ignore click if poinet is in point circle*/
VMainGraphicsScene *scene = qApp->getCurrentScene();
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());
//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, ""))
{
basePointId = id;
line->setAxisPointId(id);
line->RefreshGeometry();
prepare = true;
@ -258,11 +257,8 @@ void DialogCurveIntersectAxis::SaveData()
formulaAngle = ui->plainTextEditFormula->toPlainText();
formulaAngle.replace("\n", " ");
basePointId = getCurrentObjectId(ui->comboBoxAxisPoint);
curveId = getCurrentObjectId(ui->comboBoxCurve);
line->setPoint1Id(curveId);
line->setAxisPointId(basePointId);
line->setPoint1Id(getCurveId());
line->setAxisPointId(getBasePointId());
line->setAngle(formulaAngle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->RefreshGeometry();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -83,14 +83,6 @@ private:
/** @brief typeLine type of line */
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;
};

View file

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

View file

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

View file

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

View file

@ -63,10 +63,7 @@ public:
void setPointName(const QString &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
void P1Line1Changed( int index);
void P2Line1Changed( int index);
void P1Line2Changed( int index);
void P2Line2Changed( int index);
void PointChanged();
virtual void PointNameChanged();
virtual void UpdateList();
protected:
@ -84,18 +81,6 @@ private:
/** @brief number number of handled objects */
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 */
bool flagPoint;

View file

@ -39,8 +39,7 @@
//---------------------------------------------------------------------------------------------------------------------
DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogLineIntersectAxis), number(0), typeLine(QString()),
formulaAngle(QString()), basePointId(NULL_ID), firstPointId(NULL_ID), secondPointId(NULL_ID),
formulaBaseHeightAngle(0), line(nullptr)
formulaAngle(QString()), formulaBaseHeightAngle(0), line(nullptr)
{
ui->setupUi(this);
InitVariables(ui);
@ -134,39 +133,39 @@ void DialogLineIntersectAxis::setAngle(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogLineIntersectAxis::getBasePointId() const
{
return basePointId;
return getCurrentObjectId(ui->comboBoxAxisPoint);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersectAxis::setBasePointId(const quint32 &value)
{
setCurrentPointId(ui->comboBoxAxisPoint, basePointId, value);
setCurrentPointId(ui->comboBoxAxisPoint, value);
line->setAxisPointId(value);
}
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogLineIntersectAxis::getFirstPointId() const
{
return firstPointId;
return getCurrentObjectId(ui->comboBoxFirstLinePoint);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersectAxis::setFirstPointId(const quint32 &value)
{
setCurrentPointId(ui->comboBoxFirstLinePoint, firstPointId, value);
setCurrentPointId(ui->comboBoxFirstLinePoint, value);
line->setPoint1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogLineIntersectAxis::getSecondPointId() const
{
return secondPointId;
return getCurrentObjectId(ui->comboBoxSecondLinePoint);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersectAxis::setSecondPointId(const quint32 &value)
{
setCurrentPointId(ui->comboBoxSecondLinePoint, secondPointId, value);
setCurrentPointId(ui->comboBoxSecondLinePoint, value);
line->setPoint2Id(value);
}
@ -180,7 +179,7 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
/*We will ignore click if poinet is in point circle*/
VMainGraphicsScene *scene = qApp->getCurrentScene();
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());
//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, ""))
{
basePointId = id;
line->setAxisPointId(id);
line->RefreshGeometry();
prepare = true;
@ -323,13 +321,9 @@ void DialogLineIntersectAxis::SaveData()
formulaAngle = ui->plainTextEditFormula->toPlainText();
formulaAngle.replace("\n", " ");
basePointId = getCurrentObjectId(ui->comboBoxAxisPoint);
firstPointId = getCurrentObjectId(ui->comboBoxFirstLinePoint);
secondPointId = getCurrentObjectId(ui->comboBoxSecondLinePoint);
line->setPoint1Id(firstPointId);
line->setPoint2Id(secondPointId);
line->setAxisPointId(basePointId);
line->setPoint1Id(getFirstPointId());
line->setPoint2Id(getSecondPointId());
line->setAxisPointId(getBasePointId());
line->setAngle(formulaAngle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->RefreshGeometry();

View file

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

View file

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

View file

@ -100,12 +100,6 @@ private:
/** @brief angle aditional angle of normal */
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 */
int formulaBaseHeight;

View file

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

View file

@ -92,15 +92,6 @@ private:
/** @brief radius radius of arc */
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 */
int formulaBaseHeight;

View file

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

View file

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

View file

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

View file

@ -97,15 +97,6 @@ private:
/** @brief formula 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 */
int formulaBaseHeight;
VisToolShoulderPoint *line;

View file

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

View file

@ -87,12 +87,6 @@ private:
/** @brief number number of handled objects */
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 */
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);
box->blockSignals(true);
FillComboBoxPoints(box);
pointId = value;
ChangeCurrentData(box, value);
box->blockSignals(false);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setCurrentSplineId set current spline id in combobox
* @param box combobox
* @param splineId save current spline id
* @param value spline id
* @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,
ComboBoxCutSpline cut) const
void DialogTool::setCurrentSplineId(QComboBox *box, const quint32 &value, ComboBoxCutSpline cut) const
{
SCASSERT(box != nullptr);
FillComboBoxSplines(box, cut);
splineId = value;
ChangeCurrentData(box, value);
}
@ -611,15 +612,13 @@ void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const qui
/**
* @brief setCurrentArcId
* @param box combobox
* @param arcId save current arc id
* @param value arc id
* @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);
FillComboBoxArcs(box, cut);
arcId = 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
* @param box combobox
* @param splinePathId save current splinePath id
* @param value splinePath id
* @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,
ComboBoxCutSpline cut) const
void DialogTool::setCurrentSplinePathId(QComboBox *box, const quint32 &value, ComboBoxCutSpline cut) const
{
SCASSERT(box != nullptr);
FillComboBoxSplinesPath(box, cut);
splinePathId = 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);
FillComboBoxCurves(box);
curveId = value;
ChangeCurrentData(box, value);
}
@ -800,15 +795,6 @@ void DialogTool::ChangeColor(QWidget *widget, const QColor &color)
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.

View file

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

View file

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

View file

@ -80,18 +80,6 @@ private:
/** @brief number number of handled objects */
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;
};