57 #include "../vmisc/diagnostic.h"
58 #include "../vmisc/logging.h"
62 QT_WARNING_DISABLE_CLANG(
"-Wmissing-prototypes")
63 QT_WARNING_DISABLE_INTEL(1418)
65 Q_LOGGING_CATEGORY(lBank, "layout.bank")
72 #if defined (Q_OS_WIN) && defined (Q_CC_MSVC)
73 #pragma push_macro("small")
80 , unsorted(
QHash<int, qint64>())
81 , big(
QHash<int, qint64>())
82 , middle(
QHash<int, qint64>())
83 , small(
QHash<int, qint64>())
86 , prepare(false), diagonal(0)
145 if (i >= 0 && i <
pieces.size())
170 if (
small.contains(i))
193 if (
small.contains(i))
205 qCDebug(lBank,
"Preparing data for layout error: Layout paper sheet <= 0");
212 qCDebug(lBank,
"Preparing data for layout error: List of pieces is empty");
218 for (
int i=0; i <
pieces.size(); ++i)
221 pieces[i].SetLayoutAllowancePoints();
223 const qreal d =
pieces.at(i).Diagonal();
229 const qint64 square =
pieces.at(i).Square();
232 qCDebug(lBank,
"Preparing data for layout error: Detail squere <= 0");
308 qint64 sMax = LLONG_MIN;
309 qint64 sMin = LLONG_MAX;
313 const qint64 s1 = sMax - (sMax - sMin)/3;
314 const qint64 s2 = sMin + (sMax - sMin)/3;
321 big.insert(i.key(), i.value());
323 else if (s1 >= i.value() && i.value() > s2)
325 middle.insert(i.key(), i.value());
329 small.insert(i.key(), i.value());
339 qint64 sMax = LLONG_MIN;
340 qint64 sMin = LLONG_MAX;
344 const qint64 s = (sMax + sMin)/2;
350 big.insert(i.key(), i.value());
354 small.insert(i.key(), i.value());
371 if (
big.isEmpty() ==
false)
377 if (
middle.isEmpty() ==
false)
383 if (
small.isEmpty() ==
false)
395 if (
big.isEmpty() ==
false)
401 if (
small.isEmpty() ==
false)
414 qint64 sMax = LLONG_MIN;
417 while (i !=
big.constEnd())
419 if (i.value() > sMax)
440 if (i.value() < sMin)
445 if (i.value() > sMax)
454 #if defined (Q_OS_WIN) && defined (Q_CC_MSVC)
455 #pragma pop_macro("small")
void PrepareThreeGroups()
void SetCaseType(Cases caseType)
QVector< VLayoutPiece > pieces
void SetLayoutWidth(const qreal &value)
int GetNextThreeGroups() const
int ArrangedCount() const
int allPieceCount() const
VLayoutPiece getPiece(int i) const
QHash< int, qint64 > middle
void setPieces(const QVector< VLayoutPiece > &pieces)
qreal GetLayoutWidth() const
QHash< int, qint64 > unsorted
QHash< int, qint64 > small
qreal GetBiggestDiagonal() const
int GetNextTwoGroups() const
int GetNextDescGroup() const
void SqMaxMin(qint64 &sMax, qint64 &sMin) const