Seamly2D
Code documentation
vcontour.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 vcontour.h
27  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
28  ** @date 21 1, 2015
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 VCONTOUR_H
53 #define VCONTOUR_H
54 
55 #include <QSharedDataPointer>
56 #include <QSizeF>
57 #include <QTypeInfo>
58 #include <QVector>
59 #include <QtGlobal>
60 
61 #include "vlayoutdef.h"
62 
63 class VContourData;
64 class QPointF;
65 class QLineF;
66 class QRectF;
67 class QPainterPath;
68 class VLayoutPiece;
69 
70 class VContour
71 {
72 public:
73  VContour();
74  VContour(int height, int width);
75  VContour(const VContour &contour);
76 
77  ~VContour();
78 
79  VContour &operator=(const VContour &contour);
80 #ifdef Q_COMPILER_RVALUE_REFS
81  VContour &operator=(VContour &&contour) Q_DECL_NOTHROW;
82 #endif
83 
84  void Swap(VContour &contour) Q_DECL_NOTHROW;
85 
86  void SetContour(const QVector<QPointF> &contour);
88 
89  quint32 GetShift() const;
90  void SetShift(quint32 shift);
91 
92  int GetHeight() const;
93  void SetHeight(int height);
94 
95  int GetWidth() const;
96  void SetWidth(int width);
97 
98  QSizeF GetSize() const;
99 
100  QVector<QPointF> UniteWithContour(const VLayoutPiece &detail, int globalI, int detJ, BestFrom type) const;
101 
102  QLineF EmptySheetEdge() const;
103  int GlobalEdgesCount() const;
104  QLineF GlobalEdge(int i) const;
105  QVector<QPointF> CutEdge(const QLineF &edge) const;
107 
108  const QPointF & at(int i) const;
109 
110  QRectF BoundingRect() const;
111 
112  QPainterPath ContourPath() const;
113 
114 private:
115  QSharedDataPointer<VContourData> d;
116 
117  void AppendWhole(QVector<QPointF> &contour, const VLayoutPiece &detail, int detJ) const;
118 };
119 
120 Q_DECLARE_TYPEINFO(VContour, Q_MOVABLE_TYPE);
121 
122 #endif // VCONTOUR_H
QSharedDataPointer< VContourData > d
Definition: vcontour.h:115
int GetHeight() const
Definition: vcontour.cpp:128
VContour & operator=(const VContour &contour)
Definition: vcontour.cpp:89
QPainterPath ContourPath() const
Definition: vcontour.cpp:349
void SetHeight(int height)
Definition: vcontour.cpp:134
QRectF BoundingRect() const
Definition: vcontour.cpp:337
void SetWidth(int width)
Definition: vcontour.cpp:146
const QPointF & at(int i) const
Definition: vcontour.cpp:331
int GetWidth() const
Definition: vcontour.cpp:140
void SetShift(quint32 shift)
Definition: vcontour.cpp:122
QVector< QPointF > GetContour() const
Definition: vcontour.cpp:110
void Swap(VContour &contour) Q_DECL_NOTHROW
Definition: vcontour.cpp:70
void AppendWhole(QVector< QPointF > &contour, const VLayoutPiece &detail, int detJ) const
Definition: vcontour.cpp:366
VContour()
Definition: vcontour.cpp:74
QLineF GlobalEdge(int i) const
Definition: vcontour.cpp:252
quint32 GetShift() const
Definition: vcontour.cpp:116
QSizeF GetSize() const
Definition: vcontour.cpp:152
QVector< QPointF > CutEdge(const QLineF &edge) const
Definition: vcontour.cpp:285
void SetContour(const QVector< QPointF > &contour)
Definition: vcontour.cpp:104
QLineF EmptySheetEdge() const
Definition: vcontour.cpp:388
int GlobalEdgesCount() const
Definition: vcontour.cpp:239
QVector< QPointF > CutEmptySheetEdge() const
Definition: vcontour.cpp:317
QVector< QPointF > UniteWithContour(const VLayoutPiece &detail, int globalI, int detJ, BestFrom type) const
Definition: vcontour.cpp:158
Q_DECLARE_TYPEINFO(VContour, Q_MOVABLE_TYPE)
BestFrom
Definition: vlayoutdef.h:68