2015-01-02 14:53:36 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vlayoutgenerator.cpp
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 2 1, 2015
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** 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-02 14:53:36 +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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "vlayoutgenerator.h"
|
|
|
|
|
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"
|
2017-01-22 10:02:02 +01:00
|
|
|
#include "vlayoutpiece.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "vlayoutpaper.h"
|
|
|
|
|
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 11:25:14 +01:00
|
|
|
stopGeneration(ATOMIC_VAR_INIT(false)),
|
2017-02-22 13:04:47 +01:00
|
|
|
state(LayoutErrors::NoError),
|
|
|
|
shift(0),
|
|
|
|
rotate(true),
|
|
|
|
rotationIncrease(180),
|
|
|
|
autoCrop(false),
|
|
|
|
saveLength(false),
|
|
|
|
unitePages(false),
|
|
|
|
stripOptimizationEnabled(false),
|
|
|
|
multiplier(1),
|
|
|
|
stripOptimization(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();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::Generate()
|
|
|
|
{
|
2017-02-22 13:04:47 +01:00
|
|
|
stopGeneration.store(false);
|
2015-01-12 13:12:15 +01:00
|
|
|
papers.clear();
|
|
|
|
state = LayoutErrors::NoError;
|
2015-01-12 21:35:32 +01:00
|
|
|
|
|
|
|
#ifdef LAYOUT_DEBUG
|
|
|
|
const QString path = QDir::homePath()+QStringLiteral("/LayoutDebug");
|
|
|
|
QDir debugDir(path);
|
|
|
|
debugDir.removeRecursively();
|
|
|
|
debugDir.mkpath(path);
|
|
|
|
#endif
|
|
|
|
|
2015-01-12 13:12:15 +01:00
|
|
|
emit Start();
|
|
|
|
|
|
|
|
if (bank->Prepare())
|
|
|
|
{
|
2016-02-23 13:13:10 +01:00
|
|
|
const int width = PageWidth();
|
|
|
|
int height = PageHeight();
|
|
|
|
|
|
|
|
if (stripOptimization)
|
|
|
|
{
|
|
|
|
const qreal b = bank->GetBiggestDiagonal() * multiplier + bank->GetLayoutWidth();
|
|
|
|
|
|
|
|
if (height >= b*2)
|
|
|
|
{
|
|
|
|
stripOptimizationEnabled = true;
|
|
|
|
height = qFloor(height / qFloor(height/b));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-02-23 13:13:10 +01:00
|
|
|
VLayoutPaper paper(height, width);
|
2015-01-12 16:23:25 +01:00
|
|
|
paper.SetShift(shift);
|
2015-01-17 15:00:46 +01:00
|
|
|
paper.SetLayoutWidth(bank->GetLayoutWidth());
|
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);
|
|
|
|
paper.SetRotationIncrease(rotationIncrease);
|
2015-05-08 12:10:56 +02:00
|
|
|
paper.SetSaveLength(saveLength);
|
2015-01-16 20:34:37 +01:00
|
|
|
do
|
2015-01-12 13:12:15 +01:00
|
|
|
{
|
|
|
|
const int index = bank->GetTiket();
|
2015-01-16 15:45:56 +01:00
|
|
|
if (paper.ArrangeDetail(bank->GetDetail(index), stopGeneration))
|
2015-01-12 13:12:15 +01:00
|
|
|
{
|
|
|
|
bank->Arranged(index);
|
2015-01-16 13:53:14 +01:00
|
|
|
emit Arranged(bank->ArrangedCount());
|
2015-01-12 13:12:15 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bank->NotArranged(index);
|
|
|
|
}
|
2015-01-16 15:45:56 +01:00
|
|
|
|
2017-02-22 13:04:47 +01:00
|
|
|
if (stopGeneration.load())
|
2015-01-16 15:45:56 +01:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2015-01-16 20:34:37 +01:00
|
|
|
} while(bank->LeftArrange() > 0);
|
|
|
|
|
2017-02-22 13:04:47 +01:00
|
|
|
if (stopGeneration.load())
|
2015-01-17 14:14:28 +01:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
emit Error(state);
|
|
|
|
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;
|
|
|
|
emit Error(state);
|
|
|
|
return;
|
|
|
|
}
|
2016-02-23 13:13:10 +01:00
|
|
|
|
|
|
|
if (stripOptimizationEnabled)
|
|
|
|
{
|
|
|
|
GatherPages();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IsUnitePages())
|
|
|
|
{
|
|
|
|
UnitePages();
|
|
|
|
}
|
|
|
|
|
2015-01-15 14:10:05 +01:00
|
|
|
emit Finished();
|
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;
|
|
|
|
for (int i=0; i < papers.count(); ++i)
|
|
|
|
{
|
2015-05-02 18:21:47 +02:00
|
|
|
list.append(papers.at(i).GetPaperItem(autoCrop));
|
2015-01-23 11:07:58 +01:00
|
|
|
}
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QList<QList<QGraphicsItem *> > VLayoutGenerator::GetAllDetails() const
|
|
|
|
{
|
|
|
|
QList<QList<QGraphicsItem *> > list;
|
|
|
|
for (int i=0; i < papers.count(); ++i)
|
|
|
|
{
|
2016-02-23 13:13:10 +01:00
|
|
|
list.append(papers.at(i).GetItemDetails());
|
2015-01-13 11:38:51 +01: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-05-02 19:18:31 +02:00
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
|
|
|
|
QThreadPool::globalInstance()->clear();
|
|
|
|
#endif
|
2015-01-12 13:12:15 +01:00
|
|
|
}
|
|
|
|
|
2016-02-23 13:13:10 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VLayoutGenerator::IsStripOptimization() const
|
|
|
|
{
|
|
|
|
return stripOptimization;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetStripOptimization(bool value)
|
|
|
|
{
|
|
|
|
stripOptimization = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
quint8 VLayoutGenerator::GetMultiplier() const
|
|
|
|
{
|
|
|
|
return multiplier;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetMultiplier(const quint8 &value)
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2016-02-23 13:13:10 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::GatherPages()
|
|
|
|
{
|
|
|
|
if (papers.size() < 2)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
2016-12-10 17:38:34 +01:00
|
|
|
int paperHeight = qRound(papers.at(i).DetailsBoundingRect().height());
|
|
|
|
|
|
|
|
if (i != papers.size()-1)
|
|
|
|
{
|
|
|
|
paperHeight += qRound(bank->GetLayoutWidth()*2);
|
|
|
|
}
|
|
|
|
|
2016-02-23 13:13:10 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QVector<VLayoutPaper> nPapers;
|
|
|
|
for (int i = 0; i < nDetails.size(); ++i)
|
|
|
|
{
|
|
|
|
VLayoutPaper paper(PageHeight(), PageWidth());
|
|
|
|
paper.SetShift(shift);
|
|
|
|
paper.SetLayoutWidth(bank->GetLayoutWidth());
|
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);
|
|
|
|
paper.SetRotationIncrease(rotationIncrease);
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
int paperHeight = 0;
|
|
|
|
if (autoCrop)
|
|
|
|
{
|
2016-12-10 17:38:34 +01:00
|
|
|
paperHeight = qRound(papers.at(i).DetailsBoundingRect().height());
|
2016-02-23 13:13:10 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
paperHeight = papers.at(i).GetHeight();
|
|
|
|
}
|
|
|
|
|
2016-12-10 17:38:34 +01:00
|
|
|
if (i != papers.size()-1)
|
|
|
|
{
|
|
|
|
paperHeight = qRound(paperHeight + bank->GetLayoutWidth()*2);
|
|
|
|
}
|
2016-02-23 13:13:10 +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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QVector<VLayoutPaper> nPapers;
|
|
|
|
for (int i = 0; i < nDetails.size(); ++i)
|
|
|
|
{
|
|
|
|
VLayoutPaper paper(qFloor(papersLength.at(i)), PageWidth());
|
|
|
|
paper.SetShift(shift);
|
|
|
|
paper.SetLayoutWidth(bank->GetLayoutWidth());
|
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);
|
|
|
|
paper.SetRotationIncrease(rotationIncrease);
|
|
|
|
paper.SetSaveLength(saveLength);
|
|
|
|
paper.SetDetails(nDetails.at(i));
|
|
|
|
|
|
|
|
nPapers.append(paper);
|
|
|
|
}
|
|
|
|
|
|
|
|
papers.clear();
|
|
|
|
papers = nPapers;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2017-01-22 10:02:02 +01:00
|
|
|
void VLayoutGenerator::UniteDetails(int j, QList<QList<VLayoutPiece> > &nDetails, qreal length, int i)
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2017-01-22 10:02:02 +01:00
|
|
|
QList<VLayoutPiece> VLayoutGenerator::MoveDetails(qreal length, const QVector<VLayoutPiece> &details)
|
2016-02-23 13:13:10 +01:00
|
|
|
{
|
|
|
|
if (qFuzzyIsNull(length))
|
|
|
|
{
|
|
|
|
return details.toList();
|
|
|
|
}
|
|
|
|
|
2017-01-22 10:02:02 +01:00
|
|
|
QList<VLayoutPiece> newDetails;
|
2016-02-23 13:13:10 +01:00
|
|
|
for (int i = 0; i < details.size(); ++i)
|
|
|
|
{
|
2017-01-22 10:02:02 +01:00
|
|
|
VLayoutPiece d = details.at(i);
|
2016-02-23 13:13:10 +01:00
|
|
|
d.Translate(0, length);
|
|
|
|
newDetails.append(d);
|
|
|
|
}
|
|
|
|
|
|
|
|
return newDetails;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2015-05-02 18:21:47 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VLayoutGenerator::GetAutoCrop() const
|
|
|
|
{
|
|
|
|
return autoCrop;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetAutoCrop(bool value)
|
|
|
|
{
|
|
|
|
autoCrop = value;
|
|
|
|
}
|
|
|
|
|
2015-01-22 15:11:50 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-04-15 14:44:57 +02:00
|
|
|
// cppcheck-suppress unusedFunction
|
2015-01-22 15:11:50 +01:00
|
|
|
int VLayoutGenerator::GetRotationIncrease() const
|
|
|
|
{
|
|
|
|
return rotationIncrease;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetRotationIncrease(int value)
|
|
|
|
{
|
|
|
|
rotationIncrease = value;
|
|
|
|
|
|
|
|
if ((rotationIncrease >= 1 && rotationIncrease <= 180 && 360 % rotationIncrease == 0) == false)
|
|
|
|
{
|
|
|
|
rotationIncrease = 180;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VLayoutGenerator::GetRotate() const
|
|
|
|
{
|
|
|
|
return rotate;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VLayoutGenerator::SetRotate(bool value)
|
|
|
|
{
|
|
|
|
rotate = 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;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-10-26 09:36:07 +01:00
|
|
|
quint32 VLayoutGenerator::GetShift() const
|
2015-01-12 16:23:25 +01:00
|
|
|
{
|
|
|
|
return shift;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-10-26 09:36:07 +01:00
|
|
|
void VLayoutGenerator::SetShift(quint32 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;
|
|
|
|
}
|