2015-01-02 14:53:36 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vlayoutgenerator.cpp
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 2 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-02 14:53:36 +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
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2015-01-02 14:53:36 +01:00
|
|
|
**
|
|
|
|
** 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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "vlayoutgenerator.h"
|
|
|
|
|
2019-03-30 10:17:54 +01:00
|
|
|
#include <QElapsedTimer>
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QGraphicsRectItem>
|
2015-01-12 13:12:15 +01:00
|
|
|
#include <QRectF>
|
2015-05-02 19:18:31 +02:00
|
|
|
#include <QThreadPool>
|
2016-08-08 13:44:49 +02:00
|
|
|
|
|
|
|
#include "../vmisc/def.h"
|
2016-08-16 18:57:32 +02:00
|
|
|
#include "../vmisc/vmath.h"
|
2020-01-16 18:09:23 +01:00
|
|
|
#include "../vmisc/compatibility.h"
|
2017-01-22 10:02:02 +01:00
|
|
|
#include "vlayoutpiece.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "vlayoutpaper.h"
|
2019-06-24 11:14:10 +02:00
|
|
|
#include "../ifc/exception/vexceptionterminatedposition.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
|
2015-01-12 13:12:15 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VLayoutGenerator::VLayoutGenerator(QObject *parent)
|
2017-02-22 13:04:47 +01:00
|
|
|
: QObject(parent),
|
|
|
|
papers(),
|
|
|
|
bank(new VBank()),
|
|
|
|
paperHeight(0),
|
|
|
|
paperWidth(0),
|
|
|
|
margins(),
|
|
|
|
usePrinterFields(true),
|
2017-02-26 14:52:00 +01:00
|
|
|
#ifdef Q_CC_MSVC
|
|
|
|
// See https://stackoverflow.com/questions/15750917/initializing-stdatomic-bool
|
2017-02-26 11:25:14 +01:00
|
|
|
stopGeneration(ATOMIC_VAR_INIT(false)),
|
2017-02-26 14:52:00 +01:00
|
|
|
#else
|
|
|
|
stopGeneration(false),
|
|
|
|
#endif
|
2017-02-22 13:04:47 +01:00
|
|
|
state(LayoutErrors::NoError),
|
|
|
|
shift(0),
|
|
|
|
rotate(true),
|
2018-12-27 14:54:29 +01:00
|
|
|
followGrainline(false),
|
2019-03-29 18:52:37 +01:00
|
|
|
rotationNumber(2),
|
2019-10-16 10:16:16 +02:00
|
|
|
autoCropLength(false),
|
|
|
|
autoCropWidth(false),
|
2017-02-22 13:04:47 +01:00
|
|
|
saveLength(false),
|
|
|
|
unitePages(false),
|
|
|
|
stripOptimizationEnabled(false),
|
|
|
|
multiplier(1),
|
2017-07-01 19:32:54 +02:00
|
|
|
stripOptimization(false),
|
|
|
|
textAsPaths(false)
|
2015-01-12 13:12:15 +01:00
|
|
|
{}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VLayoutGenerator::~VLayoutGenerator()
|
|
|
|
{
|
|
|
|
delete bank;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2017-01-22 10:02:02 +01:00
|
|
|
void VLayoutGenerator::SetDetails(const QVector<VLayoutPiece> &details)
|
2015-01-02 14:53:36 +01:00
|
|
|
{
|
2015-01-12 13:12:15 +01:00
|
|
|
bank->SetDetails(details);
|
2015-01-02 14:53:36 +01:00
|
|
|
}
|
2015-01-12 13:12:15 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetLayoutWidth(qreal width)
|
|
|
|
{
|
|
|
|
bank->SetLayoutWidth(width);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetCaseType(Cases caseType)
|
|
|
|
{
|
|
|
|
bank->SetCaseType(caseType);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-04-15 14:44:57 +02:00
|
|
|
// cppcheck-suppress unusedFunction
|
2015-01-12 13:12:15 +01:00
|
|
|
int VLayoutGenerator::DetailsCount()
|
|
|
|
{
|
|
|
|
return bank->AllDetailsCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-06-18 15:04:50 +02:00
|
|
|
void VLayoutGenerator::Generate(const QElapsedTimer &timer, qint64 timeout, LayoutErrors previousState)
|
2015-01-12 13:12:15 +01:00
|
|
|
{
|
2019-06-18 14:14:52 +02:00
|
|
|
auto HasExpired = [this, timer, timeout]()
|
|
|
|
{
|
|
|
|
if (timer.hasExpired(timeout))
|
|
|
|
{
|
2019-10-18 10:47:02 +02:00
|
|
|
Timeout();
|
2019-06-18 14:14:52 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
2019-10-18 10:47:02 +02:00
|
|
|
if (HasExpired())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (state != LayoutErrors::Timeout)
|
|
|
|
{
|
|
|
|
stopGeneration.store(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
papers.clear();
|
|
|
|
bank->Reset();
|
|
|
|
state = previousState;
|
|
|
|
|
|
|
|
int width = PageWidth();
|
|
|
|
int height = PageHeight();
|
|
|
|
|
2019-03-30 10:17:54 +01:00
|
|
|
if (VFuzzyComparePossibleNulls(shift, -1))
|
2015-01-12 13:12:15 +01:00
|
|
|
{
|
2019-03-30 10:17:54 +01:00
|
|
|
if (bank->PrepareDetails())
|
|
|
|
{
|
2019-07-21 09:10:41 +02:00
|
|
|
SetShift(ToPixel(1, Unit::Cm));
|
2019-03-30 10:17:54 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
state = LayoutErrors::PrepareLayoutError;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-02-23 13:13:10 +01:00
|
|
|
if (stripOptimization)
|
|
|
|
{
|
|
|
|
const qreal b = bank->GetBiggestDiagonal() * multiplier + bank->GetLayoutWidth();
|
|
|
|
|
2019-01-02 15:49:57 +01:00
|
|
|
auto SetStrip = [this, b](int &side)
|
2016-02-23 13:13:10 +01:00
|
|
|
{
|
2019-01-02 15:49:57 +01:00
|
|
|
if (side >= b*2)
|
|
|
|
{
|
|
|
|
stripOptimizationEnabled = true;
|
|
|
|
side = qFloor(side / qFloor(side/b));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
IsPortrait() ? SetStrip(height) : SetStrip(width);
|
2016-02-23 13:13:10 +01:00
|
|
|
}
|
2019-03-30 10:17:54 +01:00
|
|
|
}
|
|
|
|
|
2019-06-18 14:14:52 +02:00
|
|
|
if (HasExpired())
|
2019-03-30 10:17:54 +01:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bank->PrepareUnsorted())
|
|
|
|
{
|
2019-06-18 14:14:52 +02:00
|
|
|
if (HasExpired())
|
2019-03-30 10:17:54 +01:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2016-02-23 13:13:10 +01:00
|
|
|
|
2015-01-16 20:34:37 +01:00
|
|
|
while (bank->AllDetailsCount() > 0)
|
2015-01-12 13:12:15 +01:00
|
|
|
{
|
2017-02-22 13:04:47 +01:00
|
|
|
if (stopGeneration.load())
|
2015-01-12 13:12:15 +01:00
|
|
|
{
|
2019-03-30 10:17:54 +01:00
|
|
|
return;
|
2015-01-12 13:12:15 +01:00
|
|
|
}
|
|
|
|
|
2019-06-18 14:14:52 +02:00
|
|
|
if (HasExpired())
|
2019-03-30 10:17:54 +01:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-06-18 13:36:20 +02:00
|
|
|
VLayoutPaper paper(height, width, bank->GetLayoutWidth());
|
2015-01-12 16:23:25 +01:00
|
|
|
paper.SetShift(shift);
|
2015-03-16 13:23:02 +01:00
|
|
|
paper.SetPaperIndex(static_cast<quint32>(papers.count()));
|
2015-01-22 15:11:50 +01:00
|
|
|
paper.SetRotate(rotate);
|
2018-12-27 14:54:29 +01:00
|
|
|
paper.SetFollowGrainline(followGrainline);
|
2019-03-29 18:52:37 +01:00
|
|
|
paper.SetRotationNumber(rotationNumber);
|
2015-05-08 12:10:56 +02:00
|
|
|
paper.SetSaveLength(saveLength);
|
2019-06-18 13:28:16 +02:00
|
|
|
paper.SetOriginPaperPortrait(IsPortrait());
|
2015-01-16 20:34:37 +01:00
|
|
|
do
|
2015-01-12 13:12:15 +01:00
|
|
|
{
|
2019-03-26 16:47:27 +01:00
|
|
|
const int index = bank->GetNext();
|
2019-06-24 11:14:10 +02:00
|
|
|
try
|
2015-01-12 13:12:15 +01:00
|
|
|
{
|
2019-06-24 11:14:10 +02:00
|
|
|
if (paper.ArrangeDetail(bank->GetDetail(index), stopGeneration))
|
|
|
|
{
|
|
|
|
bank->Arranged(index);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bank->NotArranged(index);
|
|
|
|
}
|
2015-01-12 13:12:15 +01:00
|
|
|
}
|
2019-06-24 11:14:10 +02:00
|
|
|
catch (const VExceptionTerminatedPosition &e)
|
2015-01-12 13:12:15 +01:00
|
|
|
{
|
2019-06-24 11:14:10 +02:00
|
|
|
qCritical() << e.ErrorMessage();
|
|
|
|
state = LayoutErrors::TerminatedByException;
|
|
|
|
return;
|
2015-01-12 13:12:15 +01:00
|
|
|
}
|
2015-01-16 15:45:56 +01:00
|
|
|
|
2019-03-30 10:17:54 +01:00
|
|
|
QCoreApplication::processEvents();
|
|
|
|
|
2017-02-22 13:04:47 +01:00
|
|
|
if (stopGeneration.load())
|
2015-01-16 15:45:56 +01:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2019-03-30 10:17:54 +01:00
|
|
|
|
2019-06-18 14:14:52 +02:00
|
|
|
if (HasExpired())
|
2019-03-30 10:17:54 +01:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2019-03-26 16:47:27 +01:00
|
|
|
} while(bank->LeftToArrange() > 0);
|
2015-01-16 20:34:37 +01:00
|
|
|
|
2017-02-22 13:04:47 +01:00
|
|
|
if (stopGeneration.load())
|
2015-01-17 14:14:28 +01:00
|
|
|
{
|
2019-03-30 10:17:54 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-06-18 14:14:52 +02:00
|
|
|
if (HasExpired())
|
2019-03-30 10:17:54 +01:00
|
|
|
{
|
|
|
|
return;
|
2015-01-17 14:14:28 +01:00
|
|
|
}
|
|
|
|
|
2015-01-16 20:34:37 +01:00
|
|
|
if (paper.Count() > 0)
|
|
|
|
{
|
|
|
|
papers.append(paper);
|
2015-01-12 13:12:15 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-01-16 20:34:37 +01:00
|
|
|
state = LayoutErrors::EmptyPaperError;
|
|
|
|
return;
|
2015-01-12 13:12:15 +01:00
|
|
|
}
|
2015-01-16 20:34:37 +01:00
|
|
|
}
|
2015-01-12 13:12:15 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
state = LayoutErrors::PrepareLayoutError;
|
|
|
|
return;
|
|
|
|
}
|
2016-02-23 13:13:10 +01:00
|
|
|
|
2019-06-18 14:14:52 +02:00
|
|
|
if (HasExpired())
|
2019-03-30 10:17:54 +01:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-02-23 13:13:10 +01:00
|
|
|
if (stripOptimizationEnabled)
|
|
|
|
{
|
|
|
|
GatherPages();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IsUnitePages())
|
|
|
|
{
|
|
|
|
UnitePages();
|
|
|
|
}
|
2019-03-29 18:52:37 +01:00
|
|
|
}
|
2016-02-23 13:13:10 +01:00
|
|
|
|
2019-03-29 18:52:37 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
qreal VLayoutGenerator::LayoutEfficiency() const
|
|
|
|
{
|
|
|
|
qreal efficiency = 0;
|
|
|
|
if (not papers.isEmpty())
|
|
|
|
{
|
2020-03-22 17:21:13 +01:00
|
|
|
efficiency = MasterPage().Efficiency();
|
2019-03-29 18:52:37 +01:00
|
|
|
}
|
|
|
|
return efficiency;
|
2015-01-12 13:12:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
LayoutErrors VLayoutGenerator::State() const
|
|
|
|
{
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2015-01-13 11:38:51 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-01-23 11:07:58 +01:00
|
|
|
QList<QGraphicsItem *> VLayoutGenerator::GetPapersItems() const
|
2015-01-13 11:38:51 +01:00
|
|
|
{
|
|
|
|
QList<QGraphicsItem *> list;
|
2018-04-03 13:36:38 +02:00
|
|
|
for (auto &paper : papers)
|
2015-01-13 11:38:51 +01:00
|
|
|
{
|
2019-10-16 10:16:16 +02:00
|
|
|
list.append(paper.GetPaperItem(autoCropLength, autoCropWidth, IsTestAsPaths()));
|
2015-01-23 11:07:58 +01:00
|
|
|
}
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2019-03-27 09:29:59 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QList<QGraphicsItem *> VLayoutGenerator::GetGlobalContours() const
|
|
|
|
{
|
|
|
|
QList<QGraphicsItem *> list;
|
|
|
|
for (auto &paper : papers)
|
|
|
|
{
|
|
|
|
list.append(paper.GetGlobalContour());
|
|
|
|
}
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2015-01-23 11:07:58 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2017-07-16 20:10:48 +02:00
|
|
|
QList<QList<QGraphicsItem *> > VLayoutGenerator::GetAllDetailsItems() const
|
2015-01-23 11:07:58 +01:00
|
|
|
{
|
|
|
|
QList<QList<QGraphicsItem *> > list;
|
2018-04-03 13:36:38 +02:00
|
|
|
for (auto &paper : papers)
|
2015-01-23 11:07:58 +01:00
|
|
|
{
|
2018-04-03 13:36:38 +02:00
|
|
|
list.append(paper.GetItemDetails(IsTestAsPaths()));
|
2015-01-13 11:38:51 +01:00
|
|
|
}
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2017-07-16 20:10:48 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QVector<QVector<VLayoutPiece> > VLayoutGenerator::GetAllDetails() const
|
|
|
|
{
|
|
|
|
QVector<QVector<VLayoutPiece> > list;
|
2018-04-03 13:36:38 +02:00
|
|
|
for (auto &paper : papers)
|
2017-07-16 20:10:48 +02:00
|
|
|
{
|
2018-04-03 13:36:38 +02:00
|
|
|
list.append(paper.GetDetails());
|
2017-07-16 20:10:48 +02:00
|
|
|
}
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2015-01-12 13:12:15 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::Abort()
|
|
|
|
{
|
2017-02-22 13:04:47 +01:00
|
|
|
stopGeneration.store(true);
|
2015-01-16 15:45:56 +01:00
|
|
|
state = LayoutErrors::ProcessStoped;
|
2015-01-12 13:12:15 +01:00
|
|
|
}
|
|
|
|
|
2019-04-02 14:29:33 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::Timeout()
|
|
|
|
{
|
|
|
|
stopGeneration.store(true);
|
2019-06-18 14:14:52 +02:00
|
|
|
if (state == LayoutErrors::NoError)
|
|
|
|
{
|
|
|
|
state = LayoutErrors::Timeout;
|
|
|
|
}
|
2019-04-02 14:29:33 +02:00
|
|
|
}
|
|
|
|
|
2016-02-23 13:13:10 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VLayoutGenerator::IsStripOptimization() const
|
|
|
|
{
|
|
|
|
return stripOptimization;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetStripOptimization(bool value)
|
|
|
|
{
|
|
|
|
stripOptimization = value;
|
|
|
|
}
|
|
|
|
|
2017-07-01 19:32:54 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VLayoutGenerator::IsTestAsPaths() const
|
|
|
|
{
|
|
|
|
return textAsPaths;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-03-26 16:30:25 +01:00
|
|
|
void VLayoutGenerator::SetTextAsPaths(bool value)
|
2017-07-01 19:32:54 +02:00
|
|
|
{
|
|
|
|
textAsPaths = value;
|
|
|
|
}
|
|
|
|
|
2019-03-30 10:17:54 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VLayoutGenerator::IsRotationNeeded() const
|
|
|
|
{
|
|
|
|
if (followGrainline)
|
|
|
|
{
|
|
|
|
return bank->IsRotationNeeded();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-23 13:13:10 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
quint8 VLayoutGenerator::GetMultiplier() const
|
|
|
|
{
|
|
|
|
return multiplier;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-01-02 15:52:07 +01:00
|
|
|
void VLayoutGenerator::SetMultiplier(quint8 value)
|
2016-02-23 13:13:10 +01:00
|
|
|
{
|
|
|
|
if (value > 10)
|
|
|
|
{
|
|
|
|
multiplier = 10;
|
|
|
|
}
|
|
|
|
else if (value == 0)
|
|
|
|
{
|
|
|
|
multiplier = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
multiplier = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-09 12:33:36 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
int VLayoutGenerator::PageHeight() const
|
|
|
|
{
|
2015-11-09 12:58:45 +01:00
|
|
|
return static_cast<int>(paperHeight - (margins.top() + margins.bottom()));
|
2015-11-09 12:33:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
int VLayoutGenerator::PageWidth() const
|
|
|
|
{
|
2015-11-09 12:58:45 +01:00
|
|
|
return static_cast<int>(paperWidth - (margins.left() + margins.right()));
|
2015-11-09 12:33:36 +01:00
|
|
|
}
|
|
|
|
|
2019-01-02 15:49:57 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VLayoutGenerator::IsPortrait() const
|
|
|
|
{
|
|
|
|
return PageHeight() >= PageWidth();
|
|
|
|
}
|
|
|
|
|
2016-02-23 13:13:10 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::GatherPages()
|
|
|
|
{
|
2017-01-22 10:02:02 +01:00
|
|
|
QList<QList<VLayoutPiece>> nDetails;
|
2016-02-23 13:13:10 +01:00
|
|
|
qreal length = 0;
|
|
|
|
int j = 0; // papers count
|
|
|
|
|
|
|
|
for (int i = 0; i < papers.size(); ++i)
|
|
|
|
{
|
2019-07-24 17:07:17 +02:00
|
|
|
const QRectF rec = papers.at(i).DetailsBoundingRect();
|
2019-01-03 18:35:04 +01:00
|
|
|
if (IsPortrait())
|
2016-12-10 17:38:34 +01:00
|
|
|
{
|
2019-07-24 17:07:17 +02:00
|
|
|
int paperHeight = qRound(rec.y() + rec.height());
|
2016-12-10 17:38:34 +01:00
|
|
|
|
2019-01-03 18:35:04 +01:00
|
|
|
if (i != papers.size()-1)
|
|
|
|
{
|
|
|
|
paperHeight += qRound(bank->GetLayoutWidth()*2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (length + paperHeight <= PageHeight())
|
|
|
|
{
|
|
|
|
UniteDetails(j, nDetails, length, i);
|
|
|
|
length += paperHeight;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
length = 0; // Start new paper
|
|
|
|
++j;// New paper
|
|
|
|
UniteDetails(j, nDetails, length, i);
|
|
|
|
length += paperHeight;
|
|
|
|
}
|
2016-02-23 13:13:10 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-07-24 17:07:17 +02:00
|
|
|
int paperWidth = qRound(rec.x() + rec.width());
|
2019-01-03 18:35:04 +01:00
|
|
|
|
|
|
|
if (i != papers.size()-1)
|
|
|
|
{
|
|
|
|
paperWidth += qRound(bank->GetLayoutWidth()*2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (length + paperWidth <= PageWidth())
|
|
|
|
{
|
|
|
|
UniteDetails(j, nDetails, length, i);
|
|
|
|
length += paperWidth;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
length = 0; // Start new paper
|
|
|
|
++j;// New paper
|
|
|
|
UniteDetails(j, nDetails, length, i);
|
|
|
|
length += paperWidth;
|
|
|
|
}
|
2016-02-23 13:13:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QVector<VLayoutPaper> nPapers;
|
2019-07-24 17:10:32 +02:00
|
|
|
nPapers.reserve(nDetails.size());
|
2016-02-23 13:13:10 +01:00
|
|
|
for (int i = 0; i < nDetails.size(); ++i)
|
|
|
|
{
|
2019-03-27 08:03:19 +01:00
|
|
|
VLayoutPaper paper(PageHeight(), PageWidth(), bank->GetLayoutWidth());
|
2016-02-23 13:13:10 +01:00
|
|
|
paper.SetShift(shift);
|
2016-05-03 18:50:37 +02:00
|
|
|
paper.SetPaperIndex(static_cast<quint32>(i));
|
2016-02-23 13:13:10 +01:00
|
|
|
paper.SetRotate(rotate);
|
2018-12-27 14:54:29 +01:00
|
|
|
paper.SetFollowGrainline(followGrainline);
|
2019-03-29 18:52:37 +01:00
|
|
|
paper.SetRotationNumber(rotationNumber);
|
2016-02-23 13:13:10 +01:00
|
|
|
paper.SetSaveLength(saveLength);
|
|
|
|
paper.SetDetails(nDetails.at(i));
|
|
|
|
|
|
|
|
nPapers.append(paper);
|
|
|
|
}
|
|
|
|
|
|
|
|
papers.clear();
|
|
|
|
papers = nPapers;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::UnitePages()
|
|
|
|
{
|
|
|
|
if (papers.size() < 2)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
QList<qreal> papersLength;
|
2017-01-22 10:02:02 +01:00
|
|
|
QList<QList<VLayoutPiece> > nDetails;
|
2016-02-23 13:13:10 +01:00
|
|
|
qreal length = 0;
|
|
|
|
int j = 0; // papers count
|
|
|
|
|
|
|
|
for (int i = 0; i < papers.size(); ++i)
|
|
|
|
{
|
2019-01-03 18:35:04 +01:00
|
|
|
if (IsPortrait())
|
2016-02-23 13:13:10 +01:00
|
|
|
{
|
2019-01-03 18:35:04 +01:00
|
|
|
int paperHeight = 0;
|
2019-10-16 10:16:16 +02:00
|
|
|
if (autoCropLength)
|
2019-01-03 18:35:04 +01:00
|
|
|
{
|
2019-07-24 17:07:17 +02:00
|
|
|
const QRectF rec = papers.at(i).DetailsBoundingRect();
|
|
|
|
paperHeight = qRound(rec.y() + rec.height());
|
2019-01-03 18:35:04 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
paperHeight = papers.at(i).GetHeight();
|
|
|
|
}
|
2016-02-23 13:13:10 +01:00
|
|
|
|
2019-01-03 18:35:04 +01:00
|
|
|
if (i != papers.size()-1)
|
|
|
|
{
|
|
|
|
paperHeight = qRound(paperHeight + bank->GetLayoutWidth()*2);
|
|
|
|
}
|
2016-02-23 13:13:10 +01:00
|
|
|
|
2019-01-03 18:35:04 +01:00
|
|
|
if (length + paperHeight <= QIMAGE_MAX)
|
|
|
|
{
|
|
|
|
UniteDetails(j, nDetails, length, i);
|
|
|
|
length += paperHeight;
|
|
|
|
UnitePapers(j, papersLength, length);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
length = 0; // Start new paper
|
|
|
|
++j;// New paper
|
|
|
|
UniteDetails(j, nDetails, length, i);
|
|
|
|
length += paperHeight;
|
|
|
|
UnitePapers(j, papersLength, length);
|
|
|
|
}
|
2016-02-23 13:13:10 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-01-03 18:35:04 +01:00
|
|
|
int paperWidth = 0;
|
2019-10-16 10:16:16 +02:00
|
|
|
if (autoCropLength)
|
2019-01-03 18:35:04 +01:00
|
|
|
{
|
2019-07-24 17:07:17 +02:00
|
|
|
const QRectF rec = papers.at(i).DetailsBoundingRect();
|
|
|
|
paperWidth = qRound(rec.x() + rec.width());
|
2019-01-03 18:35:04 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
paperWidth = papers.at(i).GetWidth();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i != papers.size()-1)
|
|
|
|
{
|
|
|
|
paperWidth = qRound(paperWidth + bank->GetLayoutWidth()*2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (length + paperWidth <= QIMAGE_MAX)
|
|
|
|
{
|
|
|
|
UniteDetails(j, nDetails, length, i);
|
|
|
|
length += paperWidth;
|
|
|
|
UnitePapers(j, papersLength, length);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
length = 0; // Start new paper
|
|
|
|
++j;// New paper
|
|
|
|
UniteDetails(j, nDetails, length, i);
|
|
|
|
length += paperWidth;
|
|
|
|
UnitePapers(j, papersLength, length);
|
|
|
|
}
|
2016-02-23 13:13:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QVector<VLayoutPaper> nPapers;
|
2019-07-24 17:10:32 +02:00
|
|
|
nPapers.reserve(nDetails.size());
|
2016-02-23 13:13:10 +01:00
|
|
|
for (int i = 0; i < nDetails.size(); ++i)
|
|
|
|
{
|
2019-07-24 17:07:17 +02:00
|
|
|
const int height = IsPortrait() ? qRound(papersLength.at(i)+accuracyPointOnLine*4) : PageHeight();
|
|
|
|
const int width = IsPortrait() ? PageWidth() : qRound(papersLength.at(i)+accuracyPointOnLine*4);
|
2019-01-03 18:35:04 +01:00
|
|
|
|
2019-03-27 08:03:19 +01:00
|
|
|
VLayoutPaper paper(height, width, bank->GetLayoutWidth());
|
2016-02-23 13:13:10 +01:00
|
|
|
paper.SetShift(shift);
|
2016-05-03 18:50:37 +02:00
|
|
|
paper.SetPaperIndex(static_cast<quint32>(i));
|
2016-02-23 13:13:10 +01:00
|
|
|
paper.SetRotate(rotate);
|
2018-12-27 14:54:29 +01:00
|
|
|
paper.SetFollowGrainline(followGrainline);
|
2019-03-29 18:52:37 +01:00
|
|
|
paper.SetRotationNumber(rotationNumber);
|
2016-02-23 13:13:10 +01:00
|
|
|
paper.SetSaveLength(saveLength);
|
|
|
|
paper.SetDetails(nDetails.at(i));
|
|
|
|
|
|
|
|
nPapers.append(paper);
|
|
|
|
}
|
|
|
|
|
|
|
|
papers.clear();
|
|
|
|
papers = nPapers;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2020-03-22 17:21:13 +01:00
|
|
|
void VLayoutGenerator::UniteDetails(int j, QList<QList<VLayoutPiece> > &nDetails, qreal length, int i) const
|
2016-02-23 13:13:10 +01:00
|
|
|
{
|
|
|
|
if ((j == 0 && nDetails.isEmpty()) || j >= nDetails.size())
|
|
|
|
{//First or new details in paper
|
|
|
|
nDetails.insert(j, MoveDetails(length, papers.at(i).GetDetails()));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nDetails[j].append(MoveDetails(length, papers.at(i).GetDetails()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::UnitePapers(int j, QList<qreal> &papersLength, qreal length)
|
|
|
|
{
|
|
|
|
if ((j == 0 && papersLength.isEmpty()) || j >= papersLength.size())
|
|
|
|
{
|
|
|
|
papersLength.insert(j, length);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
papersLength[j] = length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2020-03-22 17:21:13 +01:00
|
|
|
QList<VLayoutPiece> VLayoutGenerator::MoveDetails(qreal length, const QVector<VLayoutPiece> &details) const
|
2016-02-23 13:13:10 +01:00
|
|
|
{
|
|
|
|
if (qFuzzyIsNull(length))
|
|
|
|
{
|
2020-01-16 18:09:23 +01:00
|
|
|
return ConvertToList(details);
|
2016-02-23 13:13:10 +01:00
|
|
|
}
|
|
|
|
|
2017-01-22 10:02:02 +01:00
|
|
|
QList<VLayoutPiece> newDetails;
|
2018-04-03 13:36:38 +02:00
|
|
|
for (auto d : details)
|
2016-02-23 13:13:10 +01:00
|
|
|
{
|
2019-01-03 18:35:04 +01:00
|
|
|
IsPortrait() ? d.Translate(0, length) : d.Translate(length, 0);
|
2016-02-23 13:13:10 +01:00
|
|
|
newDetails.append(d);
|
|
|
|
}
|
|
|
|
|
|
|
|
return newDetails;
|
|
|
|
}
|
|
|
|
|
2020-03-22 17:21:13 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief MasterPage return one "master" page combined all pieces on all pages.
|
|
|
|
*
|
|
|
|
* The main purpose of this method is to return the master page. This way we can efficiently calculate the efficiency
|
|
|
|
* of a solution taking into account empty space between bounding rectangles.
|
|
|
|
*
|
|
|
|
* @return master page
|
|
|
|
*/
|
|
|
|
VLayoutPaper VLayoutGenerator::MasterPage() const
|
|
|
|
{
|
|
|
|
if (papers.size() < 2)
|
|
|
|
{
|
|
|
|
return papers.first();
|
|
|
|
}
|
|
|
|
|
|
|
|
QList<QList<VLayoutPiece> > nDetails;
|
|
|
|
qreal length = 0;
|
|
|
|
const int j = 0; // papers count. Always 1.
|
|
|
|
|
|
|
|
for (int i = 0; i < papers.size(); ++i)
|
|
|
|
{
|
|
|
|
if (IsPortrait())
|
|
|
|
{
|
|
|
|
int paperHeight = 0;
|
|
|
|
if (autoCropLength)
|
|
|
|
{
|
|
|
|
const QRectF rec = papers.at(i).DetailsBoundingRect();
|
|
|
|
paperHeight = qRound(rec.y() + rec.height());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
paperHeight = papers.at(i).GetHeight();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i != papers.size()-1)
|
|
|
|
{
|
|
|
|
paperHeight = qRound(paperHeight + bank->GetLayoutWidth()*2);
|
|
|
|
}
|
|
|
|
|
|
|
|
UniteDetails(j, nDetails, length, i);
|
|
|
|
length += paperHeight;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int paperWidth = 0;
|
|
|
|
if (autoCropLength)
|
|
|
|
{
|
|
|
|
const QRectF rec = papers.at(i).DetailsBoundingRect();
|
|
|
|
paperWidth = qRound(rec.x() + rec.width());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
paperWidth = papers.at(i).GetWidth();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i != papers.size()-1)
|
|
|
|
{
|
|
|
|
paperWidth = qRound(paperWidth + bank->GetLayoutWidth()*2);
|
|
|
|
}
|
|
|
|
|
|
|
|
UniteDetails(j, nDetails, length, i);
|
|
|
|
length += paperWidth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const int height = IsPortrait() ? qRound(length+accuracyPointOnLine*4) : PageHeight();
|
|
|
|
const int width = IsPortrait() ? PageWidth() : qRound(length+accuracyPointOnLine*4);
|
|
|
|
|
|
|
|
VLayoutPaper paper(height, width, bank->GetLayoutWidth());
|
|
|
|
paper.SetShift(shift);
|
|
|
|
paper.SetPaperIndex(static_cast<quint32>(0));
|
|
|
|
paper.SetRotate(rotate);
|
|
|
|
paper.SetFollowGrainline(followGrainline);
|
|
|
|
paper.SetRotationNumber(rotationNumber);
|
|
|
|
paper.SetSaveLength(saveLength);
|
|
|
|
paper.SetDetails(nDetails.at(0));
|
|
|
|
|
|
|
|
return paper;
|
|
|
|
}
|
|
|
|
|
2015-05-18 13:26:37 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VLayoutGenerator::IsUnitePages() const
|
|
|
|
{
|
|
|
|
return unitePages;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetUnitePages(bool value)
|
|
|
|
{
|
|
|
|
unitePages = value;
|
|
|
|
}
|
|
|
|
|
2015-05-08 12:10:56 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VLayoutGenerator::IsSaveLength() const
|
|
|
|
{
|
|
|
|
return saveLength;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetSaveLength(bool value)
|
|
|
|
{
|
|
|
|
saveLength = value;
|
|
|
|
}
|
|
|
|
|
2020-03-22 15:22:03 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VLayoutGenerator::IsPreferOneSheetSolution() const
|
|
|
|
{
|
|
|
|
return preferOneSheetSolution;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetPreferOneSheetSolution(bool value)
|
|
|
|
{
|
|
|
|
preferOneSheetSolution = value;
|
|
|
|
}
|
|
|
|
|
2015-05-02 18:21:47 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-10-16 10:16:16 +02:00
|
|
|
bool VLayoutGenerator::GetAutoCropLength() const
|
2015-05-02 18:21:47 +02:00
|
|
|
{
|
2019-10-16 10:16:16 +02:00
|
|
|
return autoCropLength;
|
2015-05-02 18:21:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-10-16 10:16:16 +02:00
|
|
|
void VLayoutGenerator::SetAutoCropLength(bool value)
|
2015-05-02 18:21:47 +02:00
|
|
|
{
|
2019-10-16 10:16:16 +02:00
|
|
|
autoCropLength = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool VLayoutGenerator::GetAutoCropWidth() const
|
|
|
|
{
|
|
|
|
return autoCropWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetAutoCropWidth(bool value)
|
|
|
|
{
|
|
|
|
autoCropWidth = value;
|
2015-05-02 18:21:47 +02:00
|
|
|
}
|
|
|
|
|
2015-01-22 15:11:50 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-04-15 14:44:57 +02:00
|
|
|
// cppcheck-suppress unusedFunction
|
2019-03-29 18:52:37 +01:00
|
|
|
int VLayoutGenerator::GetRotationNumber() const
|
2015-01-22 15:11:50 +01:00
|
|
|
{
|
2019-03-29 18:52:37 +01:00
|
|
|
return rotationNumber;
|
2015-01-22 15:11:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-03-29 18:52:37 +01:00
|
|
|
void VLayoutGenerator::SetRotationNumber(int value)
|
2015-01-22 15:11:50 +01:00
|
|
|
{
|
2019-03-29 18:52:37 +01:00
|
|
|
rotationNumber = value;
|
2015-01-22 15:11:50 +01:00
|
|
|
|
2019-03-29 18:52:37 +01:00
|
|
|
if (rotationNumber > 360 || rotationNumber < 1)
|
2015-01-22 15:11:50 +01:00
|
|
|
{
|
2019-03-29 18:52:37 +01:00
|
|
|
rotationNumber = 2;
|
2015-01-22 15:11:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VLayoutGenerator::GetRotate() const
|
|
|
|
{
|
|
|
|
return rotate;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetRotate(bool value)
|
|
|
|
{
|
|
|
|
rotate = value;
|
|
|
|
}
|
|
|
|
|
2018-12-27 14:54:29 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VLayoutGenerator::GetFollowGrainline() const
|
|
|
|
{
|
|
|
|
return followGrainline;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetFollowGrainline(bool value)
|
|
|
|
{
|
|
|
|
followGrainline = value;
|
|
|
|
}
|
|
|
|
|
2019-07-21 15:26:21 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VLayoutGenerator::GetManualPriority() const
|
|
|
|
{
|
|
|
|
return bank->GetManualPriority();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetManualPriority(bool value)
|
|
|
|
{
|
|
|
|
bank->SetManualPriority(value);
|
|
|
|
}
|
|
|
|
|
2019-07-04 13:33:45 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VLayoutGenerator::IsNestQuantity() const
|
|
|
|
{
|
|
|
|
return bank->IsNestQuantity();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetNestQuantity(bool value)
|
|
|
|
{
|
|
|
|
bank->SetNestQuantity(value);
|
|
|
|
}
|
|
|
|
|
2015-01-12 13:12:15 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-11-09 12:58:45 +01:00
|
|
|
qreal VLayoutGenerator::GetPaperWidth() const
|
2015-01-12 13:12:15 +01:00
|
|
|
{
|
|
|
|
return paperWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-11-09 12:58:45 +01:00
|
|
|
void VLayoutGenerator::SetPaperWidth(qreal value)
|
2015-01-12 13:12:15 +01:00
|
|
|
{
|
|
|
|
paperWidth = value;
|
|
|
|
}
|
|
|
|
|
2019-03-29 10:31:17 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
int VLayoutGenerator::GetNestingTime() const
|
|
|
|
{
|
|
|
|
return nestingTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-04-03 12:29:42 +02:00
|
|
|
int VLayoutGenerator::GetNestingTimeMSecs() const
|
|
|
|
{
|
|
|
|
return nestingTime * 60000;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-03-29 10:31:17 +01:00
|
|
|
void VLayoutGenerator::SetNestingTime(int value)
|
|
|
|
{
|
|
|
|
nestingTime = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-03-29 18:52:37 +01:00
|
|
|
qreal VLayoutGenerator::GetEfficiencyCoefficient() const
|
2019-03-29 10:31:17 +01:00
|
|
|
{
|
|
|
|
return efficiencyCoefficient;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetEfficiencyCoefficient(qreal coefficient)
|
|
|
|
{
|
|
|
|
efficiencyCoefficient = coefficient;
|
|
|
|
}
|
|
|
|
|
2015-11-09 12:33:36 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-09-30 18:33:10 +02:00
|
|
|
bool VLayoutGenerator::IsUsePrinterFields() const
|
|
|
|
{
|
|
|
|
return usePrinterFields;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QMarginsF VLayoutGenerator::GetPrinterFields() const
|
2015-11-09 12:33:36 +01:00
|
|
|
{
|
|
|
|
return margins;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-09-30 18:33:10 +02:00
|
|
|
void VLayoutGenerator::SetPrinterFields(bool usePrinterFields, const QMarginsF &value)
|
2015-11-09 12:33:36 +01:00
|
|
|
{
|
2016-09-30 18:33:10 +02:00
|
|
|
this->usePrinterFields = usePrinterFields;
|
2015-11-09 12:33:36 +01:00
|
|
|
margins = value;
|
|
|
|
}
|
|
|
|
|
2015-01-12 16:23:25 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-03-29 18:52:37 +01:00
|
|
|
qreal VLayoutGenerator::GetShift() const
|
2015-01-12 16:23:25 +01:00
|
|
|
{
|
|
|
|
return shift;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-03-29 18:52:37 +01:00
|
|
|
void VLayoutGenerator::SetShift(qreal shift)
|
2015-01-12 16:23:25 +01:00
|
|
|
{
|
|
|
|
this->shift = shift;
|
|
|
|
}
|
|
|
|
|
2015-01-12 13:12:15 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-11-09 12:58:45 +01:00
|
|
|
qreal VLayoutGenerator::GetPaperHeight() const
|
2015-01-12 13:12:15 +01:00
|
|
|
{
|
|
|
|
return paperHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-11-09 12:58:45 +01:00
|
|
|
void VLayoutGenerator::SetPaperHeight(qreal value)
|
2015-01-12 13:12:15 +01:00
|
|
|
{
|
|
|
|
paperHeight = value;
|
|
|
|
}
|