Seamly2D
Code documentation
dialogarc.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  * @file dialogarc.cpp
3  ** @author Douglas S Caskey
4  ** @date 21 Mar, 2023
5  **
6  ** @brief
7  ** @copyright
8  ** This source code is part of the Seamly2D project, a pattern making
9  ** program to create and model patterns of clothing.
10  ** Copyright (C) 2017-2023 Seamly2D project
11  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
12  **
13  ** Seamly2D is free software: you can redistribute it and/or modify
14  ** You should have received a copy of the GNU General Public License
15  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
16  **
17  *****************************************************************************/
18 
19 /************************************************************************
20  **
21  ** @file dialogarc.cpp
22  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
23  ** @date November 15, 2013
24  **
25  ** @brief
26  ** @copyright
27  ** This source code is part of the Valentine project, a pattern making
28  ** program, whose allow create and modeling patterns of clothing.
29  ** Copyright (C) 2013-2015 Seamly2D project
30  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
31  **
32  ** Seamly2D is free software: you can redistribute it and/or modify
33  ** it under the terms of the GNU General Public License as published by
34  ** the Free Software Foundation, either version 3 of the License, or
35  ** (at your option) any later version.
36  **
37  ** Seamly2D is distributed in the hope that it will be useful,
38  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
39  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40  ** GNU General Public License for more details.
41  **
42  ** You should have received a copy of the GNU General Public License
43  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
44  **
45  *************************************************************************/
46 
47 #include "dialogarc.h"
48 
49 #include <limits.h>
50 #include <QDialog>
51 #include <QLabel>
52 #include <QPlainTextEdit>
53 #include <QPointer>
54 #include <QPushButton>
55 #include <QTimer>
56 #include <QToolButton>
57 #include <Qt>
58 
59 #include "../ifc/xml/vdomdocument.h"
60 #include "../vgeometry/vpointf.h"
61 
62 #include "../vpatterndb/vcontainer.h"
63 #include "../vpatterndb/vtranslatevars.h"
64 #include "../../visualization/path/vistoolarc.h"
65 #include "../../visualization/visualization.h"
66 #include "../support/edit_formula_dialog.h"
67 #include "../vmisc/vabstractapplication.h"
68 #include "../vmisc/vcommonsettings.h"
69 #include "ui_dialogarc.h"
70 
71 //---------------------------------------------------------------------------------------------------------------------
72 /**
73  * @brief DialogArc create dialog
74  * @param data container with data
75  * @param parent parent widget
76  */
77 DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
78  : DialogTool(data, toolId, parent)
79  , ui(new Ui::DialogArc)
80  , flagRadius(false)
81  , flagF1(false)
82  , flagF2(false)
83  , timerRadius(nullptr)
84  , timerF1(nullptr)
85  , timerF2(nullptr)
86  , radius(QString())
87  , f1(QString())
88  , f2(QString())
89  , formulaBaseHeight(0)
90  , formulaBaseHeightF1(0)
91  , formulaBaseHeightF2(0)
92  , angleF1(INT_MIN)
93  , angleF2(INT_MIN)
94  , m_arc()
95  , m_Id()
96  , newDuplicate(-1)
97 {
98  ui->setupUi(this);
99  setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
100  setWindowIcon(QIcon(":/toolicon/32x32/arc.png"));
101 
102  m_Id = data->getId();
103  plainTextEditFormula = ui->plainTextEditFormula;
104  this->formulaBaseHeight = ui->plainTextEditFormula->height();
105  this->formulaBaseHeightF1 = ui->plainTextEditF1->height();
106  this->formulaBaseHeightF2 = ui->plainTextEditF2->height();
107 
108  ui->plainTextEditFormula->installEventFilter(this);
109  ui->plainTextEditF1->installEventFilter(this);
110  ui->plainTextEditF2->installEventFilter(this);
111 
112  timerRadius = new QTimer(this);
113  connect(timerRadius, &QTimer::timeout, this, &DialogArc::EvalRadius);
114 
115  timerF1 = new QTimer(this);
116  connect(timerF1, &QTimer::timeout, this, &DialogArc::EvalF);
117 
118  timerF2 = new QTimer(this);
119  connect(timerF2, &QTimer::timeout, this, &DialogArc::EvalF);
120 
122 
123  FillComboBoxPoints(ui->centerPoint_ComboBox);
124 
125  int index = ui->lineType_ComboBox->findData(LineTypeNone);
126  if (index != -1)
127  {
128  ui->lineType_ComboBox->removeItem(index);
129  }
130 
131  index = ui->lineColor_ComboBox->findData(qApp->getCurrentDocument()->getDefaultLineColor());
132  if (index != -1)
133  {
134  ui->lineColor_ComboBox->setCurrentIndex(index);
135  }
136 
137  index = ui->lineWeight_ComboBox->findData(qApp->getCurrentDocument()->getDefaultLineWeight());
138  if (index != -1)
139  {
140  ui->lineWeight_ComboBox->setCurrentIndex(index);
141  }
142 
143  index = ui->lineType_ComboBox->findData(qApp->getCurrentDocument()->getDefaultLineType());
144  if (index != -1)
145  {
146  ui->lineType_ComboBox->setCurrentIndex(index);
147  }
148 
149  CheckState();
150 
151  connect(ui->toolButtonExprRadius, &QPushButton::clicked, this, &DialogArc::FXRadius);
152  connect(ui->toolButtonExprF1, &QPushButton::clicked, this, &DialogArc::FXF1);
153  connect(ui->toolButtonExprF2, &QPushButton::clicked, this, &DialogArc::FXF2);
154 
155  connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogArc::RadiusChanged);
156  connect(ui->plainTextEditF1, &QPlainTextEdit::textChanged, this, &DialogArc::F1Changed);
157  connect(ui->plainTextEditF2, &QPlainTextEdit::textChanged, this, &DialogArc::F2Changed);
158 
159  connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogArc::DeployFormulaTextEdit);
160  connect(ui->pushButtonGrowLengthF1, &QPushButton::clicked, this, &DialogArc::DeployF1TextEdit);
161  connect(ui->pushButtonGrowLengthF2, &QPushButton::clicked, this, &DialogArc::DeployF2TextEdit);
162 
163  connect(ui->centerPoint_ComboBox, &QComboBox::currentTextChanged, this, &DialogArc::pointNameChanged);
164 
165  vis = new VisToolArc(data);
166 }
167 
168 //---------------------------------------------------------------------------------------------------------------------
170 {
171  DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
172 }
173 
174 //---------------------------------------------------------------------------------------------------------------------
176 {
177  DeployFormula(ui->plainTextEditF1, ui->pushButtonGrowLengthF1, formulaBaseHeightF1);
178 }
179 
180 //---------------------------------------------------------------------------------------------------------------------
182 {
183  DeployFormula(ui->plainTextEditF2, ui->pushButtonGrowLengthF2, formulaBaseHeightF2);
184 }
185 
186 //---------------------------------------------------------------------------------------------------------------------
188 {
189  delete ui;
190 }
191 
192 //---------------------------------------------------------------------------------------------------------------------
194 {
195  return m_arc;
196 }
197 
198 //---------------------------------------------------------------------------------------------------------------------
199 void DialogArc::setArc(const VArc &arc)
200 {
201  m_arc = arc;
202  ui->name_LineEdit->setText(qApp->TrVars()->VarToUser(m_arc.name()));
203 }
204 
205 //---------------------------------------------------------------------------------------------------------------------
206 /**
207  * @brief setCenter set id of center point
208  * @param value id
209  */
210 void DialogArc::setCenter(const quint32 &value)
211 {
212  ChangeCurrentData(ui->centerPoint_ComboBox, value);
213  vis->setObject1Id(value);
214 }
215 
216 //---------------------------------------------------------------------------------------------------------------------
217 /**
218  * @brief setF2 set formula second angle of arc
219  * @param value formula
220  */
221 void DialogArc::setF2(const QString &value)
222 {
223  f2 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
224  // increase height if needed.
225  if (f2.length() > 80)
226  {
227  this->DeployF2TextEdit();
228  }
229  ui->plainTextEditF2->setPlainText(f2);
230 
231  VisToolArc *path = qobject_cast<VisToolArc *>(vis);
232  SCASSERT(path != nullptr)
233  path->setF2(f2);
234 
235  MoveCursorToEnd(ui->plainTextEditF2);
236 }
237 
238 //---------------------------------------------------------------------------------------------------------------------
239 QString DialogArc::getPenStyle() const
240 {
241  return GetComboBoxCurrentData(ui->lineType_ComboBox, LineTypeSolidLine);
242 }
243 
244 //---------------------------------------------------------------------------------------------------------------------
245 void DialogArc::setPenStyle(const QString &value)
246 {
247  ChangeCurrentData(ui->lineType_ComboBox, value);
248 }
249 
250 //---------------------------------------------------------------------------------------------------------------------
251 /**
252  * @brief getLineWeight return weight of the lines
253  * @return type
254  */
256 {
257  return GetComboBoxCurrentData(ui->lineWeight_ComboBox, "0.35");
258 }
259 
260 //---------------------------------------------------------------------------------------------------------------------
261 /**
262  * @brief setLineWeight set weight of the lines
263  * @param value type
264  */
265 void DialogArc::setLineWeight(const QString &value)
266 {
267  ChangeCurrentData(ui->lineWeight_ComboBox, value);
268 }
269 
270 //---------------------------------------------------------------------------------------------------------------------
271 QString DialogArc::getLineColor() const
272 {
273  return GetComboBoxCurrentData(ui->lineColor_ComboBox, ColorBlack);
274 }
275 
276 //---------------------------------------------------------------------------------------------------------------------
277 void DialogArc::setLineColor(const QString &value)
278 {
279  ChangeCurrentData(ui->lineColor_ComboBox, value);
280 }
281 
282 //---------------------------------------------------------------------------------------------------------------------
283 /**
284  * @brief setF1 set formula first angle of arc
285  * @param value formula
286  */
287 void DialogArc::setF1(const QString &value)
288 {
289  f1 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
290  // increase height if needed.
291  if (f1.length() > 80)
292  {
293  this->DeployF1TextEdit();
294  }
295  ui->plainTextEditF1->setPlainText(f1);
296 
297  VisToolArc *path = qobject_cast<VisToolArc *>(vis);
298  SCASSERT(path != nullptr)
299  path->setF1(f1);
300 
301  MoveCursorToEnd(ui->plainTextEditF1);
302 }
303 
304 //---------------------------------------------------------------------------------------------------------------------
305 /**
306  * @brief setRadius set formula of radius
307  * @param value formula
308  */
309 void DialogArc::setRadius(const QString &value)
310 {
311  radius = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
312  // increase height if needed.
313  if (radius.length() > 80)
314  {
315  this->DeployFormulaTextEdit();
316  }
317  ui->plainTextEditFormula->setPlainText(radius);
318 
319  VisToolArc *path = qobject_cast<VisToolArc *>(vis);
320  SCASSERT(path != nullptr)
321  path->setRadius(radius);
322 
323  MoveCursorToEnd(ui->plainTextEditFormula);
324 }
325 
326 //---------------------------------------------------------------------------------------------------------------------
327 /**
328  * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
329  * @param id id of point or detail
330  * @param type type of object
331  */
332 void DialogArc::ChosenObject(quint32 id, const SceneObject &type)
333 {
334  if (prepare == false)// After first choose we ignore all objects
335  {
336  if (type == SceneObject::Point)
337  {
338  if (SetObject(id, ui->centerPoint_ComboBox, ""))
339  {
340  vis->VisualMode(id);
341  prepare = true;
342  this->setModal(true);
343  this->show();
344  }
345  }
346  }
347 }
348 
349 //---------------------------------------------------------------------------------------------------------------------
351 {
352  AddVisualization<VisToolArc>();
353 }
354 
355 //---------------------------------------------------------------------------------------------------------------------
357 {
358  radius = ui->plainTextEditFormula->toPlainText();
359  radius.replace("\n", " ");
360  f1 = ui->plainTextEditF1->toPlainText();
361  f1.replace("\n", " ");
362  f2 = ui->plainTextEditF2->toPlainText();
363  f2.replace("\n", " ");
364 
365  VisToolArc *path = qobject_cast<VisToolArc *>(vis);
366  SCASSERT(path != nullptr)
367 
368  path->setObject1Id(getCenter());
369  path->setRadius(radius);
370  path->setF1(f1);
371  path->setF2(f2);
372  path->RefreshGeometry();
373 }
374 
375 //---------------------------------------------------------------------------------------------------------------------
376 void DialogArc::closeEvent(QCloseEvent *event)
377 {
378  ui->plainTextEditFormula->blockSignals(true);
379  ui->plainTextEditF1->blockSignals(true);
380  ui->plainTextEditF2->blockSignals(true);
381  DialogTool::closeEvent(event);
382 }
383 
384 //---------------------------------------------------------------------------------------------------------------------
385 /**
386  * @brief RadiusChanged after change formula of radius calculate value and show result
387  */
389 {
390  labelEditFormula = ui->labelEditRadius;
391  labelResultCalculation = ui->labelResultRadius;
392  const QString postfix = UnitsToStr(qApp->patternUnit(), true);
393  ValFormulaChanged(flagRadius, ui->plainTextEditFormula, timerRadius, postfix);
394 }
395 
396 //---------------------------------------------------------------------------------------------------------------------
397 /**
398  * @brief F1Changed after change formula of first angle calculate value and show result
399  */
401 {
402  labelEditFormula = ui->labelEditF1;
403  labelResultCalculation = ui->labelResultF1;
404  ValFormulaChanged(flagF1, ui->plainTextEditF1, timerF1, degreeSymbol);
405 }
406 
407 //---------------------------------------------------------------------------------------------------------------------
408 /**
409  * @brief F2Changed after change formula of second angle calculate value and show result
410  */
412 {
413  labelEditFormula = ui->labelEditF2;
414  labelResultCalculation = ui->labelResultF2;
415  ValFormulaChanged(flagF2, ui->plainTextEditF2, timerF2, degreeSymbol);
416 }
417 
418 //---------------------------------------------------------------------------------------------------------------------
420 {
421  EditFormulaDialog *dialog = new EditFormulaDialog(data, toolId, this);
422  dialog->setWindowTitle(tr("Edit radius"));
423  dialog->SetFormula(getRadius());
424  dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
425  if (dialog->exec() == QDialog::Accepted)
426  {
427  setRadius(dialog->GetFormula());
428  }
429  delete dialog;
430 }
431 
432 //---------------------------------------------------------------------------------------------------------------------
434 {
435  EditFormulaDialog *dialog = new EditFormulaDialog(data, toolId, this);
436  dialog->setWindowTitle(tr("Edit first angle"));
437  dialog->SetFormula(getF1());
438  dialog->setPostfix(degreeSymbol);
439  if (dialog->exec() == QDialog::Accepted)
440  {
441  setF1(dialog->GetFormula());
442  }
443  delete dialog;
444 }
445 
446 //---------------------------------------------------------------------------------------------------------------------
448 {
449  EditFormulaDialog *dialog = new EditFormulaDialog(data, toolId, this);
450  dialog->setWindowTitle(tr("Edit second angle"));
451  dialog->SetFormula(getF2());
452  dialog->setPostfix(degreeSymbol);
453  if (dialog->exec() == QDialog::Accepted)
454  {
455  setF2(dialog->GetFormula());
456  }
457  delete dialog;
458 }
459 
460 //---------------------------------------------------------------------------------------------------------------------
462 {
463  QColor color = okColor;
464 
465  flagError = true;
466  color = okColor;
467 
468  if (getCurrentObjectId(ui->centerPoint_ComboBox) == m_arc.GetCenter().id())
469  {
470  newDuplicate = -1;
471  ui->name_LineEdit->setText(qApp->TrVars()->VarToUser(m_arc.name()));
472  }
473  else
474  {
475  VArc arc(*data->GeometricObject<VPointF>(getCurrentObjectId(ui->centerPoint_ComboBox)),
476  getRadius().toDouble(),
477  getF1().toDouble(),
478  getF2().toDouble());
479 
480  if (!data->IsUnique(arc.name()))
481  {
482  newDuplicate = static_cast<qint32>(DNumber(arc.name()));
483  arc.SetDuplicate(static_cast<quint32>(newDuplicate));
484  }
485  if (m_arc.id() == NULL_ID)
486  {
487  ui->name_LineEdit->setText(qApp->TrVars()->VarToUser(arc.name() + "_" + QString().setNum(m_Id + 1)));
488  }
489  else
490  {
491  ui->name_LineEdit->setText(qApp->TrVars()->VarToUser(arc.name() + "_" + QString().setNum(m_arc.id())));
492  }
493  }
494 
495  ChangeColor(ui->name_Label, color);
496  ChangeColor(ui->centerPoint_Label, color);
497  CheckState();
498 }
499 
500 //---------------------------------------------------------------------------------------------------------------------
501 /**
502  * @brief CheckState if all is right enable button ok
503  */
505 {
506  SCASSERT(ok_Button != nullptr)
507  ok_Button->setEnabled(flagRadius && flagF1 && flagF2);
508  SCASSERT(apply_Button != nullptr)
509  apply_Button->setEnabled(flagRadius && flagF1 && flagF2);
510 }
511 
512 //---------------------------------------------------------------------------------------------------------------------
513 /**
514  * @brief EvalRadius calculate value of radius
515  */
517 {
518  labelEditFormula = ui->labelEditRadius;
519  const QString postfix = UnitsToStr(qApp->patternUnit(), true);
520  const qreal radius = Eval(ui->plainTextEditFormula->toPlainText(), flagRadius, ui->labelResultRadius, postfix);
521 
522  if (radius < 0)
523  {
524  flagRadius = false;
525  ChangeColor(labelEditFormula, Qt::red);
526  ui->labelResultRadius->setText(tr("Error"));
527  ui->labelResultRadius->setToolTip(tr("Radius can't be negative"));
528 
530  }
531 }
532 
533 //---------------------------------------------------------------------------------------------------------------------
534 /**
535  * @brief EvalF1 calculate value of angle
536  */
538 {
539  labelEditFormula = ui->labelEditF1;
540  angleF1 = Eval(ui->plainTextEditF1->toPlainText(), flagF1, ui->labelResultF1, degreeSymbol, false);
541 
542  labelEditFormula = ui->labelEditF2;
543  angleF2 = Eval(ui->plainTextEditF2->toPlainText(), flagF2, ui->labelResultF2, degreeSymbol, false);
544 
545  CheckAngles();
546 }
547 
548 //---------------------------------------------------------------------------------------------------------------------
550 {
551  if (static_cast<int>(angleF1) == INT_MIN || static_cast<int>(angleF2) == INT_MIN)
552  {
553  return;
554  }
555 
557  {
558  flagF1 = false;
559  ChangeColor(ui->labelEditF1, Qt::red);
560  ui->labelResultF1->setText(tr("Error"));
561  ui->labelResultF1->setToolTip(tr("Angles equal"));
562 
563  flagF2 = false;
564  ChangeColor(ui->labelEditF2, Qt::red);
565  ui->labelResultF2->setText(tr("Error"));
566  ui->labelResultF2->setToolTip(tr("Angles equal"));
567  }
568 
570 }
571 
572 //---------------------------------------------------------------------------------------------------------------------
573 /**
574  * @brief getCenter return id of center point
575  * @return id id
576  */
577 quint32 DialogArc::getCenter() const
578 {
579  return getCurrentObjectId(ui->centerPoint_ComboBox);
580 }
581 
582 //---------------------------------------------------------------------------------------------------------------------
583 /**
584  * @brief getRadius return formula of radius
585  * @return formula
586  */
587 QString DialogArc::getRadius() const
588 {
589  return qApp->TrVars()->TryFormulaFromUser(radius, qApp->Settings()->GetOsSeparator());
590 }
591 
592 //---------------------------------------------------------------------------------------------------------------------
593 /**
594  * @brief getF1 return formula first angle of arc
595  * @return formula
596  */
597 QString DialogArc::getF1() const
598 {
599  return qApp->TrVars()->TryFormulaFromUser(f1, qApp->Settings()->GetOsSeparator());
600 }
601 
602 //---------------------------------------------------------------------------------------------------------------------
603 /**
604  * @brief getF2 return formula second angle of arc
605  * @return formula
606  */
607 QString DialogArc::getF2() const
608 {
609  return qApp->TrVars()->TryFormulaFromUser(f2, qApp->Settings()->GetOsSeparator());
610 }
The DialogArc class dialog for ToolArc. Help create arc and edit option.
Definition: dialogarc.h:69
QString getLineWeight() const
getLineWeight return weight of the lines
Definition: dialogarc.cpp:255
QString f1
f1 formula of first angle
Definition: dialogarc.h:153
VArc getArc() const
Definition: dialogarc.cpp:193
bool flagF2
flagF2 true if value of second angle is correct
Definition: dialogarc.h:138
void pointNameChanged()
Definition: dialogarc.cpp:461
void EvalF()
EvalF1 calculate value of angle.
Definition: dialogarc.cpp:537
void setLineColor(const QString &value)
Definition: dialogarc.cpp:277
QString getRadius() const
getRadius return formula of radius
Definition: dialogarc.cpp:587
QString getF1() const
getF1 return formula first angle of arc
Definition: dialogarc.cpp:597
bool flagRadius
flagRadius true if value of radius is correct
Definition: dialogarc.h:132
Ui::DialogArc * ui
ui keeps information about user interface
Definition: dialogarc.h:129
void setF1(const QString &value)
setF1 set formula first angle of arc
Definition: dialogarc.cpp:287
void FXF2()
Definition: dialogarc.cpp:447
QString getLineColor() const
Definition: dialogarc.cpp:271
void EvalRadius()
EvalRadius calculate value of radius.
Definition: dialogarc.cpp:516
virtual ~DialogArc() Q_DECL_OVERRIDE
Definition: dialogarc.cpp:187
qint32 m_Id
Definition: dialogarc.h:166
QString getPenStyle() const
Definition: dialogarc.cpp:239
void DeployF1TextEdit()
Definition: dialogarc.cpp:175
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE
closeEvent handle when dialog cloded
Definition: dialogarc.cpp:376
virtual void SaveData() Q_DECL_OVERRIDE
SaveData Put dialog data in local variables.
Definition: dialogarc.cpp:356
bool flagF1
flagF1 true if value of first angle is correct
Definition: dialogarc.h:135
void setPenStyle(const QString &value)
Definition: dialogarc.cpp:245
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.
Definition: dialogarc.cpp:332
quint32 getCenter() const
getCenter return id of center point
Definition: dialogarc.cpp:577
void FXRadius()
Definition: dialogarc.cpp:419
void DeployF2TextEdit()
Definition: dialogarc.cpp:181
void FXF1()
Definition: dialogarc.cpp:433
VArc m_arc
Definition: dialogarc.h:165
void setF2(const QString &value)
setF2 set formula second angle of arc
Definition: dialogarc.cpp:221
void F2Changed()
F2Changed after change formula of second angle calculate value and show result.
Definition: dialogarc.cpp:411
void setRadius(const QString &value)
setRadius set formula of radius
Definition: dialogarc.cpp:309
DialogArc(const VContainer *data, const quint32 &toolId, QWidget *parent=nullptr)
DialogArc create dialog.
Definition: dialogarc.cpp:77
qreal angleF2
Definition: dialogarc.h:164
int formulaBaseHeightF2
Definition: dialogarc.h:161
QTimer * timerF1
timerF1 timer of check formula of first angle
Definition: dialogarc.h:144
void setArc(const VArc &arc)
Definition: dialogarc.cpp:199
virtual void ShowVisualization() Q_DECL_OVERRIDE
Definition: dialogarc.cpp:350
void setLineWeight(const QString &value)
setLineWeight set weight of the lines
Definition: dialogarc.cpp:265
QTimer * timerF2
timerF2 timer of check formula of second angle
Definition: dialogarc.h:147
QTimer * timerRadius
timerRadius timer of check formula of radius
Definition: dialogarc.h:141
void F1Changed()
F1Changed after change formula of first angle calculate value and show result.
Definition: dialogarc.cpp:400
qint32 newDuplicate
Definition: dialogarc.h:167
int formulaBaseHeight
formulaBaseHeight base height defined by dialogui
Definition: dialogarc.h:159
void RadiusChanged()
RadiusChanged after change formula of radius calculate value and show result.
Definition: dialogarc.cpp:388
virtual void CheckState() Q_DECL_FINAL
CheckState if all is right enable button ok.
Definition: dialogarc.cpp:504
void setCenter(const quint32 &value)
setCenter set id of center point
Definition: dialogarc.cpp:210
void DeployFormulaTextEdit()
DeployFormulaTextEdit grow or shrink formula input.
Definition: dialogarc.cpp:169
QString radius
radius formula of radius
Definition: dialogarc.h:150
void CheckAngles()
Definition: dialogarc.cpp:549
int formulaBaseHeightF1
Definition: dialogarc.h:160
qreal angleF1
Definition: dialogarc.h:163
QString f2
f2 formula of second angle
Definition: dialogarc.h:156
QString getF2() const
getF2 return formula second angle of arc
Definition: dialogarc.cpp:607
The DialogTool class parent for all dialog of tools.
Definition: dialogtool.h:107
void ChangeCurrentData(QComboBox *box, const QVariant &value) const
ChangeCurrentData select item in combobox by id.
Definition: dialogtool.cpp:419
quint32 DNumber(const QString &baseName) const
Definition: dialogtool.cpp:476
const QColor okColor
Definition: dialogtool.h:219
void FillComboBoxPoints(QComboBox *box, FillComboBox rule=FillComboBox::Whole, const quint32 &ch1=NULL_ID, const quint32 &ch2=NULL_ID) const
FillComboBoxPoints fill comboBox list of points.
Definition: dialogtool.cpp:242
void MoveCursorToEnd(QPlainTextEdit *plainTextEdit) const
Definition: dialogtool.cpp:432
QPushButton * ok_Button
ok_Button button ok
Definition: dialogtool.h:199
qreal Eval(const QString &text, bool &flag, QLabel *label, const QString &postfix, bool checkZero=true, bool checkLessThanZero=false)
Eval evaluate formula and show result.
Definition: dialogtool.cpp:805
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE
closeEvent handle when dialog cloded
Definition: dialogtool.cpp:192
void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer, const QString &postfix=QString())
ValFormulaChanged handle change formula.
Definition: dialogtool.cpp:744
bool SetObject(const quint32 &id, QComboBox *box, const QString &toolTip)
Definition: dialogtool.cpp:974
QPushButton * apply_Button
apply_Button button apply
Definition: dialogtool.h:202
quint32 toolId
Definition: dialogtool.h:225
QLabel * labelEditFormula
labelEditFormula label used when need show wrong formula
Definition: dialogtool.h:217
void initializeOkCancelApply(T *ui)
initializeOkCancelApply initialize OK / Cancel and Apply buttons
Definition: dialogtool.h:365
bool flagError
flagError use this flag if for you do not enought
Definition: dialogtool.h:193
const VContainer * data
data container with data
Definition: dialogtool.h:177
QPlainTextEdit * plainTextEditFormula
plainTextEditFormula formula
Definition: dialogtool.h:208
QString GetComboBoxCurrentData(const QComboBox *box, const QString &def) const
Definition: dialogtool.cpp:400
bool prepare
prepare show if we prepare. Show dialog after finish working with visual part of tool
Definition: dialogtool.h:228
QLabel * labelResultCalculation
labelResultCalculation label with result of calculation
Definition: dialogtool.h:211
QPointer< Visualization > vis
Definition: dialogtool.h:236
void ChangeColor(QWidget *widget, const QColor &color)
void DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight)
Definition: dialogtool.cpp:992
quint32 getCurrentObjectId(QComboBox *box) const
getCurrentPointId return current point id stored in combobox
Definition: dialogtool.cpp:959
The EditFormulaDialog class dialog for editing wrong formula.
QString GetFormula() const
void SetFormula(const QString &value)
void setPostfix(const QString &value)
virtual VPointF GetCenter() const
void SetDuplicate(quint32 number)
VArc class for anticlockwise arc.
Definition: varc.h:74
The VContainer class container of all variables.
Definition: vcontainer.h:141
static bool IsUnique(const QString &name)
Definition: vcontainer.cpp:585
static quint32 getId()
Definition: vcontainer.cpp:241
const QSharedPointer< T > GeometricObject(const quint32 &id) const
Definition: vcontainer.h:266
virtual QString name() const
name return name graphical object.
Definition: vgobject.cpp:148
quint32 id() const
id return id object.
Definition: vgobject.cpp:205
The VPointF class keep data of point.
Definition: vpointf.h:75
void setRadius(const QString &expression)
Definition: vistoolarc.cpp:93
virtual void RefreshGeometry() Q_DECL_OVERRIDE
Definition: vistoolarc.cpp:77
void setF2(const QString &expression)
Definition: vistoolarc.cpp:105
void setF1(const QString &expression)
Definition: vistoolarc.cpp:99
void setObject1Id(const quint32 &value)
const QString degreeSymbol
Definition: def.cpp:196
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
Definition: def.cpp:702
#define SCASSERT(cond)
Definition: def.h:317
static Q_REQUIRED_RESULT bool VFuzzyComparePossibleNulls(double p1, double p2)
Definition: def.h:490
SceneObject
Definition: def.h:103
const QString LineTypeSolidLine
Definition: ifcdef.cpp:159
const QString ColorBlack
Definition: ifcdef.cpp:373
const QString LineTypeNone
Definition: ifcdef.cpp:158
#define NULL_ID
Definition: ifcdef.h:76
#define qApp
Definition: vapplication.h:67