Seamly2D
Code documentation
vbestsquare.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 vbestsquare.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 VBESTSQUARE_H
53 #define VBESTSQUARE_H
54 
55 #include <QSizeF>
56 #include <QTransform>
57 #include <QtGlobal>
58 
59 #include "vlayoutdef.h"
60 
62 {
63 public:
64  VBestSquare(const QSizeF &sheetSize, bool saveLength);
65 
66  void NewResult(const QSizeF &candidate, int i, int j, const QTransform &transform, bool mirror, BestFrom type);
67  void NewResult(const VBestSquare &best);
68 
69  QSizeF BestSize() const;
70  int GContourEdge() const;
71  int pieceEdge() const;
72  QTransform Transform() const;
73  bool ValidResult() const;
74  bool isMirror() const;
75  BestFrom Type() const;
76 
77  bool IsSaveLength() const;
78 
79 private:
80  // All nedded information about best result
81  int resI; // Edge of global contour
82  int resJ; // Edge of detail
83  QTransform resTransform; // Transform for rotation and translation detail
84  QSizeF bestSize;
85  qreal sheetWidth;
87  bool resMirror;
89  bool saveLength;
90 
91  static qint64 Square(const QSizeF &size);
92 };
93 
94 #endif // VBESTSQUARE_H
bool ValidResult() const
QSizeF BestSize() const
int GContourEdge() const
QTransform Transform() const
bool saveLength
Definition: vbestsquare.h:89
bool resMirror
Definition: vbestsquare.h:87
bool isMirror() const
BestFrom Type() const
QSizeF bestSize
Definition: vbestsquare.h:84
int pieceEdge() const
void NewResult(const QSizeF &candidate, int i, int j, const QTransform &transform, bool mirror, BestFrom type)
Definition: vbestsquare.cpp:69
static qint64 Square(const QSizeF &size)
qreal sheetWidth
Definition: vbestsquare.h:85
bool IsSaveLength() const
VBestSquare(const QSizeF &sheetSize, bool saveLength)
Definition: vbestsquare.cpp:57
QTransform resTransform
Definition: vbestsquare.h:83
BestFrom type
Definition: vbestsquare.h:88
bool valideResult
Definition: vbestsquare.h:86
BestFrom
Definition: vlayoutdef.h:68