2015-01-02 14:53:36 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vlayoutgenerator.h
|
|
|
|
** @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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef VLAYOUTGENERATOR_H
|
|
|
|
#define VLAYOUTGENERATOR_H
|
|
|
|
|
2015-01-12 13:12:15 +01:00
|
|
|
#include <QObject>
|
2015-01-13 11:38:51 +01:00
|
|
|
#include <QList>
|
2015-01-02 14:53:36 +01:00
|
|
|
|
2015-01-12 13:12:15 +01:00
|
|
|
#include "vlayoutdef.h"
|
|
|
|
#include "vbank.h"
|
2015-11-09 12:33:36 +01:00
|
|
|
#include "../vmisc/vmargins.h"
|
2015-08-25 19:53:03 +02:00
|
|
|
#include <memory>
|
2015-01-12 13:12:15 +01:00
|
|
|
|
|
|
|
class VLayoutPaper;
|
|
|
|
class VLayoutDetail;
|
2015-01-13 11:38:51 +01:00
|
|
|
class QGraphicsItem;
|
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:
|
2015-10-12 13:52:48 +02:00
|
|
|
explicit VLayoutGenerator(QObject *parent = 0);
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual ~VLayoutGenerator() Q_DECL_OVERRIDE;
|
2015-01-12 13:12:15 +01:00
|
|
|
|
|
|
|
void SetDetails(const QVector<VLayoutDetail> &details);
|
|
|
|
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
|
|
|
|
2015-11-09 12:33:36 +01:00
|
|
|
QMarginsF GetFields() const;
|
|
|
|
void SetFields(const QMarginsF &value);
|
|
|
|
|
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;
|
|
|
|
|
2015-01-23 11:07:58 +01:00
|
|
|
QList<QGraphicsItem *> GetPapersItems() const;
|
|
|
|
QList<QList<QGraphicsItem *>> 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);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
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;
|
2015-05-06 16:09:58 +02:00
|
|
|
volatile 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;
|
|
|
|
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;
|
2015-11-09 12:33:36 +01:00
|
|
|
|
|
|
|
int PageHeight() const;
|
|
|
|
int PageWidth() const;
|
2015-01-02 14:53:36 +01:00
|
|
|
};
|
|
|
|
|
2015-08-25 19:53:03 +02:00
|
|
|
typedef std::shared_ptr<VLayoutGenerator> VLayoutGeneratorPtr;
|
|
|
|
|
2015-01-02 14:53:36 +01:00
|
|
|
#endif // VLAYOUTGENERATOR_H
|