Seamly2D
Code documentation
dialogsplinepath.h
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * Copyright (C) 2017 Seamly, LLC *
4  * *
5  * https://github.com/fashionfreedom/seamly2d *
6  * *
7  ***************************************************************************
8  **
9  ** Seamly2D is free software: you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation, either version 3 of the License, or
12  ** (at your option) any later version.
13  **
14  ** Seamly2D is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** You should have received a copy of the GNU General Public License
20  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
21  **
22  **************************************************************************
23 
24  ************************************************************************
25  **
26  ** @file dialogsplinepath.h
27  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
28  ** @date November 15, 2013
29  **
30  ** @brief
31  ** @copyright
32  ** This source code is part of the Valentine project, a pattern making
33  ** program, whose allow create and modeling patterns of clothing.
34  ** Copyright (C) 2013-2015 Seamly2D project
35  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
36  **
37  ** Seamly2D is free software: you can redistribute it and/or modify
38  ** it under the terms of the GNU General Public License as published by
39  ** the Free Software Foundation, either version 3 of the License, or
40  ** (at your option) any later version.
41  **
42  ** Seamly2D is distributed in the hope that it will be useful,
43  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
44  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45  ** GNU General Public License for more details.
46  **
47  ** You should have received a copy of the GNU General Public License
48  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
49  **
50  *************************************************************************/
51 
52 #ifndef DIALOGSPLINEPATH_H
53 #define DIALOGSPLINEPATH_H
54 
55 #include <qcompilerdetection.h>
56 #include <QMetaObject>
57 #include <QObject>
58 #include <QSet>
59 #include <QString>
60 #include <QVector>
61 #include <QtGlobal>
62 
63 #include "../vgeometry/vsplinepath.h"
64 #include "../vmisc/def.h"
65 #include "dialogtool.h"
66 
67 namespace Ui
68 {
69  class DialogSplinePath;
70 }
71 
72 /**
73  * @brief The DialogSplinePath class dialog for ToolSplinePath. Help create spline path and edit option.
74  */
76 {
77  Q_OBJECT
78 public:
79  DialogSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
80  virtual ~DialogSplinePath() Q_DECL_OVERRIDE;
81 
82  VSplinePath GetPath() const;
83  void SetPath(const VSplinePath &value);
84 
85  QString getPenStyle() const;
86  void setPenStyle(const QString &value);
87 
88  QString getLineWeight() const;
89  void setLineWeight(const QString &value);
90 
91  QString getLineColor() const;
92  void setLineColor(const QString &value);
93 
94 public slots:
95  virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
96  virtual void ShowDialog(bool click) Q_DECL_OVERRIDE;
97  void PathUpdated(const VSplinePath &path);
98 
99 protected:
100  virtual void ShowVisualization() Q_DECL_OVERRIDE;
101  virtual void SaveData() Q_DECL_OVERRIDE;
102  virtual void CheckState() Q_DECL_FINAL;
103  virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
104 
105 private slots:
106  void PointChanged(int row);
107  void currentPointChanged(int index);
108 
109  void DeployAngle1TextEdit();
110  void DeployAngle2TextEdit();
111  void DeployLength1TextEdit();
112  void DeployLength2TextEdit();
113 
114  void Angle1Changed();
115  void Angle2Changed();
116  void Length1Changed();
117  void Length2Changed();
118 
119  void FXAngle1();
120  void FXAngle2();
121  void FXLength1();
122  void FXLength2();
123 
124 private:
125  Q_DISABLE_COPY(DialogSplinePath)
126 
127  /** @brief ui keeps information about user interface */
129 
130  /** @brief path spline path */
132 
133  qint32 newDuplicate;
134 
135  /** @brief formulaBaseHeight base height defined by dialogui */
140 
141  /** @brief flagAngle1 true if value of first angle is correct */
146 
147  void EvalAngle1();
148  void EvalAngle2();
149  void EvalLength1();
150  void EvalLength2();
151 
152  void NewItem(const VSplinePoint &point);
153  void DataPoint(const VSplinePoint &p);
154  void SavePath();
155  QSet<quint32> AllIds() const;
156  bool IsPathValid() const;
157  VSplinePath ExtractPath() const;
158  void ShowPointIssue(const QString &pName);
159  void collapseFormula(QPlainTextEdit *textEdit, QPushButton *pushButton, int height);
160 
161 };
162 
163 //---------------------------------------------------------------------------------------------------------------------
164 /**
165  * @brief GetPath return spline path
166  * @return path
167  */
169 {
170  return path;
171 }
172 
173 #endif // DIALOGSPLINEPATH_H
The DialogSplinePath class dialog for ToolSplinePath. Help create spline path and edit option.
QVector< bool > flagAngle2
QSet< quint32 > AllIds() const
QVector< bool > flagLength2
QVector< bool > flagAngle1
flagAngle1 true if value of first angle is correct
QString getPenStyle() const
virtual ~DialogSplinePath() Q_DECL_OVERRIDE
QVector< bool > flagLength1
Ui::DialogSplinePath * ui
ui keeps information about user interface
virtual void SaveData() Q_DECL_OVERRIDE
SaveData Put dialog data in local variables.
virtual void CheckState() Q_DECL_FINAL
CheckState enable, when all is correct, or disable, when something wrong, button ok.
void PointChanged(int row)
PointChanged selected another point in list.
void SetPath(const VSplinePath &value)
SetPath set spline path.
bool IsPathValid() const
void NewItem(const VSplinePoint &point)
NewItem add point to list.
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE
closeEvent handle when dialog cloded
void collapseFormula(QPlainTextEdit *textEdit, QPushButton *pushButton, int height)
void setPenStyle(const QString &value)
DialogSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent=nullptr)
DialogSplinePath create dialog.
void setLineColor(const QString &value)
QString getLineColor() const
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.
int formulaBaseHeightAngle1
formulaBaseHeight base height defined by dialogui
virtual void ShowDialog(bool click) Q_DECL_OVERRIDE
VSplinePath GetPath() const
GetPath return spline path.
void setLineWeight(const QString &value)
setLineWeight set weight of the lines
virtual void ShowVisualization() Q_DECL_OVERRIDE
void currentPointChanged(int index)
currentPointChanged changed point in combo box
void PathUpdated(const VSplinePath &path)
void ShowPointIssue(const QString &pName)
QString getLineWeight() const
getLineWeight return weight of the lines
void DataPoint(const VSplinePoint &p)
dataPoint show data of point in fields
VSplinePath path
path spline path
VSplinePath ExtractPath() const
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
The VSplinePath class keep information about splinePath.
Definition: vsplinepath.h:72
The VSplinePoint class keep information about point in spline path. Each point have two angles and tw...
Definition: vsplinepoint.h:108
SceneObject
Definition: def.h:103