2015-05-30 12:02:20 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file dialogpointofintersectioncircles.cpp
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 29 5, 2015
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2015-05-30 12:02:20 +02:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2015 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2015-05-30 12:02:20 +02:00
|
|
|
**
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "dialogpointofintersectioncircles.h"
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <limits.h>
|
|
|
|
#include <QColor>
|
|
|
|
#include <QComboBox>
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QPlainTextEdit>
|
|
|
|
#include <QPointer>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QToolButton>
|
|
|
|
#include <Qt>
|
|
|
|
|
2016-08-09 15:55:46 +02:00
|
|
|
#include "../vpatterndb/vtranslatevars.h"
|
2019-02-11 12:25:27 +01:00
|
|
|
#include "../vpatterndb/vcontainer.h"
|
2016-08-09 15:55:46 +02:00
|
|
|
#include "../../visualization/visualization.h"
|
2016-03-24 15:49:15 +01:00
|
|
|
#include "../../visualization/line/vistoolpointofintersectioncircles.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "../ifc/xml/vdomdocument.h"
|
2015-06-18 19:23:24 +02:00
|
|
|
#include "../support/dialogeditwrongformula.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "../vmisc/vabstractapplication.h"
|
|
|
|
#include "../vmisc/vcommonsettings.h"
|
|
|
|
#include "ui_dialogpointofintersectioncircles.h"
|
2015-10-18 21:30:51 +02:00
|
|
|
|
2015-05-30 12:02:20 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-02-11 12:25:27 +01:00
|
|
|
DialogPointOfIntersectionCircles::DialogPointOfIntersectionCircles(const VContainer *data, quint32 toolId,
|
2015-05-30 12:02:20 +02:00
|
|
|
QWidget *parent)
|
2019-02-11 12:25:27 +01:00
|
|
|
: DialogTool(data, toolId, parent),
|
|
|
|
ui(new Ui::DialogPointOfIntersectionCircles),
|
|
|
|
timerCircle1Radius(new QTimer(this)),
|
|
|
|
timerCircle2Radius(new QTimer(this)),
|
|
|
|
circle1Radius(),
|
|
|
|
circle2Radius(),
|
|
|
|
formulaBaseHeightCircle1Radius(0),
|
|
|
|
formulaBaseHeightCircle2Radius(0),
|
|
|
|
pointName(),
|
|
|
|
flagCircle1Radius(false),
|
|
|
|
flagCircle2Radius(false),
|
|
|
|
flagName(true),
|
|
|
|
flagError(true)
|
2015-05-30 12:02:20 +02:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
2015-12-09 11:40:43 +01:00
|
|
|
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
|
|
|
|
2021-02-06 14:52:21 +01:00
|
|
|
ui->lineEditNamePoint->setText(
|
|
|
|
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
2015-05-30 12:02:20 +02:00
|
|
|
|
|
|
|
this->formulaBaseHeightCircle1Radius = ui->plainTextEditCircle1Radius->height();
|
|
|
|
this->formulaBaseHeightCircle2Radius = ui->plainTextEditCircle2Radius->height();
|
|
|
|
|
|
|
|
ui->plainTextEditCircle1Radius->installEventFilter(this);
|
|
|
|
ui->plainTextEditCircle2Radius->installEventFilter(this);
|
|
|
|
|
2019-02-11 12:25:27 +01:00
|
|
|
timerCircle1Radius->setSingleShot(true);
|
2015-05-30 12:02:20 +02:00
|
|
|
connect(timerCircle1Radius, &QTimer::timeout, this, &DialogPointOfIntersectionCircles::EvalCircle1Radius);
|
|
|
|
|
2019-02-11 12:25:27 +01:00
|
|
|
timerCircle2Radius->setSingleShot(true);
|
2015-05-30 12:02:20 +02:00
|
|
|
connect(timerCircle2Radius, &QTimer::timeout, this, &DialogPointOfIntersectionCircles::EvalCircle2Radius);
|
|
|
|
|
|
|
|
InitOkCancelApply(ui);
|
|
|
|
|
|
|
|
FillComboBoxPoints(ui->comboBoxCircle1Center);
|
|
|
|
FillComboBoxPoints(ui->comboBoxCircle2Center);
|
|
|
|
FillComboBoxCrossCirclesPoints(ui->comboBoxResult);
|
|
|
|
|
2019-02-11 12:25:27 +01:00
|
|
|
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, [this]()
|
|
|
|
{
|
|
|
|
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, pointName, this->data, flagName);
|
|
|
|
CheckState();
|
|
|
|
});
|
2019-07-24 15:45:22 +02:00
|
|
|
connect(ui->comboBoxCircle1Center, &QComboBox::currentTextChanged,
|
2015-05-30 12:02:20 +02:00
|
|
|
this, &DialogPointOfIntersectionCircles::PointChanged);
|
2019-07-24 15:45:22 +02:00
|
|
|
connect(ui->comboBoxCircle2Center, &QComboBox::currentTextChanged,
|
2015-05-30 12:02:20 +02:00
|
|
|
this, &DialogPointOfIntersectionCircles::PointChanged);
|
|
|
|
|
|
|
|
connect(ui->toolButtonExprCircle1Radius, &QPushButton::clicked, this,
|
|
|
|
&DialogPointOfIntersectionCircles::FXCircle1Radius);
|
|
|
|
connect(ui->toolButtonExprCircle2Radius, &QPushButton::clicked, this,
|
|
|
|
&DialogPointOfIntersectionCircles::FXCircle2Radius);
|
|
|
|
|
2019-02-11 12:25:27 +01:00
|
|
|
connect(ui->plainTextEditCircle1Radius, &QPlainTextEdit::textChanged, this, [this]()
|
|
|
|
{
|
|
|
|
timerCircle1Radius->start(formulaTimerTimeout);
|
|
|
|
});
|
|
|
|
|
|
|
|
connect(ui->plainTextEditCircle2Radius, &QPlainTextEdit::textChanged, this, [this]()
|
|
|
|
{
|
|
|
|
timerCircle2Radius->start(formulaTimerTimeout);
|
|
|
|
});
|
2015-05-30 12:02:20 +02:00
|
|
|
|
|
|
|
connect(ui->pushButtonGrowCircle1Radius, &QPushButton::clicked, this,
|
|
|
|
&DialogPointOfIntersectionCircles::DeployCircle1RadiusTextEdit);
|
|
|
|
connect(ui->pushButtonGrowCircle2Radius, &QPushButton::clicked, this,
|
|
|
|
&DialogPointOfIntersectionCircles::DeployCircle2RadiusTextEdit);
|
|
|
|
|
|
|
|
vis = new VisToolPointOfIntersectionCircles(data);
|
2020-10-28 13:09:56 +01:00
|
|
|
|
|
|
|
ui->tabWidget->setCurrentIndex(0);
|
|
|
|
SetTabStopDistance(ui->plainTextEditToolNotes);
|
2015-05-30 12:02:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
DialogPointOfIntersectionCircles::~DialogPointOfIntersectionCircles()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2019-02-11 12:25:27 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString DialogPointOfIntersectionCircles::GetPointName() const
|
|
|
|
{
|
|
|
|
return pointName;
|
|
|
|
}
|
|
|
|
|
2015-05-30 12:02:20 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::SetPointName(const QString &value)
|
|
|
|
{
|
|
|
|
pointName = value;
|
|
|
|
ui->lineEditNamePoint->setText(pointName);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
quint32 DialogPointOfIntersectionCircles::GetFirstCircleCenterId() const
|
|
|
|
{
|
|
|
|
return getCurrentObjectId(ui->comboBoxCircle1Center);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::SetFirstCircleCenterId(const quint32 &value)
|
|
|
|
{
|
|
|
|
setCurrentPointId(ui->comboBoxCircle1Center, value);
|
|
|
|
|
|
|
|
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
2016-12-20 19:57:20 +01:00
|
|
|
SCASSERT(point != nullptr)
|
2016-01-24 17:15:08 +01:00
|
|
|
point->setObject1Id(value);
|
2015-05-30 12:02:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
quint32 DialogPointOfIntersectionCircles::GetSecondCircleCenterId() const
|
|
|
|
{
|
|
|
|
return getCurrentObjectId(ui->comboBoxCircle2Center);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::SetSecondCircleCenterId(const quint32 &value)
|
|
|
|
{
|
|
|
|
setCurrentPointId(ui->comboBoxCircle2Center, value);
|
|
|
|
|
|
|
|
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
2016-12-20 19:57:20 +01:00
|
|
|
SCASSERT(point != nullptr)
|
2016-01-24 17:15:08 +01:00
|
|
|
point->setObject2Id(value);
|
2015-05-30 12:02:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString DialogPointOfIntersectionCircles::GetFirstCircleRadius() const
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
return VAbstractApplication::VApp()->TrVars()
|
|
|
|
->TryFormulaFromUser(ui->plainTextEditCircle1Radius->toPlainText(),
|
|
|
|
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
2015-05-30 12:02:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::SetFirstCircleRadius(const QString &value)
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
const QString formula = VAbstractValApplication::VApp()->TrVars()
|
|
|
|
->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
2015-05-30 12:02:20 +02:00
|
|
|
// increase height if needed.
|
|
|
|
if (formula.length() > 80)
|
|
|
|
{
|
|
|
|
this->DeployCircle1RadiusTextEdit();
|
|
|
|
}
|
|
|
|
ui->plainTextEditCircle1Radius->setPlainText(formula);
|
|
|
|
|
|
|
|
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
2016-12-20 19:57:20 +01:00
|
|
|
SCASSERT(point != nullptr)
|
2015-05-30 12:02:20 +02:00
|
|
|
point->setC1Radius(formula);
|
|
|
|
|
|
|
|
MoveCursorToEnd(ui->plainTextEditCircle1Radius);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString DialogPointOfIntersectionCircles::GetSecondCircleRadius() const
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
return VAbstractApplication::VApp()->TrVars()
|
|
|
|
->TryFormulaFromUser(ui->plainTextEditCircle2Radius->toPlainText(),
|
|
|
|
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
2015-05-30 12:02:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::SetSecondCircleRadius(const QString &value)
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
const QString formula = VAbstractApplication::VApp()->TrVars()
|
|
|
|
->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
2015-05-30 12:02:20 +02:00
|
|
|
// increase height if needed.
|
|
|
|
if (formula.length() > 80)
|
|
|
|
{
|
|
|
|
this->DeployCircle2RadiusTextEdit();
|
|
|
|
}
|
|
|
|
ui->plainTextEditCircle2Radius->setPlainText(formula);
|
|
|
|
|
|
|
|
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
2016-12-20 19:57:20 +01:00
|
|
|
SCASSERT(point != nullptr)
|
2015-05-30 12:02:20 +02:00
|
|
|
point->setC2Radius(formula);
|
|
|
|
|
|
|
|
MoveCursorToEnd(ui->plainTextEditCircle2Radius);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
CrossCirclesPoint DialogPointOfIntersectionCircles::GetCrossCirclesPoint() const
|
|
|
|
{
|
2016-01-24 17:15:08 +01:00
|
|
|
return getCurrentCrossPoint<CrossCirclesPoint>(ui->comboBoxResult);
|
2015-05-30 12:02:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-10-28 15:22:36 +01:00
|
|
|
void DialogPointOfIntersectionCircles::SetCrossCirclesPoint(const CrossCirclesPoint &p)
|
2015-05-30 12:02:20 +02:00
|
|
|
{
|
|
|
|
const qint32 index = ui->comboBoxResult->findData(static_cast<int>(p));
|
|
|
|
if (index != -1)
|
|
|
|
{
|
|
|
|
ui->comboBoxResult->setCurrentIndex(index);
|
|
|
|
|
|
|
|
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
2016-12-20 19:57:20 +01:00
|
|
|
SCASSERT(point != nullptr)
|
2015-05-30 12:02:20 +02:00
|
|
|
point->setCrossPoint(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::ChosenObject(quint32 id, const SceneObject &type)
|
|
|
|
{
|
|
|
|
if (prepare == false)// After first choose we ignore all objects
|
|
|
|
{
|
|
|
|
if (type == SceneObject::Point)
|
|
|
|
{
|
|
|
|
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
2016-12-20 19:57:20 +01:00
|
|
|
SCASSERT(point != nullptr)
|
2015-05-30 12:02:20 +02:00
|
|
|
|
|
|
|
switch (number)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (SetObject(id, ui->comboBoxCircle1Center, tr("Select second circle center")))
|
|
|
|
{
|
|
|
|
number++;
|
|
|
|
point->VisualMode(id);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (getCurrentObjectId(ui->comboBoxCircle1Center) != id)
|
|
|
|
{
|
2018-03-14 15:01:24 +01:00
|
|
|
if (SetObject(id, ui->comboBoxCircle2Center, QString()))
|
2015-05-30 12:02:20 +02:00
|
|
|
{
|
|
|
|
number = 0;
|
2016-01-24 17:15:08 +01:00
|
|
|
point->setObject2Id(id);
|
2015-05-30 12:02:20 +02:00
|
|
|
point->RefreshGeometry();
|
|
|
|
prepare = true;
|
2016-02-01 20:16:23 +01:00
|
|
|
this->setModal(true);
|
|
|
|
this->show();
|
2015-05-30 12:02:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::PointChanged()
|
|
|
|
{
|
2019-02-11 12:25:27 +01:00
|
|
|
QColor color;
|
2015-05-30 12:02:20 +02:00
|
|
|
if (getCurrentObjectId(ui->comboBoxCircle1Center) == getCurrentObjectId(ui->comboBoxCircle2Center))
|
|
|
|
{
|
|
|
|
flagError = false;
|
|
|
|
color = errorColor;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
flagError = true;
|
2019-02-11 12:25:27 +01:00
|
|
|
color = OkColor(this);
|
2015-05-30 12:02:20 +02:00
|
|
|
}
|
|
|
|
ChangeColor(ui->labelCircle1Center, color);
|
|
|
|
ChangeColor(ui->labelCircle1Center, color);
|
|
|
|
CheckState();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::DeployCircle1RadiusTextEdit()
|
|
|
|
{
|
2019-02-11 12:25:27 +01:00
|
|
|
DeployFormula(this, ui->plainTextEditCircle1Radius, ui->pushButtonGrowCircle1Radius, formulaBaseHeightCircle1Radius);
|
2015-05-30 12:02:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::DeployCircle2RadiusTextEdit()
|
|
|
|
{
|
2019-02-11 12:25:27 +01:00
|
|
|
DeployFormula(this, ui->plainTextEditCircle2Radius, ui->pushButtonGrowCircle2Radius, formulaBaseHeightCircle2Radius);
|
2015-05-30 12:02:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::FXCircle1Radius()
|
|
|
|
{
|
|
|
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
|
|
|
dialog->setWindowTitle(tr("Edit first circle radius"));
|
|
|
|
dialog->SetFormula(GetFirstCircleRadius());
|
2021-02-06 14:52:21 +01:00
|
|
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
2015-05-30 12:02:20 +02:00
|
|
|
if (dialog->exec() == QDialog::Accepted)
|
|
|
|
{
|
|
|
|
SetFirstCircleRadius(dialog->GetFormula());
|
|
|
|
}
|
|
|
|
delete dialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::FXCircle2Radius()
|
|
|
|
{
|
|
|
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
|
|
|
dialog->setWindowTitle(tr("Edit second circle radius"));
|
|
|
|
dialog->SetFormula(GetSecondCircleRadius());
|
2021-02-06 14:52:21 +01:00
|
|
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
2015-05-30 12:02:20 +02:00
|
|
|
if (dialog->exec() == QDialog::Accepted)
|
|
|
|
{
|
|
|
|
SetSecondCircleRadius(dialog->GetFormula());
|
|
|
|
}
|
|
|
|
delete dialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::EvalCircle1Radius()
|
|
|
|
{
|
2019-02-11 12:25:27 +01:00
|
|
|
FormulaData formulaData;
|
|
|
|
formulaData.formula = ui->plainTextEditCircle1Radius->toPlainText();
|
|
|
|
formulaData.variables = data->DataVariables();
|
|
|
|
formulaData.labelEditFormula = ui->labelEditCircle1Radius;
|
|
|
|
formulaData.labelResult = ui->labelResultCircle1Radius;
|
2021-02-06 14:52:21 +01:00
|
|
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
2019-02-11 12:25:27 +01:00
|
|
|
|
|
|
|
const qreal radius = Eval(formulaData, flagCircle1Radius);
|
2015-05-30 12:02:20 +02:00
|
|
|
|
|
|
|
if (radius < 0)
|
|
|
|
{
|
|
|
|
flagCircle2Radius = false;
|
2019-02-11 12:25:27 +01:00
|
|
|
ChangeColor(ui->labelEditCircle1Radius, errorColor);
|
2015-05-30 12:02:20 +02:00
|
|
|
ui->labelResultCircle1Radius->setText(tr("Error"));
|
|
|
|
ui->labelResultCircle1Radius->setToolTip(tr("Radius can't be negative"));
|
|
|
|
|
|
|
|
DialogPointOfIntersectionCircles::CheckState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::EvalCircle2Radius()
|
|
|
|
{
|
2019-02-11 12:25:27 +01:00
|
|
|
FormulaData formulaData;
|
|
|
|
formulaData.formula = ui->plainTextEditCircle2Radius->toPlainText();
|
|
|
|
formulaData.variables = data->DataVariables();
|
|
|
|
formulaData.labelEditFormula = ui->labelEditCircle2Radius;
|
2019-09-20 13:17:32 +02:00
|
|
|
formulaData.labelResult = ui->labelResultCircle2Radius;
|
2021-02-06 14:52:21 +01:00
|
|
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
2019-02-11 12:25:27 +01:00
|
|
|
|
|
|
|
const qreal radius = Eval(formulaData, flagCircle2Radius);
|
2015-05-30 12:02:20 +02:00
|
|
|
|
|
|
|
if (radius < 0)
|
|
|
|
{
|
|
|
|
flagCircle2Radius = false;
|
2019-02-11 12:25:27 +01:00
|
|
|
ChangeColor(ui->labelEditCircle2Radius, errorColor);
|
2015-05-30 12:02:20 +02:00
|
|
|
ui->labelResultCircle2Radius->setText(tr("Error"));
|
|
|
|
ui->labelResultCircle2Radius->setToolTip(tr("Radius can't be negative"));
|
|
|
|
|
|
|
|
DialogPointOfIntersectionCircles::CheckState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::ShowVisualization()
|
|
|
|
{
|
|
|
|
AddVisualization<VisToolPointOfIntersectionCircles>();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::SaveData()
|
|
|
|
{
|
|
|
|
pointName = ui->lineEditNamePoint->text();
|
|
|
|
|
|
|
|
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
2016-12-20 19:57:20 +01:00
|
|
|
SCASSERT(point != nullptr)
|
2015-05-30 12:02:20 +02:00
|
|
|
|
2016-01-24 17:15:08 +01:00
|
|
|
point->setObject1Id(GetFirstCircleCenterId());
|
|
|
|
point->setObject2Id(GetSecondCircleCenterId());
|
2020-12-08 10:20:44 +01:00
|
|
|
point->setC1Radius(ui->plainTextEditCircle1Radius->toPlainText());
|
2018-01-24 21:08:53 +01:00
|
|
|
point->setC2Radius(ui->plainTextEditCircle2Radius->toPlainText());
|
2015-05-30 12:02:20 +02:00
|
|
|
point->setCrossPoint(GetCrossCirclesPoint());
|
|
|
|
point->RefreshGeometry();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::closeEvent(QCloseEvent *event)
|
|
|
|
{
|
|
|
|
ui->plainTextEditCircle1Radius->blockSignals(true);
|
|
|
|
ui->plainTextEditCircle2Radius->blockSignals(true);
|
|
|
|
DialogTool::closeEvent(event);
|
|
|
|
}
|
2020-10-28 13:09:56 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogPointOfIntersectionCircles::SetNotes(const QString ¬es)
|
|
|
|
{
|
|
|
|
ui->plainTextEditToolNotes->setPlainText(notes);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString DialogPointOfIntersectionCircles::GetNotes() const
|
|
|
|
{
|
|
|
|
return ui->plainTextEditToolNotes->toPlainText();
|
|
|
|
}
|