2015-01-02 14:53:36 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vlayoutgenerator.h
|
|
|
|
** @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
|
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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef VLAYOUTGENERATOR_H
|
|
|
|
#define VLAYOUTGENERATOR_H
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <qcompilerdetection.h>
|
2015-01-13 11:38:51 +01:00
|
|
|
#include <QList>
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QtGlobal>
|
2015-12-19 15:38:24 +01:00
|
|
|
#include <memory>
|
2017-02-22 13:04:47 +01:00
|
|
|
#include <atomic>
|
2015-01-02 14:53:36 +01:00
|
|
|
|
2015-01-12 13:12:15 +01:00
|
|
|
#include "vbank.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "vlayoutdef.h"
|
|
|
|
|
|
|
|
class QMarginsF;
|
2015-12-19 15:38:24 +01:00
|
|
|
|
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
|
|
|
|
# include "../vmisc/backport/qmarginsf.h"
|
|
|
|
#else
|
|
|
|
# include <QMargins>
|
|
|
|
#endif
|
2015-01-12 13:12:15 +01:00
|
|
|
|
2015-01-13 11:38:51 +01:00
|
|
|
class QGraphicsItem;
|
2016-08-08 13:44:49 +02:00
|
|
|
class VLayoutPaper;
|
2015-01-02 14:53:36 +01:00
|
|
|
|
2015-01-12 13:12:15 +01:00
|
|
|
class VLayoutGenerator :public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2015-01-02 14:53:36 +01:00
|
|
|
public:
|
2016-03-23 16:27:17 +01:00
|
|
|
explicit VLayoutGenerator(QObject *parent = nullptr);
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual ~VLayoutGenerator() override;
|
2015-01-12 13:12:15 +01:00
|
|
|
|
2017-01-22 10:02:02 +01:00
|
|
|
void SetDetails(const QVector<VLayoutPiece> &details);
|
2015-01-12 13:12:15 +01:00
|
|
|
void SetLayoutWidth(qreal width);
|
|
|
|
void SetCaseType(Cases caseType);
|
|
|
|
int DetailsCount();
|
|
|
|
|
2015-11-09 12:58:45 +01:00
|
|
|
qreal GetPaperHeight() const;
|
|
|
|
void SetPaperHeight(qreal value);
|
2015-01-12 13:12:15 +01:00
|
|
|
|
2015-11-09 12:58:45 +01:00
|
|
|
qreal GetPaperWidth() const;
|
|
|
|
void SetPaperWidth(qreal value);
|
2015-01-12 13:12:15 +01:00
|
|
|
|
2016-09-30 18:33:10 +02:00
|
|
|
bool IsUsePrinterFields() const;
|
|
|
|
QMarginsF GetPrinterFields() const;
|
|
|
|
void SetPrinterFields(bool usePrinterFields, const QMarginsF &value);
|
2015-11-09 12:33:36 +01:00
|
|
|
|
2015-10-26 09:36:07 +01:00
|
|
|
quint32 GetShift() const;
|
2015-11-05 12:07:51 +01:00
|
|
|
void SetShift(quint32 shift);
|
2015-01-12 16:23:25 +01:00
|
|
|
|
2015-01-12 13:12:15 +01:00
|
|
|
void Generate();
|
|
|
|
|
|
|
|
LayoutErrors State() const;
|
|
|
|
|
2017-07-01 20:38:26 +02:00
|
|
|
Q_REQUIRED_RESULT QList<QGraphicsItem *> GetPapersItems() const;
|
2017-07-16 20:10:48 +02:00
|
|
|
Q_REQUIRED_RESULT QList<QList<QGraphicsItem *>> GetAllDetailsItems() const;
|
|
|
|
|
|
|
|
QVector<QVector<VLayoutPiece>> GetAllDetails() const;
|
2015-01-13 11:38:51 +01:00
|
|
|
|
2015-01-22 15:11:50 +01:00
|
|
|
bool GetRotate() const;
|
|
|
|
void SetRotate(bool value);
|
|
|
|
|
2018-12-27 14:54:29 +01:00
|
|
|
bool GetFollowGrainline() const;
|
|
|
|
void SetFollowGrainline(bool value);
|
|
|
|
|
2015-01-22 15:11:50 +01:00
|
|
|
int GetRotationIncrease() const;
|
|
|
|
void SetRotationIncrease(int value);
|
|
|
|
|
2015-05-02 18:21:47 +02:00
|
|
|
bool GetAutoCrop() const;
|
|
|
|
void SetAutoCrop(bool value);
|
|
|
|
|
2015-05-08 12:10:56 +02:00
|
|
|
bool IsSaveLength() const;
|
|
|
|
void SetSaveLength(bool value);
|
|
|
|
|
2015-05-18 13:26:37 +02:00
|
|
|
bool IsUnitePages() const;
|
|
|
|
void SetUnitePages(bool value);
|
|
|
|
|
2016-02-23 13:13:10 +01:00
|
|
|
quint8 GetMultiplier() const;
|
2019-01-02 15:52:07 +01:00
|
|
|
void SetMultiplier(quint8 value);
|
2016-02-23 13:13:10 +01:00
|
|
|
|
|
|
|
bool IsStripOptimization() const;
|
|
|
|
void SetStripOptimization(bool value);
|
|
|
|
|
2017-07-01 19:32:54 +02:00
|
|
|
bool IsTestAsPaths() const;
|
|
|
|
void SetTestAsPaths(bool value);
|
|
|
|
|
2015-01-12 13:12:15 +01:00
|
|
|
signals:
|
|
|
|
void Start();
|
|
|
|
void Arranged(int count);
|
|
|
|
void Error(const LayoutErrors &state);
|
|
|
|
void Finished();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void Abort();
|
|
|
|
|
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(VLayoutGenerator)
|
|
|
|
QVector<VLayoutPaper> papers;
|
|
|
|
VBank *bank;
|
2015-11-09 12:58:45 +01:00
|
|
|
qreal paperHeight;
|
|
|
|
qreal paperWidth;
|
2015-11-09 12:33:36 +01:00
|
|
|
QMarginsF margins;
|
2016-09-30 18:33:10 +02:00
|
|
|
bool usePrinterFields;
|
2017-02-22 13:04:47 +01:00
|
|
|
std::atomic_bool stopGeneration;
|
2015-01-12 13:12:15 +01:00
|
|
|
LayoutErrors state;
|
2015-10-26 09:36:07 +01:00
|
|
|
quint32 shift;
|
2015-01-22 15:11:50 +01:00
|
|
|
bool rotate;
|
2018-12-27 14:54:29 +01:00
|
|
|
bool followGrainline;
|
2015-01-22 15:11:50 +01:00
|
|
|
int rotationIncrease;
|
2015-05-02 18:21:47 +02:00
|
|
|
bool autoCrop;
|
2015-05-08 12:10:56 +02:00
|
|
|
bool saveLength;
|
2015-05-18 13:26:37 +02:00
|
|
|
bool unitePages;
|
2016-02-23 13:13:10 +01:00
|
|
|
bool stripOptimizationEnabled;
|
|
|
|
quint8 multiplier;
|
|
|
|
bool stripOptimization;
|
2017-07-01 19:32:54 +02:00
|
|
|
bool textAsPaths;
|
2015-11-09 12:33:36 +01:00
|
|
|
|
|
|
|
int PageHeight() const;
|
|
|
|
int PageWidth() const;
|
2019-01-02 15:49:57 +01:00
|
|
|
bool IsPortrait() const;
|
2016-02-23 13:13:10 +01:00
|
|
|
|
|
|
|
void GatherPages();
|
|
|
|
void UnitePages();
|
2017-01-22 10:02:02 +01:00
|
|
|
void UniteDetails(int j, QList<QList<VLayoutPiece> > &nDetails, qreal length, int i);
|
2016-02-23 13:13:10 +01:00
|
|
|
void UnitePapers(int j, QList<qreal> &papersLength, qreal length);
|
2017-01-22 10:02:02 +01:00
|
|
|
QList<VLayoutPiece> MoveDetails(qreal length, const QVector<VLayoutPiece> &details);
|
2015-01-02 14:53:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VLAYOUTGENERATOR_H
|