51 #include <QPlainTextEdit>
53 #include <QPushButton>
55 #include <QToolButton>
58 #include "../../tools/vabstracttool.h"
59 #include "../ifc/xml/vdomdocument.h"
60 #include "../vpatterndb/vtranslatevars.h"
61 #include "../../visualization/path/vistoolellipticalarc.h"
62 #include "../../visualization/visualization.h"
63 #include "../support/edit_formula_dialog.h"
64 #include "../vmisc/vabstractapplication.h"
65 #include "../vmisc/vcommonsettings.h"
66 #include "ui_dialogellipticalarc.h"
81 , flagRotationAngle(false)
82 , timerRadius1(nullptr)
83 , timerRadius2(nullptr)
86 , timerRotationAngle(nullptr)
92 , formulaBaseHeightRadius1(0)
93 , formulaBaseHeightRadius2(0)
94 , formulaBaseHeightF1(0)
95 , formulaBaseHeightF2(0)
96 , formulaBaseHeightRotationAngle(0)
99 , angleRotation(INT_MIN)
105 setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
106 setWindowIcon(QIcon(
":/toolicon/32x32/el_arc.png"));
116 ui->plainTextEditRadius1->installEventFilter(
this);
117 ui->plainTextEditRadius2->installEventFilter(
this);
118 ui->plainTextEditF1->installEventFilter(
this);
119 ui->plainTextEditF2->installEventFilter(
this);
120 ui->plainTextEditRotationAngle->installEventFilter(
this);
144 ui->lineType_ComboBox->removeItem(index);
147 index =
ui->lineColor_ComboBox->findData(
qApp->getCurrentDocument()->getDefaultLineColor());
150 ui->lineColor_ComboBox->setCurrentIndex(index);
153 index =
ui->lineWeight_ComboBox->findData(
qApp->getCurrentDocument()->getDefaultLineWeight());
156 ui->lineWeight_ComboBox->setCurrentIndex(index);
159 index =
ui->lineType_ComboBox->findData(
qApp->getCurrentDocument()->getDefaultLineType());
162 ui->lineType_ComboBox->setCurrentIndex(index);
177 connect(
ui->plainTextEditRotationAngle, &QPlainTextEdit::textChanged,
184 connect(
ui->pushButtonGrowLengthRotationAngle, &QPushButton::clicked,
229 vis->setObject1Id(value);
239 return qApp->TrVars()->TryFormulaFromUser(
radius1,
qApp->Settings()->GetOsSeparator());
249 radius1 =
qApp->TrVars()->FormulaToUser(value,
qApp->Settings()->GetOsSeparator());
255 ui->plainTextEditRadius1->setPlainText(
radius1);
271 return qApp->TrVars()->TryFormulaFromUser(
radius2,
qApp->Settings()->GetOsSeparator());
281 radius2 =
qApp->TrVars()->FormulaToUser(value,
qApp->Settings()->GetOsSeparator());
287 ui->plainTextEditRadius2->setPlainText(
radius2);
303 return qApp->TrVars()->TryFormulaFromUser(
f1,
qApp->Settings()->GetOsSeparator());
313 f1 =
qApp->TrVars()->FormulaToUser(value,
qApp->Settings()->GetOsSeparator());
315 if (
f1.length() > 80)
319 ui->plainTextEditF1->setPlainText(
f1);
335 return qApp->TrVars()->TryFormulaFromUser(
f2,
qApp->Settings()->GetOsSeparator());
345 f2 =
qApp->TrVars()->FormulaToUser(value,
qApp->Settings()->GetOsSeparator());
347 if (
f2.length() > 80)
351 ui->plainTextEditF2->setPlainText(
f2);
422 vis->setLineWeight(value);
452 const qreal radius_1 =
Eval(
ui->plainTextEditRadius1->toPlainText(),
flagRadius1,
ui->labelResultRadius1, postfix);
458 ui->labelResultRadius1->setText(tr(
"Error"));
459 ui->labelResultRadius1->setToolTip(tr(
"Radius can't be negative"));
465 const qreal radius_2 =
Eval(
ui->plainTextEditRadius2->toPlainText(),
flagRadius2,
ui->labelResultRadius2, postfix);
470 ui->labelResultRadius2->setText(tr(
"Error"));
471 ui->labelResultRadius2->setToolTip(tr(
"Radius can't be negative"));
499 if (
static_cast<int>(
angleF1) == INT_MIN ||
static_cast<int>(
angleF2) == INT_MIN)
508 ui->labelResultF1->setText(tr(
"Error"));
509 ui->labelResultF1->setToolTip(tr(
"Angles equal"));
513 ui->labelResultF2->setText(tr(
"Error"));
514 ui->labelResultF2->setToolTip(tr(
"Angles equal"));
524 dialog->setWindowTitle(tr(
"Edit radius1"));
527 if (dialog->exec() == QDialog::Accepted)
538 dialog->setWindowTitle(tr(
"Edit radius2"));
541 if (dialog->exec() == QDialog::Accepted)
552 dialog->setWindowTitle(tr(
"Edit first angle"));
555 if (dialog->exec() == QDialog::Accepted)
566 dialog->setWindowTitle(tr(
"Edit second angle"));
569 if (dialog->exec() == QDialog::Accepted)
580 dialog->setWindowTitle(tr(
"Edit rotation angle"));
583 if (dialog->exec() == QDialog::Accepted)
713 this->setModal(
true);
747 ui->name_LineEdit->setText(
qApp->TrVars()->VarToUser(arc.
name() +
"_" + QString().setNum(
m_Id)));
770 AddVisualization<VisToolEllipticalArc>();
776 radius1 =
ui->plainTextEditRadius1->toPlainText();
778 radius2 =
ui->plainTextEditRadius2->toPlainText();
780 f1 =
ui->plainTextEditF1->toPlainText();
781 f1.replace(
"\n",
" ");
782 f2 =
ui->plainTextEditF2->toPlainText();
783 f2.replace(
"\n",
" ");
802 ui->plainTextEditRadius1->blockSignals(
true);
803 ui->plainTextEditRadius2->blockSignals(
true);
804 ui->plainTextEditF1->blockSignals(
true);
805 ui->plainTextEditF2->blockSignals(
true);
806 ui->plainTextEditRotationAngle->blockSignals(
true);
816 const QTextCursor cursor = textEdit->textCursor();
818 setMaximumWidth(260);
819 textEdit->setFixedHeight(height);
820 pushButton->setIcon(QIcon::fromTheme(
"go-down", QIcon(
":/icons/win.icon.theme/16x16/actions/go-down.png")));
821 setUpdatesEnabled(
false);
823 setUpdatesEnabled(
true);
824 textEdit->setFocus();
825 textEdit->setTextCursor(cursor);
QString rotationAngle
rotationAngle formula of rotation angle
void DeployRadius1TextEdit()
DeployFormulaTextEdit grow or shrink formula input.
void collapseFormula(QPlainTextEdit *textEdit, QPushButton *pushButton, int height)
void SetRadius1(const QString &value)
SetRadius1 set formula of radius1.
void Radius1Changed()
Radius1Changed after change formula of radius1 calculate value and show result.
quint32 GetCenter() const
GetCenter return id of center point.
void SetF1(const QString &value)
SetF1 set formula first angle of elliptical arc.
void setPenStyle(const QString &value)
void SetCenter(const quint32 &value)
SetCenter set id of center point.
DialogEllipticalArc(const VContainer *data, const quint32 &toolId, QWidget *parent=nullptr)
DialogEllipticalArc create dialog.
virtual void CheckState() Q_DECL_FINAL
CheckState if all is right enable button ok.
void DeployRadius2TextEdit()
void SetRotationAngle(const QString &value)
SetRotationAngle set formula rotation angle of elliptical arc.
VEllipticalArc getArc() const
int formulaBaseHeightRotationAngle
void F1Changed()
F1Changed after change formula of first angle calculate value and show result.
QString radius2
radius2 formula of radius2
QString GetF2() const
GetF2 return formula second angle of elliptical arc.
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE
closeEvent handle when dialog cloded
void setArc(const VEllipticalArc &arc)
QTimer * timerRadius1
timerRadius1 timer of check formula of radius1
Ui::DialogEllipticalArc * ui
ui keeps information about user interface
int formulaBaseHeightRadius1
formulaBaseHeight base height defined by dialogui
void RotationAngleChanged()
RotationAngleChanged after change formula of rotation angle calculate value and show result.
QString GetRadius1() const
GetRadius1 return formula of radius1.
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE
ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
QString f2
f2 formula of second angle
QString getLineColor() const
GetColor return color of elliptical arc.
int formulaBaseHeightRadius2
QTimer * timerRotationAngle
timerRotationAngle timer of check formula of rotation angle
void SetF2(const QString &value)
SetF2 set formula second angle of elliptical arc.
void setLineWeight(const QString &value)
setLineWeight set weight of the lines
QString getLineWeight() const
getLineWeight return weight of the lines
QTimer * timerF2
timerF2 timer of check formula of second angle
void EvalAngles()
EvalAngles calculate value of angles.
bool flagRotationAngle
flagRotationAngle true if value of rotation angle is correct
QString f1
f1 formula of first angle
bool flagRadius1
flagRadius1 true if value of radius1 is correct
void Radius2Changed()
Radius2Changed after change formula of radius2 calculate value and show result.
bool flagF2
flagF2 true if value of second angle is correct
QString getPenStyle() const
virtual void ShowVisualization() Q_DECL_OVERRIDE
QTimer * timerF1
timerF1 timer of check formula of first angle
QString GetF1() const
GetF1 return formula first angle of elliptical arc.
void F2Changed()
F2Changed after change formula of second angle calculate value and show result.
QTimer * timerRadius2
timerRadius2 timer of check formula of radius2
QString GetRotationAngle() const
GetRotationAngle return formula rotation angle of elliptical arc.
virtual void SaveData() Q_DECL_OVERRIDE
SaveData Put dialog data in local variables.
void setLineColor(const QString &value)
setLineColor set color of elliptical arc
void EvalRadiuses()
EvalRadiuses calculate value of radiuses.
bool flagF1
flagF1 true if value of first angle is correct
virtual ~DialogEllipticalArc() Q_DECL_OVERRIDE
bool flagRadius2
flagRadius2 true if value of radius2 is correct
QString GetRadius2() const
GetRadius2 return formula of radius2.
QString radius1
radius1 formula of radius1
void SetRadius2(const QString &value)
SetRadius2 set formula of radius2.
void DeployRotationAngleTextEdit()
void SetDuplicate(quint32 number)
The VContainer class container of all variables.
static bool IsUnique(const QString &name)
const QSharedPointer< T > GeometricObject(const quint32 &id) const
virtual VPointF GetCenter() const Q_DECL_OVERRIDE
virtual QString name() const
name return name graphical object.
quint32 id() const
id return id object.
The VPointF class keep data of point.
void setObject1Id(const quint32 &value)
const QString degreeSymbol
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
static Q_REQUIRED_RESULT bool VFuzzyComparePossibleNulls(double p1, double p2)
const QString LineTypeSolidLine
const QString LineTypeNone