2015-01-11 14:11:56 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vbank.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 11 1, 2015
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2015-01-11 14:11:56 +01:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2015-01-11 14:11:56 +01:00
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
|
|
**
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef VBANK_H
|
|
|
|
#define VBANK_H
|
|
|
|
|
|
|
|
#include <QHash>
|
2019-07-19 09:45:57 +02:00
|
|
|
#include <QMap>
|
2015-02-26 21:18:52 +01:00
|
|
|
#include <QRectF>
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QVector>
|
|
|
|
#include <QtGlobal>
|
2015-01-11 14:11:56 +01:00
|
|
|
|
2019-07-19 09:45:57 +02:00
|
|
|
#include "../vmisc/typedef.h"
|
|
|
|
|
2015-10-23 19:47:33 +02:00
|
|
|
// An annoying char define, from the Windows team in <rpcndr.h>
|
|
|
|
// #define small char
|
|
|
|
// http://stuartjames.info/Journal/c--visual-studio-2012-vs2012--win8--converting-projects-up-some-conflicts-i-found.aspx
|
|
|
|
#if defined (Q_OS_WIN) && defined (Q_CC_MSVC)
|
|
|
|
#pragma push_macro("small")
|
|
|
|
#undef small
|
|
|
|
#endif
|
|
|
|
|
2017-01-22 10:02:02 +01:00
|
|
|
class VLayoutPiece;
|
2015-01-11 14:11:56 +01:00
|
|
|
|
2015-08-25 19:53:03 +02:00
|
|
|
enum class Cases : char { CaseThreeGroup = 0, CaseTwoGroup, CaseDesc, UnknownCase};
|
2015-01-11 14:11:56 +01:00
|
|
|
|
|
|
|
class VBank
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VBank();
|
|
|
|
|
|
|
|
qreal GetLayoutWidth() const;
|
2019-03-26 16:47:27 +01:00
|
|
|
void SetLayoutWidth(qreal value);
|
2015-01-11 14:11:56 +01:00
|
|
|
|
2019-07-21 15:26:21 +02:00
|
|
|
bool GetManualPriority() const;
|
|
|
|
void SetManualPriority(bool value);
|
|
|
|
|
2019-07-04 13:33:45 +02:00
|
|
|
bool IsNestQuantity() const;
|
|
|
|
void SetNestQuantity(bool value);
|
2019-03-30 10:17:54 +01:00
|
|
|
|
2017-01-22 10:02:02 +01:00
|
|
|
void SetDetails(const QVector<VLayoutPiece> &details);
|
2019-03-26 16:47:27 +01:00
|
|
|
int GetNext();
|
2017-01-22 10:02:02 +01:00
|
|
|
VLayoutPiece GetDetail(int i) const;
|
2015-01-11 14:11:56 +01:00
|
|
|
|
|
|
|
void Arranged(int i);
|
|
|
|
void NotArranged(int i);
|
|
|
|
|
2019-03-30 10:17:54 +01:00
|
|
|
bool PrepareUnsorted();
|
|
|
|
bool PrepareDetails();
|
2015-01-11 14:11:56 +01:00
|
|
|
void Reset();
|
|
|
|
void SetCaseType(Cases caseType);
|
|
|
|
|
|
|
|
int AllDetailsCount() const;
|
2019-03-26 16:47:27 +01:00
|
|
|
int LeftToArrange() const;
|
2015-01-16 13:53:14 +01:00
|
|
|
int ArrangedCount() const;
|
2015-01-11 14:11:56 +01:00
|
|
|
|
2016-02-23 13:13:10 +01:00
|
|
|
qreal GetBiggestDiagonal() const;
|
2019-03-30 10:17:54 +01:00
|
|
|
|
|
|
|
bool IsRotationNeeded() const;
|
2015-01-12 13:12:15 +01:00
|
|
|
|
2015-01-11 14:11:56 +01:00
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(VBank)
|
2017-01-22 10:02:02 +01:00
|
|
|
QVector<VLayoutPiece> details;
|
2015-01-11 14:11:56 +01:00
|
|
|
|
2019-07-19 09:45:57 +02:00
|
|
|
QMap<uint, QHash<int, qint64>> unsorted;
|
|
|
|
QMap<uint, QHash<int, qint64>> big;
|
|
|
|
QMap<uint, QHash<int, qint64>> middle;
|
|
|
|
QMap<uint, QHash<int, qint64>> small;
|
|
|
|
QMap<uint, QMultiMap<qint64, int>> desc;
|
|
|
|
|
|
|
|
QVector<uint> groups;
|
|
|
|
QVector<vidtype> arranged;
|
2015-01-11 14:11:56 +01:00
|
|
|
|
|
|
|
qreal layoutWidth;
|
|
|
|
|
|
|
|
Cases caseType;
|
|
|
|
bool prepare;
|
2016-02-23 13:13:10 +01:00
|
|
|
qreal diagonal;
|
2019-07-04 13:33:45 +02:00
|
|
|
bool m_nestQuantity{false};
|
2019-07-21 15:26:21 +02:00
|
|
|
bool m_manualPriority{false};
|
2015-01-11 14:11:56 +01:00
|
|
|
|
|
|
|
void PrepareGroup();
|
|
|
|
|
2019-07-19 09:45:57 +02:00
|
|
|
void PrepareThreeGroups(uint priority);
|
|
|
|
void PrepareTwoGroups(uint priority);
|
|
|
|
void PrepareDescGroup(uint priority);
|
|
|
|
|
|
|
|
int GetNextThreeGroups(uint priority) const;
|
|
|
|
int GetNextTwoGroups(uint priority) const;
|
|
|
|
int GetNextDescGroup(uint priority) const;
|
2015-01-11 14:11:56 +01:00
|
|
|
|
2019-07-19 09:45:57 +02:00
|
|
|
void SqMaxMin(qint64 &sMax, qint64 &sMin, uint priority) const;
|
2015-01-11 14:11:56 +01:00
|
|
|
|
2019-07-19 09:45:57 +02:00
|
|
|
bool ArrangedDetail(QMap<uint, QHash<int, qint64>> &container, int i);
|
|
|
|
bool ArrangedDetail(QMap<uint, QMultiMap<qint64, int>> &container, int i);
|
2015-01-11 14:11:56 +01:00
|
|
|
};
|
|
|
|
|
2015-10-23 19:47:33 +02:00
|
|
|
#if defined (Q_OS_WIN) && defined (Q_CC_MSVC)
|
|
|
|
#pragma pop_macro("small")
|
|
|
|
#endif
|
|
|
|
|
2015-01-11 14:11:56 +01:00
|
|
|
#endif // VBANK_H
|