Seamly2D
Code documentation
vmeasurement.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 vstandardtablecell.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 VMULTISIZETABLEROW_H
53 #define VMULTISIZETABLEROW_H
54 
55 #include <qcompilerdetection.h>
56 #include <QMap>
57 #include <QSharedDataPointer>
58 #include <QString>
59 #include <QStringList>
60 #include <QTypeInfo>
61 #include <QtGlobal>
62 
63 #include "../vmisc/def.h"
64 #include "../ifc/ifcdef.h"
65 #include "vvariable.h"
66 
67 class VContainer;
68 class VMeasurementData;
69 
70 /**
71  * @brief The VMeasurement class keep data row of multisize table
72  */
73 class VMeasurement :public VVariable
74 {
75 public:
76  VMeasurement(quint32 index, const QString &name, qreal baseSize, qreal baseHeight, const qreal &base,
77  const qreal &ksize, const qreal &kheight, const QString &gui_text = QString(),
78  const QString &description = QString(), const QString &tagName = QString());
79  VMeasurement(VContainer *data, quint32 index, const QString &name, const qreal &base, const QString &formula,
80  bool ok, const QString &gui_text = QString(), const QString &description = QString(),
81  const QString &tagName = QString());
82  VMeasurement(const VMeasurement &m);
83 
84  virtual ~VMeasurement() Q_DECL_OVERRIDE;
85 
87 #ifdef Q_COMPILER_RVALUE_REFS
88  VMeasurement &operator=(VMeasurement &&m) Q_DECL_NOTHROW;
89 #endif
90 
91  void Swap(VMeasurement &m) Q_DECL_NOTHROW;
92 
93  QString getGuiText() const;
94 
95  QString TagName() const;
96  void setTagName(const QString &tagName);
97 
98  QString GetFormula() const;
99 
100  bool isCustom() const;
101 
102  int Index() const;
103  bool IsFormulaOk() const;
104 
105  virtual bool isNotUsed() const Q_DECL_OVERRIDE;
106 
107  virtual qreal GetValue() const Q_DECL_OVERRIDE;
108  virtual qreal* GetValue() Q_DECL_OVERRIDE;
109 
110  VContainer *GetData();
111 
112  void SetSize(qreal *size);
113  void SetHeight(qreal *height);
114  void SetUnit(const Unit *unit);
115 
116  qreal GetBase() const;
117  void SetBase(const qreal &value);
118 
119  qreal GetKsize() const;
120  void SetKsize(const qreal &value);
121 
122  qreal GetKheight() const;
123  void SetKheight(const qreal &value);
124 
125  static QStringList ListHeights(QMap<GHeights, bool> heights, Unit patternUnit);
126  static QStringList ListSizes(QMap<GSizes, bool> sizes, Unit patternUnit);
127  static QStringList WholeListHeights(Unit patternUnit);
128  static QStringList WholeListSizes(Unit patternUnit);
129  static bool IsGradationSizeValid(const QString &size);
130  static bool IsGradationHeightValid(const QString &height);
131 private:
132  QSharedDataPointer<VMeasurementData> d;
133 
134  qreal CalcValue() const;
135 
136  static void ListValue(QStringList &list, qreal value, Unit patternUnit);
137 };
138 
140 
141 #endif // VMULTISIZETABLEROW_H
The VContainer class container of all variables.
Definition: vcontainer.h:141
The VMeasurement class keep data row of multisize table.
Definition: vmeasurement.h:74
QString GetFormula() const
QString TagName() const
qreal GetKheight() const
GetKheight return increment in heights.
VMeasurement(quint32 index, const QString &name, qreal baseSize, qreal baseHeight, const qreal &base, const qreal &ksize, const qreal &kheight, const QString &gui_text=QString(), const QString &description=QString(), const QString &tagName=QString())
VMeasurement create measurement for multisize table.
QSharedDataPointer< VMeasurementData > d
Definition: vmeasurement.h:132
void SetSize(qreal *size)
void SetHeight(qreal *height)
virtual qreal GetValue() const Q_DECL_OVERRIDE
void SetKsize(const qreal &value)
void SetUnit(const Unit *unit)
void SetBase(const qreal &value)
static QStringList WholeListSizes(Unit patternUnit)
void setTagName(const QString &tagName)
qreal CalcValue() const
void Swap(VMeasurement &m) Q_DECL_NOTHROW
static QStringList WholeListHeights(Unit patternUnit)
static void ListValue(QStringList &list, qreal value, Unit patternUnit)
static QStringList ListSizes(QMap< GSizes, bool > sizes, Unit patternUnit)
virtual ~VMeasurement() Q_DECL_OVERRIDE
bool isCustom() const
bool IsFormulaOk() const
void SetKheight(const qreal &value)
static bool IsGradationSizeValid(const QString &size)
qreal GetKsize() const
GetKsize return increment in sizes.
static QStringList ListHeights(QMap< GHeights, bool > heights, Unit patternUnit)
VMeasurement & operator=(const VMeasurement &m)
VContainer * GetData()
int Index() const
virtual bool isNotUsed() const Q_DECL_OVERRIDE
static bool IsGradationHeightValid(const QString &height)
QString getGuiText() const
getGuiText measurement name for tooltip
qreal GetBase() const
GetBase return value in base size and height.
Unit
Definition: def.h:105
Q_DECLARE_TYPEINFO(VMeasurement, Q_MOVABLE_TYPE)