Pass original paper orientation. We cannot rely on paper size because it can be
stripped. --HG-- branch : develop
This commit is contained in:
parent
b80103e088
commit
3ca666fba3
|
@ -42,8 +42,8 @@ Q_DECL_CONSTEXPR inline qint64 Square(QSizeF size)
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VBestSquare::VBestSquare(QSizeF sheetSize, bool saveLength)
|
VBestSquare::VBestSquare(QSizeF sheetSize, bool saveLength, bool isPortrait)
|
||||||
: d(new VBestSquareData(sheetSize, saveLength))
|
: d(new VBestSquareData(sheetSize, saveLength, isPortrait))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -190,5 +190,5 @@ bool VBestSquare::IsImprovedSidePosition(qreal sidePosition) const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VBestSquare::IsPortrait() const
|
bool VBestSquare::IsPortrait() const
|
||||||
{
|
{
|
||||||
return d->sheetSize.height() >= d->sheetSize.width();
|
return d->isPortrait;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ class VBestSquareData;
|
||||||
class VBestSquare
|
class VBestSquare
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VBestSquare(QSizeF sheetSize, bool saveLength);
|
VBestSquare(QSizeF sheetSize, bool saveLength, bool isPortrait);
|
||||||
VBestSquare(const VBestSquare &res);
|
VBestSquare(const VBestSquare &res);
|
||||||
virtual ~VBestSquare();
|
virtual ~VBestSquare();
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,10 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
|
||||||
class VBestSquareData : public QSharedData
|
class VBestSquareData : public QSharedData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VBestSquareData(const QSizeF &sheetSize, bool saveLength)
|
VBestSquareData(const QSizeF &sheetSize, bool saveLength, bool isPortrait)
|
||||||
: sheetSize(sheetSize),
|
: sheetSize(sheetSize),
|
||||||
saveLength(saveLength)
|
saveLength(saveLength),
|
||||||
|
isPortrait(isPortrait)
|
||||||
{
|
{
|
||||||
data.bestSize = QSizeF(sheetSize.width()+10, sheetSize.height()+10);
|
data.bestSize = QSizeF(sheetSize.width()+10, sheetSize.height()+10);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +55,8 @@ public:
|
||||||
valideResult(res.valideResult),
|
valideResult(res.valideResult),
|
||||||
saveLength(res.saveLength),
|
saveLength(res.saveLength),
|
||||||
depthPosition(res.depthPosition),
|
depthPosition(res.depthPosition),
|
||||||
data(res.data)
|
data(res.data),
|
||||||
|
isPortrait(res.isPortrait)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~VBestSquareData() {}
|
~VBestSquareData() {}
|
||||||
|
@ -64,6 +66,7 @@ public:
|
||||||
bool saveLength;
|
bool saveLength;
|
||||||
qreal depthPosition{INT_MAX};
|
qreal depthPosition{INT_MAX};
|
||||||
VBestSquareResData data{};
|
VBestSquareResData data{};
|
||||||
|
bool isPortrait{true};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VBestSquareData &operator=(const VBestSquareData &) Q_DECL_EQ_DELETE;
|
VBestSquareData &operator=(const VBestSquareData &) Q_DECL_EQ_DELETE;
|
||||||
|
|
|
@ -106,6 +106,9 @@ void VLayoutGenerator::Generate(QElapsedTimer timer, qint64 timeout)
|
||||||
bank->Reset();
|
bank->Reset();
|
||||||
state = LayoutErrors::NoError;
|
state = LayoutErrors::NoError;
|
||||||
|
|
||||||
|
int width = PageWidth();
|
||||||
|
int height = PageHeight();
|
||||||
|
|
||||||
if (VFuzzyComparePossibleNulls(shift, -1))
|
if (VFuzzyComparePossibleNulls(shift, -1))
|
||||||
{
|
{
|
||||||
if (bank->PrepareDetails())
|
if (bank->PrepareDetails())
|
||||||
|
@ -118,9 +121,6 @@ void VLayoutGenerator::Generate(QElapsedTimer timer, qint64 timeout)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int width = PageWidth();
|
|
||||||
int height = PageHeight();
|
|
||||||
|
|
||||||
if (stripOptimization)
|
if (stripOptimization)
|
||||||
{
|
{
|
||||||
const qreal b = bank->GetBiggestDiagonal() * multiplier + bank->GetLayoutWidth();
|
const qreal b = bank->GetBiggestDiagonal() * multiplier + bank->GetLayoutWidth();
|
||||||
|
@ -172,7 +172,7 @@ void VLayoutGenerator::Generate(QElapsedTimer timer, qint64 timeout)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VLayoutPaper paper(PageHeight(), PageWidth(), bank->GetLayoutWidth());
|
VLayoutPaper paper(height, width, bank->GetLayoutWidth());
|
||||||
paper.SetShift(shift);
|
paper.SetShift(shift);
|
||||||
paper.SetPaperIndex(static_cast<quint32>(papers.count()));
|
paper.SetPaperIndex(static_cast<quint32>(papers.count()));
|
||||||
paper.SetRotate(rotate);
|
paper.SetRotate(rotate);
|
||||||
|
|
|
@ -243,7 +243,7 @@ int VLayoutPaper::Count() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VLayoutPaper::AddToSheet(const VLayoutPiece &detail, std::atomic_bool &stop)
|
bool VLayoutPaper::AddToSheet(const VLayoutPiece &detail, std::atomic_bool &stop)
|
||||||
{
|
{
|
||||||
VBestSquare bestResult(d->globalContour.GetSize(), d->saveLength);
|
VBestSquare bestResult(d->globalContour.GetSize(), d->saveLength, d->originPaperOrientation);
|
||||||
QThreadPool *thread_pool = QThreadPool::globalInstance();
|
QThreadPool *thread_pool = QThreadPool::globalInstance();
|
||||||
thread_pool->setExpiryTimeout(1000);
|
thread_pool->setExpiryTimeout(1000);
|
||||||
QVector<VPosition *> threads;
|
QVector<VPosition *> threads;
|
||||||
|
|
|
@ -136,7 +136,7 @@ QPainterPath DrawDetails(const QVector<VLayoutPiece> &details)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPosition::VPosition(const VPositionData &data, std::atomic_bool *stop, bool saveLength)
|
VPosition::VPosition(const VPositionData &data, std::atomic_bool *stop, bool saveLength)
|
||||||
: QRunnable(),
|
: QRunnable(),
|
||||||
m_bestResult(VBestSquare(data.gContour.GetSize(), saveLength)),
|
m_bestResult(VBestSquare(data.gContour.GetSize(), saveLength, data.isOriginPaperOrientationPortrait)),
|
||||||
m_data(data),
|
m_data(data),
|
||||||
#ifdef LAYOUT_DEBUG
|
#ifdef LAYOUT_DEBUG
|
||||||
paperIndex(0),
|
paperIndex(0),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user