Seamly2D
Code documentation
dialogellipticalarc.h
Go to the documentation of this file.
1 /******************************************************************************
2  * @file dialogellipticalarc.h
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  ** @file dialogellipticalarc.h
21  ** @author Valentina Zhuravska <zhuravska19(at)gmail.com>
22  ** @date 15 9, 2016
23  **
24  ** @brief
25  ** @copyright
26  ** This source code is part of the Valentine project, a pattern making
27  ** program, whose allow create and modeling patterns of clothing.
28  ** Copyright (C) 2016 Seamly2D project
29  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
30  **
31  ** Seamly2D is free software: you can redistribute it and/or modify
32  ** it under the terms of the GNU General Public License as published by
33  ** the Free Software Foundation, either version 3 of the License, or
34  ** (at your option) any later version.
35  **
36  ** Seamly2D is distributed in the hope that it will be useful,
37  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
38  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39  ** GNU General Public License for more details.
40  **
41  ** You should have received a copy of the GNU General Public License
42  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
43  **
44  *************************************************************************/
45 
46 #ifndef DIALOGELLIPTICALARC_H
47 #define DIALOGELLIPTICALARC_H
48 
49 #include <qcompilerdetection.h>
50 #include <QMetaObject>
51 #include <QObject>
52 #include <QString>
53 #include <QtGlobal>
54 
55 #include "../vgeometry/vellipticalarc.h"
56 #include "../vmisc/def.h"
57 #include "dialogtool.h"
58 
59 namespace Ui
60 {
61  class DialogEllipticalArc;
62 }
63 
65 {
66  Q_OBJECT
67 public:
68  DialogEllipticalArc(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
69  virtual ~DialogEllipticalArc() Q_DECL_OVERRIDE;
70 
71  VEllipticalArc getArc() const;
72  void setArc(const VEllipticalArc &arc);
73 
74  quint32 GetCenter() const;
75  void SetCenter(const quint32 &value);
76 
77  QString GetRadius1() const;
78  void SetRadius1(const QString &value);
79 
80  QString GetRadius2() const;
81  void SetRadius2(const QString &value);
82 
83  QString GetF1() const;
84  void SetF1(const QString &value);
85 
86  QString GetF2() const;
87  void SetF2(const QString &value);
88 
89  QString GetRotationAngle() const;
90  void SetRotationAngle(const QString &value);
91 
92  QString getPenStyle() const;
93  void setPenStyle(const QString &value);
94 
95  QString getLineWeight() const;
96  void setLineWeight(const QString &value);
97 
98  QString getLineColor() const;
99  void setLineColor(const QString &value);
100 
101 
102 public slots:
103  virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
104  /**
105  * @brief DeployFormulaTextEdit grow or shrink formula input
106  */
107  void DeployRadius1TextEdit();
108  void DeployRadius2TextEdit();
109  void DeployF1TextEdit();
110  void DeployF2TextEdit();
112 
113  void Radius1Changed();
114  void Radius2Changed();
115  void F1Changed();
116  void F2Changed();
117  void RotationAngleChanged();
118 
119  void FXRadius1();
120  void FXRadius2();
121  void FXF1();
122  void FXF2();
123  void FXRotationAngle();
124 
125 protected:
126  void pointNameChanged();
127  virtual void CheckState() Q_DECL_FINAL;
128  virtual void ShowVisualization() Q_DECL_OVERRIDE;
129  /**
130  * @brief SaveData Put dialog data in local variables
131  */
132  virtual void SaveData() Q_DECL_OVERRIDE;
133  virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
134 
135 private:
136  Q_DISABLE_COPY(DialogEllipticalArc)
137 
138  /** @brief ui keeps information about user interface */
140 
141  /** @brief flagRadius1 true if value of radius1 is correct */
143 
144  /** @brief flagRadius2 true if value of radius2 is correct */
146 
147  /** @brief flagF1 true if value of first angle is correct */
148  bool flagF1;
149 
150  /** @brief flagF2 true if value of second angle is correct */
151  bool flagF2;
152 
153  /** @brief flagRotationAngle true if value of rotation angle is correct */
155 
156  /** @brief timerRadius1 timer of check formula of radius1 */
157  QTimer *timerRadius1;
158 
159  /** @brief timerRadius2 timer of check formula of radius2 */
160  QTimer *timerRadius2;
161 
162  /** @brief timerF1 timer of check formula of first angle */
163  QTimer *timerF1;
164 
165  /** @brief timerF2 timer of check formula of second angle */
166  QTimer *timerF2;
167 
168  /** @brief timerRotationAngle timer of check formula of rotation angle */
170 
171  /** @brief radius1 formula of radius1 */
172  QString radius1;
173 
174  /** @brief radius2 formula of radius2 */
175  QString radius2;
176 
177  /** @brief f1 formula of first angle */
178  QString f1;
179 
180  /** @brief f2 formula of second angle */
181  QString f2;
182 
183  /** @brief rotationAngle formula of rotation angle */
184  QString rotationAngle;
185 
186  /** @brief formulaBaseHeight base height defined by dialogui */
192 
193  qreal angleF1;
194  qreal angleF2;
197  qint32 m_Id;
198  qint32 newDuplicate;
199 
200  void EvalRadiuses();
201  void EvalAngles();
202  void CheckAngles();
203  void collapseFormula(QPlainTextEdit *textEdit, QPushButton *pushButton, int height);
204 };
205 
206 #endif // DIALOGELLIPTICALARC_H
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 SetRotationAngle(const QString &value)
SetRotationAngle set formula rotation angle of elliptical arc.
VEllipticalArc getArc() const
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.
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
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.
The DialogTool class parent for all dialog of tools.
Definition: dialogtool.h:107
quint32 toolId
Definition: dialogtool.h:225
const VContainer * data
data container with data
Definition: dialogtool.h:177
The VContainer class container of all variables.
Definition: vcontainer.h:141
SceneObject
Definition: def.h:103