Seamly2D
Code documentation
vtoolinternalpath.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
27  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
28  ** @date 24 11, 2016
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) 2016 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 VTOOLINTERNALPATH_H
53 #define VTOOLINTERNALPATH_H
54 
55 #include <QtGlobal>
56 
57 #include "vabstractnode.h"
58 
59 class DialogTool;
60 
61 class VToolInternalPath : public VAbstractNode, public QGraphicsPathItem
62 {
63  Q_OBJECT
64 public:
66  VContainer *data);
67  static VToolInternalPath *Create(quint32 _id, const VPiecePath &path, quint32 pieceId, VMainGraphicsScene *scene,
68  VAbstractPattern *doc, VContainer *data, const Document &parse,
69  const Source &typeCreation, const QString &blockName = QString(),
70  const quint32 &idTool = 0);
71 
72  virtual int type() const Q_DECL_OVERRIDE {return Type;}
73  enum { Type = UserType + static_cast<int>(Tool::InternalPath)};
74  virtual QString getTagName() const Q_DECL_OVERRIDE;
75 
76  virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
77  QWidget *widget = nullptr) Q_DECL_OVERRIDE;
78 
79  virtual void incrementReferens() Q_DECL_OVERRIDE;
80  virtual void decrementReferens() Q_DECL_OVERRIDE;
81 
82  static void AddAttributes(VAbstractPattern *doc, QDomElement &domElement, quint32 id, const VPiecePath &path);
83 public slots:
84  virtual void FullUpdateFromFile () Q_DECL_OVERRIDE;
85  virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
86  virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
87 protected:
88  virtual void AddToFile() Q_DECL_OVERRIDE;
89  virtual void ShowNode() Q_DECL_OVERRIDE;
90  virtual void HideNode() Q_DECL_OVERRIDE;
91  virtual void ToolCreation(const Source &typeCreation) Q_DECL_OVERRIDE;
92 private:
93  Q_DISABLE_COPY(VToolInternalPath)
94 
95  quint32 m_pieceId;
96 
97  VToolInternalPath(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 pieceId, const Source &typeCreation,
98  const QString &blockName = QString(), const quint32 &idTool = 0, QObject *qoParent = nullptr,
99  QGraphicsItem * parent = nullptr );
100 
101  void RefreshGeometry();
102 
103  void IncrementNodes(const VPiecePath &path) const;
104  void DecrementNodes(const VPiecePath &path) const;
105 };
106 
107 #endif // VTOOLINTERNALPATH_H
The DialogTool class parent for all dialog of tools.
Definition: dialogtool.h:107
The VAbstractNode class parent class for all detail node.
Definition: vabstractnode.h:71
quint32 idTool
idTool id tool.
Definition: vabstractnode.h:97
VAbstractPattern * doc
doc dom document container
The VContainer class container of all variables.
Definition: vcontainer.h:141
VContainer data
data container with data
Definition: vdatatool.h:84
The VMainGraphicsScene class main scene.
virtual void decrementReferens() Q_DECL_OVERRIDE
decrementReferens decrement reference for all parent objects.
static VToolInternalPath * Create(QSharedPointer< DialogTool > dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data)
virtual QString getTagName() const Q_DECL_OVERRIDE
virtual void ToolCreation(const Source &typeCreation) Q_DECL_OVERRIDE
virtual void incrementReferens() Q_DECL_OVERRIDE
incrementReferens increment referens.
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE
virtual void HideNode() Q_DECL_OVERRIDE
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE
static void AddAttributes(VAbstractPattern *doc, QDomElement &domElement, quint32 id, const VPiecePath &path)
virtual int type() const Q_DECL_OVERRIDE
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) Q_DECL_OVERRIDE
void DecrementNodes(const VPiecePath &path) const
virtual void AddToFile() Q_DECL_OVERRIDE
AddToFile add tag with Information about tool into file.
virtual void ShowNode() Q_DECL_OVERRIDE
void IncrementNodes(const VPiecePath &path) const
@ InternalPath
Source
Definition: def.h:106
Document