Seamly2D
Code documentation
vlayoutpaper.h
Go to the documentation of this file.
1 /***************************************************************************
2  ** @file vlayoutpaper.h
3  ** @author Douglas S Caskey
4  ** @date Dec 27, 2022
5  **
6  ** @copyright
7  ** Copyright (C) 2017 - 2022 Seamly, LLC
8  ** https://github.com/fashionfreedom/seamly2d
9  **
10  ** @brief
11  ** Seamly2D is free software: you can redistribute it and/or modify
12  ** it under the terms of the GNU General Public License as published by
13  ** the Free Software Foundation, either version 3 of the License, or
14  ** (at your option) any later version.
15  **
16  ** Seamly2D is distributed in the hope that it will be useful,
17  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  ** GNU General Public License for more details.
20  **
21  ** You should have received a copy of the GNU General Public License
22  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
23  **************************************************************************/
24 
25 /************************************************************************
26  **
27  ** @file vlayoutpaper.h
28  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
29  ** @date 7 1, 2015
30  **
31  ** @brief
32  ** @copyright
33  ** This source code is part of the Valentina project, a pattern making
34  ** program, whose allow create and modeling patterns of clothing.
35  ** Copyright (C) 2013-2015 Valentina project
36  ** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
37  **
38  ** Valentina is free software: you can redistribute it and/or modify
39  ** it under the terms of the GNU General Public License as published by
40  ** the Free Software Foundation, either version 3 of the License, or
41  ** (at your option) any later version.
42  **
43  ** Valentina is distributed in the hope that it will be useful,
44  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
45  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46  ** GNU General Public License for more details.
47  **
48  ** You should have received a copy of the GNU General Public License
49  ** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
50  **
51  *************************************************************************/
52 
53 #ifndef VLAYOUTPAPER_H
54 #define VLAYOUTPAPER_H
55 
56 #include <qcompilerdetection.h>
57 #include <QSharedDataPointer>
58 #include <QTypeInfo>
59 #include <QtGlobal>
60 #include <atomic>
61 
62 #include "vlayoutdef.h"
63 
64 class VBestSquare;
65 class VLayoutPaperData;
66 class VLayoutPiece;
67 class QGraphicsRectItem;
68 class QRectF;
69 class QGraphicsItem;
70 template <typename T> class QList;
71 template <typename T> class QVector;
72 
74 {
75 public:
76  VLayoutPaper();
77  VLayoutPaper(int height, int width);
78  VLayoutPaper(const VLayoutPaper &paper);
79 
80  ~VLayoutPaper();
81 
82  VLayoutPaper &operator=(const VLayoutPaper &paper);
83 #ifdef Q_COMPILER_RVALUE_REFS
84  VLayoutPaper &operator=(VLayoutPaper &&paper) Q_DECL_NOTHROW;
85 #endif
86 
87  void Swap(VLayoutPaper &paper) Q_DECL_NOTHROW;
88 
89  int GetHeight() const;
90  void SetHeight(int height);
91 
92  int GetWidth() const;
93  void SetWidth(int width);
94 
95  qreal GetLayoutWidth() const;
96  void SetLayoutWidth(qreal width);
97 
98  quint32 GetShift() const;
99  void SetShift(quint32 shift);
100 
101  bool GetRotate() const;
102  void SetRotate(bool value);
103 
104  int GetRotationIncrease() const;
105  void SetRotationIncrease(int value);
106 
107  bool IsSaveLength() const;
108  void SetSaveLength(bool value);
109 
110  void SetPaperIndex(quint32 index);
111 
112  bool arrangePiece(const VLayoutPiece &piece, std::atomic_bool &stop);
113  int Count() const;
114  Q_REQUIRED_RESULT QGraphicsRectItem *GetPaperItem(bool autoCrop, bool textAsPaths) const;
115  Q_REQUIRED_RESULT QList<QGraphicsItem *> getPieceItems(bool textAsPaths) const;
116 
118  void setPieces(const QList<VLayoutPiece>& pieces);
119 
120  QRectF piecesBoundingRect() const;
121 
122 private:
123  QSharedDataPointer<VLayoutPaperData> d;
124  bool AddToSheet(const VLayoutPiece &piece, std::atomic_bool &stop);
125  bool SaveResult(const VBestSquare &bestResult, const VLayoutPiece &piece);
126 };
127 
129 
130 #endif // VLAYOUTPAPER_H
VLayoutPaper & operator=(const VLayoutPaper &paper)
bool arrangePiece(const VLayoutPiece &piece, std::atomic_bool &stop)
void setPieces(const QList< VLayoutPiece > &pieces)
quint32 GetShift() const
bool SaveResult(const VBestSquare &bestResult, const VLayoutPiece &piece)
void SetRotationIncrease(int value)
void Swap(VLayoutPaper &paper) Q_DECL_NOTHROW
void SetShift(quint32 shift)
QRectF piecesBoundingRect() const
void SetSaveLength(bool value)
void SetRotate(bool value)
int Count() const
void SetWidth(int width)
int GetHeight() const
QVector< VLayoutPiece > getPieces() const
void SetHeight(int height)
void SetPaperIndex(quint32 index)
bool AddToSheet(const VLayoutPiece &piece, std::atomic_bool &stop)
int GetWidth() const
int GetRotationIncrease() const
void SetLayoutWidth(qreal width)
bool GetRotate() const
Q_REQUIRED_RESULT QList< QGraphicsItem * > getPieceItems(bool textAsPaths) const
bool IsSaveLength() const
qreal GetLayoutWidth() const
Q_REQUIRED_RESULT QGraphicsRectItem * GetPaperItem(bool autoCrop, bool textAsPaths) const
QSharedDataPointer< VLayoutPaperData > d
Definition: vlayoutpaper.h:123
Q_DECLARE_TYPEINFO(VLayoutPaper, Q_MOVABLE_TYPE)