Seamly2D
Code documentation
vtoollineintersect.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 vtoollineintersect.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 VTOOLLINEINTERSECT_H
53 #define VTOOLLINEINTERSECT_H
54 
55 #include <qcompilerdetection.h>
56 #include <QDomElement>
57 #include <QGraphicsItem>
58 #include <QMetaObject>
59 #include <QObject>
60 #include <QString>
61 #include <QtGlobal>
62 
63 #include "../ifc/xml/vabstractpattern.h"
64 #include "../vmisc/def.h"
65 #include "vtoolsinglepoint.h"
66 
67 template <class T> class QSharedPointer;
68 
69 /**
70  * @brief The VToolLineIntersect class help find point intersection lines.
71  */
73 {
74  Q_OBJECT
75 public:
76  virtual void setDialog() Q_DECL_OVERRIDE;
77 
80  static VToolLineIntersect *Create(const quint32 _id, const quint32 &p1Line1Id, const quint32 &p2Line1Id,
81  const quint32 &p1Line2Id, const quint32 &p2Line2Id, const QString &pointName,
82  qreal mx, qreal my, bool showPointName, VMainGraphicsScene *scene,
84  VContainer *data, const Document &parse, const Source &typeCreation);
85 
86  static const QString ToolType;
87  virtual int type() const Q_DECL_OVERRIDE {return Type;}
88  enum { Type = UserType + static_cast<int>(Tool::LineIntersect)};
89 
90  QString Line1P1Name() const;
91  QString Line1P2Name() const;
92  QString Line2P1Name() const;
93  QString Line2P2Name() const;
94 
95  quint32 GetP1Line1() const;
96  void SetP1Line1(const quint32 &value);
97 
98  quint32 GetP2Line1() const;
99  void SetP2Line1(const quint32 &value);
100 
101  quint32 GetP1Line2() const;
102  void SetP1Line2(const quint32 &value);
103 
104  quint32 GetP2Line2() const;
105  void SetP2Line2(const quint32 &value);
106 
107  virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
108 
109 protected slots:
110  virtual void showContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
111 
112 protected:
113  virtual void RemoveReferens() Q_DECL_OVERRIDE;
114  virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
115  virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
116  virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
117  virtual void SetVisualization() Q_DECL_OVERRIDE;
118  virtual QString makeToolTip() const Q_DECL_OVERRIDE;
119 
120 private:
121  Q_DISABLE_COPY(VToolLineIntersect)
122 
123  /** @brief p1Line1 id first point first line. */
124  quint32 p1Line1;
125 
126  /** @brief p2Line1 id second point first line. */
127  quint32 p2Line1;
128 
129  /** @brief p1Line2 id first point second line. */
130  quint32 p1Line2;
131 
132  /** @brief p2Line2 id second point second line.*/
133  quint32 p2Line2;
134 
135  VToolLineIntersect(VAbstractPattern *doc, VContainer *data, const quint32 &id,
136  const quint32 &p1Line1, const quint32 &p2Line1, const quint32 &p1Line2,
137  const quint32 &p2Line2, const Source &typeCreation,
138  QGraphicsItem * parent = nullptr);
139 };
140 
141 #endif // VTOOLLINEINTERSECT_H
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 VGObject class keep information graphical objects.
Definition: vgobject.h:74
The VMainGraphicsScene class main scene.
The VToolLineIntersect class help find point intersection lines.
quint32 GetP2Line2() const
static VToolLineIntersect * Create(QSharedPointer< DialogTool > dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data)
Create help create tool from GUI.
static const QString ToolType
QString Line2P1Name() const
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE
virtual QString makeToolTip() const Q_DECL_OVERRIDE
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE
QString Line2P2Name() const
virtual void SaveOptions(QDomElement &tag, QSharedPointer< VGObject > &obj) Q_DECL_OVERRIDE
quint32 GetP1Line2() const
virtual void showContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE
contextMenuEvent handle context menu events.
quint32 p1Line2
p1Line2 id first point second line.
QString Line1P1Name() const
quint32 p1Line1
p1Line1 id first point first line.
quint32 GetP1Line1() const
virtual void SetVisualization() Q_DECL_OVERRIDE
QString Line1P2Name() const
virtual void RemoveReferens() Q_DECL_OVERRIDE
RemoveReferens decrement value of reference.
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE
SaveDialog save options into file after change in dialog.
void SetP1Line2(const quint32 &value)
virtual int type() const Q_DECL_OVERRIDE
quint32 GetP2Line1() const
void SetP2Line2(const quint32 &value)
quint32 p2Line1
p2Line1 id second point first line.
virtual void setDialog() Q_DECL_OVERRIDE
setDialog set dialog when user want change tool option.
quint32 p2Line2
p2Line2 id second point second line.
void SetP2Line1(const quint32 &value)
void SetP1Line1(const quint32 &value)
The VToolSinglePoint class parent for all tools what create points.
@ LineIntersect
Source
Definition: def.h:106
#define NULL_ID
Definition: ifcdef.h:76
Document