Seamly2D
Code documentation
vtoolarc.h
Go to the documentation of this file.
1 /******************************************************************************
2  * @file vtoolarc.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  **
21  ** @file vtoolarc.h
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 #ifndef VTOOLARC_H
48 #define VTOOLARC_H
49 
50 #include <qcompilerdetection.h>
51 #include <QGraphicsItem>
52 #include <QMetaObject>
53 #include <QObject>
54 #include <QString>
55 #include <QtGlobal>
56 
57 #include "vabstractspline.h"
58 #include "../ifc/xml/vabstractpattern.h"
59 #include "../vgeometry/varc.h"
60 #include "../vmisc/def.h"
61 
62 class VFormula;
63 template <class T> class QSharedPointer;
64 
65 /**
66  * @brief The VToolArc class tool for creation arc.
67  */
69 {
70  Q_OBJECT
71 public:
72  virtual void setDialog() Q_DECL_OVERRIDE;
73 
75  VContainer *data);
76  static VToolArc *Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1, QString &f2,
77  const QString &color, const QString &penStyle, const QString &lineWeight,
79  const Document &parse, const Source &typeCreation);
80 
81  static const QString ToolType;
82  virtual int type() const Q_DECL_OVERRIDE {return Type;}
83  enum { Type = UserType + static_cast<int>(Tool::Arc)};
84  virtual QString getTagName() const Q_DECL_OVERRIDE;
85 
86  QString CenterPointName() const;
87 
88  quint32 getCenter() const;
89  void setCenter(const quint32 &value);
90 
91  VFormula GetFormulaRadius() const;
92  void SetFormulaRadius(const VFormula &value);
93 
94  VFormula GetFormulaF1() const;
95  void SetFormulaF1(const VFormula &value);
96 
97  VFormula GetFormulaF2() const;
98  void SetFormulaF2(const VFormula &value);
99 
100  VArc getArc()const;
101  void setArc(const VArc &arc);
102 
103  virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
104 
105 
106 protected slots:
107  virtual void showContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
108 
109 protected:
110  virtual void RemoveReferens() Q_DECL_OVERRIDE;
111  virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
112  virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
113  virtual void SetVisualization() Q_DECL_OVERRIDE;
114  virtual QString makeToolTip() const Q_DECL_OVERRIDE;
115 
116 private:
117  Q_DISABLE_COPY(VToolArc)
118 
120  const Source &typeCreation, QGraphicsItem * parent = nullptr);
121 };
122 
123 #endif // VTOOLARC_H
VAbstractPattern * doc
doc dom document container
VArc class for anticlockwise arc.
Definition: varc.h:74
The VContainer class container of all variables.
Definition: vcontainer.h:141
VContainer data
data container with data
Definition: vdatatool.h:84
The VGObject class keep information graphical objects.
Definition: vgobject.h:74
The VMainGraphicsScene class main scene.
The VToolArc class tool for creation arc.
Definition: vtoolarc.h:69
void setArc(const VArc &arc)
Definition: vtoolarc.cpp:336
void SetFormulaF2(const VFormula &value)
Definition: vtoolarc.cpp:314
void SetFormulaRadius(const VFormula &value)
Definition: vtoolarc.cpp:257
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE
Definition: vtoolarc.cpp:345
QString CenterPointName() const
Definition: vtoolarc.cpp:215
static VToolArc * Create(QSharedPointer< DialogTool > dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data)
Create help create tool.
Definition: vtoolarc.cpp:126
VFormula GetFormulaF1() const
Definition: vtoolarc.cpp:272
void SetFormulaF1(const VFormula &value)
Definition: vtoolarc.cpp:285
@ Type
Definition: vtoolarc.h:83
VFormula GetFormulaRadius() const
Definition: vtoolarc.cpp:244
virtual int type() const Q_DECL_OVERRIDE
Definition: vtoolarc.h:82
VFormula GetFormulaF2() const
Definition: vtoolarc.cpp:301
VArc getArc() const
Definition: vtoolarc.cpp:329
virtual void RemoveReferens() Q_DECL_OVERRIDE
RemoveReferens decrement value of reference.
Definition: vtoolarc.cpp:375
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE
SaveDialog save options into file after change in dialog.
Definition: vtoolarc.cpp:385
virtual QString makeToolTip() const Q_DECL_OVERRIDE
Definition: vtoolarc.cpp:436
static const QString ToolType
Definition: vtoolarc.h:81
virtual void SaveOptions(QDomElement &tag, QSharedPointer< VGObject > &obj) Q_DECL_OVERRIDE
Definition: vtoolarc.cpp:401
void setCenter(const quint32 &value)
Definition: vtoolarc.cpp:230
virtual void SetVisualization() Q_DECL_OVERRIDE
Definition: vtoolarc.cpp:416
virtual QString getTagName() const Q_DECL_OVERRIDE
Definition: vtoolarc.cpp:209
quint32 getCenter() const
Definition: vtoolarc.cpp:221
virtual void showContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE
showContextMenu handle context menu events.
Definition: vtoolarc.cpp:356
virtual void setDialog() Q_DECL_OVERRIDE
setDialog set dialog when user want change tool option.
Definition: vtoolarc.cpp:102
Source
Definition: def.h:106
#define NULL_ID
Definition: ifcdef.h:76
Document