1 /************************************************************************
2  **
3  **  @file   dialogpointfromcircleandtangent.h
4  **  @author Roman Telezhynskyi <dismine(at)gmail.com>
5  **  @date   3 6, 2015
6  **
7  **  @brief
8  **  @copyright
9  **  This source code is part of the Valentina project, a pattern making
10  **  program, whose allow create and modeling patterns of clothing.
11  **  Copyright (C) 2015 Valentina project
12  **  <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
13  **
14  **  Valentina is free software: you can redistribute it and/or modify
15  **  it under the terms of the GNU General Public License as published by
16  **  the Free Software Foundation, either version 3 of the License, or
17  **  (at your option) any later version.
18  **
19  **  Valentina is distributed in the hope that it will be useful,
20  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  **  GNU General Public License for more details.
23  **
24  **  You should have received a copy of the GNU General Public License
25  **  along with Valentina.  If not, see <http://www.gnu.org/licenses/>.
26  **
27  *************************************************************************/
28 
29 #ifndef DIALOGPOINTFROMCIRCLEANDTANGENT_H
30 #define DIALOGPOINTFROMCIRCLEANDTANGENT_H
31 
32 #include <qcompilerdetection.h>
33 #include <QMetaObject>
34 #include <QObject>
35 #include <QString>
36 #include <QtGlobal>
37 
38 #include "../ifc/xml/vabstractpattern.h"
39 #include "../vmisc/def.h"
40 #include "dialogtool.h"
41 
42 namespace Ui
43 {
44     class DialogPointFromCircleAndTangent;
45 }
46 
47 class DialogPointFromCircleAndTangent : public DialogTool
48 {
49     Q_OBJECT
50 
51 public:
52     DialogPointFromCircleAndTangent(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
53     ~DialogPointFromCircleAndTangent();
54 
55     QString        GetPointName() const;
56     void           SetPointName(const QString &value);
57 
58     quint32        GetCircleCenterId() const;
59     void           SetCircleCenterId(const quint32 &value);
60 
61     QString        GetCircleRadius() const;
62     void           SetCircleRadius(const QString &value);
63 
64     quint32        GetTangentPointId() const;
65     void           SetTangentPointId(const quint32 &value);
66 
67     CrossCirclesPoint GetCrossCirclesPoint() const;
68     void              SetCrossCirclesPoint(const CrossCirclesPoint &p);
69 
70     void    SetNotes(const QString &notes);
71     QString GetNotes() const;
72 
73 public slots:
74     virtual void   ChosenObject(quint32 id, const SceneObject &type) override;
75     void           PointChanged();
76 
77     void           DeployCircleRadiusTextEdit();
78     void           FXCircleRadius();
79     void           EvalCircleRadius();
80 
81 protected:
82     virtual void   ShowVisualization() override;
83     /**
84      * @brief SaveData Put dialog data in local variables
85      */
86     virtual void   SaveData() override;
87     virtual void   closeEvent(QCloseEvent *event) override;
88     virtual bool   IsValid() const final;
89 
90 private:
91     Q_DISABLE_COPY(DialogPointFromCircleAndTangent)
92 
93     Ui::DialogPointFromCircleAndTangent *ui;
94 
95     QTimer* timerCircleRadius;
96     QString circleRadius;
97     int     formulaBaseHeightCircleRadius;
98     QString pointName;
99     bool    flagCircleRadius;
100     bool    flagName;
101     bool    flagError;
102 };
103 
104 //---------------------------------------------------------------------------------------------------------------------
IsValid()105 inline bool DialogPointFromCircleAndTangent::IsValid() const
106 {
107     return flagCircleRadius && flagName && flagError;
108 }
109 
110 #endif // DIALOGPOINTFROMCIRCLEANDTANGENT_H
111