Seamly2D
Code documentation
vtoollinepoint.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 vtoollinepoint.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 VTOOLLINEPOINT_H
53 #define VTOOLLINEPOINT_H
54 
55 #include <qcompilerdetection.h>
56 #include <QGraphicsItem>
57 #include <QMetaObject>
58 #include <QObject>
59 #include <QString>
60 #include <QtGlobal>
61 
62 #include "../vpatterndb/vformula.h"
63 #include "../vtoolsinglepoint.h"
64 #include "../vmisc/def.h"
65 
66 template <class T> class QSharedPointer;
67 
68 /**
69  * @brief The VToolLinePoint class parent for all tools what create point with line.
70  */
72 {
73  Q_OBJECT
74 public:
75  VToolLinePoint(VAbstractPattern *doc, VContainer *data, const quint32 &id,
76  const QString &lineType, const QString &lineWeight,
77  const QString &lineColor, const QString &formula,
78  const quint32 &basePointId, const qreal &angle, QGraphicsItem * parent = nullptr);
79  virtual ~VToolLinePoint() Q_DECL_OVERRIDE;
80 
81  virtual int type() const Q_DECL_OVERRIDE {return Type;}
82  enum {Type = UserType + static_cast<int>(Tool::LinePoint)};
83 
84  virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
85  QWidget *widget = nullptr) Q_DECL_OVERRIDE;
86 
87  VFormula GetFormulaLength() const;
88  void SetFormulaLength(const VFormula &value);
89 
90  QString BasePointName() const;
91 
92  quint32 GetBasePointId() const;
93  void SetBasePointId(const quint32 &value);
94 
95  qreal GetAngle() const;
96  void SetAngle(const qreal &value);
97 
98  QString getLineColor() const;
99  void setLineColor(const QString &value);
100 
101 public slots:
102  virtual void Disable(bool disable, const QString &draftBlockName) Q_DECL_OVERRIDE;
103  virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
104 
105 protected:
106  QString formulaLength; /** @brief formula string with length formula. */
107  qreal angle; /** @brief angle line angle. */
108  quint32 basePointId; /** @brief basePointId id base line point. */
109  VScaledLine *mainLine; /** @brief mainLine line item. */
110  QString lineColor; /** @brief lineColor color of a line. */
111 
112  virtual void RefreshGeometry();
113  virtual void RemoveReferens() Q_DECL_OVERRIDE;
114  virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
115  virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
116  virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
117  virtual QString makeToolTip() const Q_DECL_OVERRIDE;
118 
119 private:
120  Q_DISABLE_COPY(VToolLinePoint)
121 };
122 
123 #endif // VTOOLLINEPOINT_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 VToolLinePoint class parent for all tools what create point with line.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) Q_DECL_OVERRIDE
VFormula GetFormulaLength() const
VToolLinePoint(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &lineType, const QString &lineWeight, const QString &lineColor, const QString &formula, const quint32 &basePointId, const qreal &angle, QGraphicsItem *parent=nullptr)
VToolLinePoint constructor.
virtual void RefreshGeometry()
lineColor color of a line.
VScaledLine * mainLine
basePointId id base line point.
qreal angle
formula string with length formula.
virtual void Disable(bool disable, const QString &draftBlockName) Q_DECL_OVERRIDE
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE
FullUpdateFromFile update tool data form file.
void SetAngle(const qreal &value)
QString getLineColor() const
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE
QString BasePointName() const
virtual QString makeToolTip() const Q_DECL_OVERRIDE
qreal GetAngle() const
virtual ~VToolLinePoint() Q_DECL_OVERRIDE
quint32 basePointId
angle line angle.
void SetFormulaLength(const VFormula &value)
virtual void RemoveReferens() Q_DECL_OVERRIDE
RemoveReferens decrement value of reference.
virtual int type() const Q_DECL_OVERRIDE
quint32 GetBasePointId() const
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE
QString lineColor
mainLine line item.
void SetBasePointId(const quint32 &value)
void setLineColor(const QString &value)
virtual void SaveOptions(QDomElement &tag, QSharedPointer< VGObject > &obj) Q_DECL_OVERRIDE
QString formulaLength
The VToolSinglePoint class parent for all tools what create points.
@ LinePoint