Fix bug with nesting a descending group.
Together with "Nest quantity" and limited space Valentina removes all duplicates except first for each next paper sheet. --HG-- branch : develop
This commit is contained in:
parent
ba69759634
commit
5978df2629
|
@ -32,7 +32,6 @@
|
||||||
|
|
||||||
#include "../vmisc/diagnostic.h"
|
#include "../vmisc/diagnostic.h"
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
#include "vlayoutpiece.h"
|
|
||||||
#include "vlayoutdef.h"
|
#include "vlayoutdef.h"
|
||||||
#include "../ifc/exception/vexception.h"
|
#include "../ifc/exception/vexception.h"
|
||||||
#include "../vpatterndb/floatItemData/floatitemdef.h"
|
#include "../vpatterndb/floatItemData/floatitemdef.h"
|
||||||
|
@ -95,7 +94,8 @@ int CountDetails(const T &container)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool NotArrangedDetail(QMap<uint, QHash<int, qint64>> &container, QMap<uint, QHash<int, qint64>> &unsorted, int i)
|
bool NotArrangedDetail(QMap<uint, QHash<int, qint64>> &container, QMap<uint, QHash<int, qint64>> &unsorted,
|
||||||
|
int i)
|
||||||
{
|
{
|
||||||
QMutableMapIterator<uint, QHash<int, qint64>> iterator(container);
|
QMutableMapIterator<uint, QHash<int, qint64>> iterator(container);
|
||||||
while (iterator.hasNext())
|
while (iterator.hasNext())
|
||||||
|
@ -122,19 +122,20 @@ bool NotArrangedDetail(QMap<uint, QHash<int, qint64>> &container, QMap<uint, QHa
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool NotArrangedDetail(QMap<uint, QMultiMap<qint64, int>> &container, QMap<uint, QHash<int, qint64>> &unsorted, int i)
|
bool NotArrangedDetail(QMap<uint, QMultiMap<qint64, int>> &container, QMap<uint, QHash<int, qint64>> &unsorted,
|
||||||
|
int i)
|
||||||
{
|
{
|
||||||
QMutableMapIterator<uint, QMultiMap<qint64, int>> iterator(container);
|
QMutableMapIterator<uint, QMultiMap<qint64, int>> iterator(container);
|
||||||
while (iterator.hasNext())
|
while (iterator.hasNext())
|
||||||
{
|
{
|
||||||
iterator.next();
|
iterator.next();
|
||||||
auto containerGroup = container.value(iterator.key());
|
auto containerGroup = container.value(iterator.key());
|
||||||
auto detailIterator = std::find(containerGroup.cbegin(), containerGroup.cend(), i);
|
auto detailIterator = std::find(containerGroup.begin(), containerGroup.end(), i);
|
||||||
if (detailIterator != containerGroup.cend())
|
if (detailIterator != containerGroup.end())
|
||||||
{
|
{
|
||||||
Insert(unsorted, iterator.key(), i, detailIterator.key());
|
Insert(unsorted, iterator.key(), i, detailIterator.key());
|
||||||
|
containerGroup.erase(detailIterator);
|
||||||
|
|
||||||
containerGroup.remove(detailIterator.key());
|
|
||||||
if (not containerGroup.isEmpty())
|
if (not containerGroup.isEmpty())
|
||||||
{
|
{
|
||||||
container.insert(iterator.key(), containerGroup);
|
container.insert(iterator.key(), containerGroup);
|
||||||
|
@ -165,18 +166,6 @@ int TakeFirstForPriority(const QMap<uint, QHash<int, qint64>> &container, uint p
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VBank::VBank()
|
VBank::VBank()
|
||||||
: details(),
|
|
||||||
unsorted(),
|
|
||||||
big(),
|
|
||||||
middle(),
|
|
||||||
small(),
|
|
||||||
desc(),
|
|
||||||
groups(),
|
|
||||||
arranged(),
|
|
||||||
layoutWidth(0),
|
|
||||||
caseType(Cases::CaseDesc),
|
|
||||||
prepare(false),
|
|
||||||
diagonal(0)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -655,11 +644,11 @@ bool VBank::ArrangedDetail(QMap<uint, QMultiMap<qint64, int>> &container, int i)
|
||||||
{
|
{
|
||||||
iterator.next();
|
iterator.next();
|
||||||
auto containerGroup = container.value(iterator.key());
|
auto containerGroup = container.value(iterator.key());
|
||||||
auto detailIterator = std::find(containerGroup.cbegin(), containerGroup.cend(), i);
|
auto detailIterator = std::find(containerGroup.begin(), containerGroup.end(), i);
|
||||||
if (detailIterator != containerGroup.cend())
|
if (detailIterator != containerGroup.end())
|
||||||
{
|
{
|
||||||
arranged.append(details.at(detailIterator.value()).GetId());
|
arranged.append(details.at(detailIterator.value()).GetId());
|
||||||
containerGroup.remove(detailIterator.key(), detailIterator.value());
|
containerGroup.erase(detailIterator);
|
||||||
|
|
||||||
if (not containerGroup.isEmpty())
|
if (not containerGroup.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
#include "../vmisc/typedef.h"
|
#include "../vmisc/typedef.h"
|
||||||
|
#include "vlayoutpiece.h"
|
||||||
|
|
||||||
// An annoying char define, from the Windows team in <rpcndr.h>
|
// An annoying char define, from the Windows team in <rpcndr.h>
|
||||||
// #define small char
|
// #define small char
|
||||||
|
@ -48,8 +49,6 @@
|
||||||
|
|
||||||
Q_DECLARE_LOGGING_CATEGORY(lBank)
|
Q_DECLARE_LOGGING_CATEGORY(lBank)
|
||||||
|
|
||||||
class VLayoutPiece;
|
|
||||||
|
|
||||||
enum class Cases : char { CaseThreeGroup = 0, CaseTwoGroup, CaseDesc, UnknownCase};
|
enum class Cases : char { CaseThreeGroup = 0, CaseTwoGroup, CaseDesc, UnknownCase};
|
||||||
|
|
||||||
class VBank
|
class VBank
|
||||||
|
@ -88,22 +87,22 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VBank)
|
Q_DISABLE_COPY(VBank)
|
||||||
QVector<VLayoutPiece> details;
|
QVector<VLayoutPiece> details{};
|
||||||
|
|
||||||
QMap<uint, QHash<int, qint64>> unsorted;
|
QMap<uint, QHash<int, qint64>> unsorted{};
|
||||||
QMap<uint, QHash<int, qint64>> big;
|
QMap<uint, QHash<int, qint64>> big{};
|
||||||
QMap<uint, QHash<int, qint64>> middle;
|
QMap<uint, QHash<int, qint64>> middle{};
|
||||||
QMap<uint, QHash<int, qint64>> small;
|
QMap<uint, QHash<int, qint64>> small{};
|
||||||
QMap<uint, QMultiMap<qint64, int>> desc;
|
QMap<uint, QMultiMap<qint64, int>> desc{};
|
||||||
|
|
||||||
QVector<uint> groups;
|
QVector<uint> groups{};
|
||||||
QVector<vidtype> arranged;
|
QVector<vidtype> arranged{};
|
||||||
|
|
||||||
qreal layoutWidth;
|
qreal layoutWidth{0};
|
||||||
|
|
||||||
Cases caseType;
|
Cases caseType{Cases::CaseDesc};
|
||||||
bool prepare;
|
bool prepare{false};
|
||||||
qreal diagonal;
|
qreal diagonal{0};
|
||||||
bool m_nestQuantity{false};
|
bool m_nestQuantity{false};
|
||||||
bool m_manualPriority{false};
|
bool m_manualPriority{false};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user