1 /************************************************************************
2  **
3  **  @file   vlayoutdef.h
4  **  @author Roman Telezhynskyi <dismine(at)gmail.com>
5  **  @date   7 1, 2015
6  **
7  **  @brief
8  **  @copyright
9  **  This source code is part of the Valentina project, a pattern making
10  **  program, whose allow create and modeling patterns of clothing.
11  **  Copyright (C) 2013-2015 Valentina project
12  **  <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
13  **
14  **  Valentina is free software: you can redistribute it and/or modify
15  **  it under the terms of the GNU General Public License as published by
16  **  the Free Software Foundation, either version 3 of the License, or
17  **  (at your option) any later version.
18  **
19  **  Valentina is distributed in the hope that it will be useful,
20  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  **  GNU General Public License for more details.
23  **
24  **  You should have received a copy of the GNU General Public License
25  **  along with Valentina.  If not, see <http://www.gnu.org/licenses/>.
26  **
27  *************************************************************************/
28 
29 #ifndef VLAYOUTDEF_H
30 #define VLAYOUTDEF_H
31 
32 #include <QSize>
33 #include <QTransform>
34 #include <QPainterPath>
35 #include <ciso646>
36 
37 #include "../vmisc/typedef.h"
38 
39 enum class LayoutExportFormats : qint8
40 {
41     SVG = 0,
42     PDF = 1,
43     PNG = 2,
44     OBJ = 3,              /* Wavefront OBJ*/
45     PS  = 4,
46     EPS = 5,
47     DXF_AC1006_Flat = 6,  /* R10. */
48     DXF_AC1009_Flat = 7,  /* R11 & R12. */
49     DXF_AC1012_Flat = 8,  /* R13. */
50     DXF_AC1014_Flat = 9,  /* R14. */
51     DXF_AC1015_Flat = 10, /* ACAD 2000. */
52     DXF_AC1018_Flat = 11, /* ACAD 2004. */
53     DXF_AC1021_Flat = 12, /* ACAD 2007. */
54     DXF_AC1024_Flat = 13, /* ACAD 2010. */
55     DXF_AC1027_Flat = 14, /* ACAD 2013. */
56     DXF_AC1006_AAMA = 15, /* R10. */
57     DXF_AC1009_AAMA = 16, /* R11 & R12. */
58     DXF_AC1012_AAMA = 17, /* R13. */
59     DXF_AC1014_AAMA = 18, /* R14. */
60     DXF_AC1015_AAMA = 19, /* ACAD 2000. */
61     DXF_AC1018_AAMA = 20, /* ACAD 2004. */
62     DXF_AC1021_AAMA = 21, /* ACAD 2007. */
63     DXF_AC1024_AAMA = 22, /* ACAD 2010. */
64     DXF_AC1027_AAMA = 23, /* ACAD 2013. */
65     DXF_AC1006_ASTM = 24, /* R10. */
66     DXF_AC1009_ASTM = 25, /* R11 & R12. */
67     DXF_AC1012_ASTM = 26, /* R13. */
68     DXF_AC1014_ASTM = 27, /* R14. */
69     DXF_AC1015_ASTM = 28, /* ACAD 2000. */
70     DXF_AC1018_ASTM = 29, /* ACAD 2004. */
71     DXF_AC1021_ASTM = 30, /* ACAD 2007. */
72     DXF_AC1024_ASTM = 31, /* ACAD 2010. */
73     DXF_AC1027_ASTM = 32, /* ACAD 2013. */
74     PDFTiled = 33,
75     NC = 34,              /*G-code. Reserved for future*/
76     TIF = 35,
77     COUNT                 /*Use only for validation*/
78 };
79 
80 enum class LayoutErrors : qint8
81 {
82     NoError,
83     PrepareLayoutError,
84     ProcessStoped,
85     EmptyPaperError,
86     Timeout,
87     TerminatedByException
88 };
89 
90 enum class BestFrom : qint8
91 {
92     Rotation = 0,
93     Combine = 1
94 };
95 
96 struct VBestSquareResData
97 {
98     QSizeF        bestSize{INT_MAX, INT_MAX};
99     // cppcheck-suppress unusedStructMember
100     int           globalI{0}; // Edge of global contour
101     // cppcheck-suppress unusedStructMember
102     int           detJ{0}; // Edge of detail
103     QTransform    resMatrix{}; // Matrix for rotation and translation detail
104     // cppcheck-suppress unusedStructMember
105     bool          resMirror{false};
106     BestFrom      type{BestFrom::Rotation};
107     // cppcheck-suppress unusedStructMember
108     qreal         depthPosition{INT_MAX};
109     // cppcheck-suppress unusedStructMember
110     qreal         sidePosition{0};
111 };
112 
113 struct VCachedPositions
114 {
115     QRectF boundingRect{};
116     QPainterPath layoutAllowancePath{};
117 };
118 
119 enum class Cases : qint8 { CaseThreeGroup = 0, CaseTwoGroup, CaseDesc, UnknownCase};
120 
121 /* Warning! Debugging doesn't work stable in debug mode. If you need big allocation use release mode. Or disable
122  * Address Sanitizer. See page https://bitbucket.org/dismine/valentina/wiki/developers/Address_Sanitizer
123  */
124 //#define LAYOUT_DEBUG // Enable debug mode
125 
126 // This block help rule debug mode. Don't turn all options at the same time!
127 #ifdef LAYOUT_DEBUG
128 // Nice looking
129 #   define SHOW_VERTICES         // Show contour vertices
130 #   define SHOW_DIRECTION        // Show contour direction
131 #   define ARRANGED_DETAILS      // Show already arranged details
132 #   define SHOW_SHEET            // Show sheet rect
133 #   define SHOW_CANDIDATE        // Show each position
134 
135 // Debugging
136 //#   define SHOW_ROTATION         // For each position show rotation part
137 //#   define SHOW_COMBINE          // For each position show edge combine part
138 //#   define SHOW_MIRROR           // For each position show mirror part
139 //#   define SHOW_CANDIDATE_BEST   // For only correct positions that pass checks
140 #   define SHOW_BEST             // Show only best position for workpiece
141 #endif//LAYOUT_DEBUG
142 
143 #endif // VLAYOUTDEF_H
144