2015-01-10 14:47:46 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vlayoutpaper.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 7 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-10 14:47:46 +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 VLAYOUTPAPER_H
|
|
|
|
#define VLAYOUTPAPER_H
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <qcompilerdetection.h>
|
2015-01-10 14:47:46 +01:00
|
|
|
#include <QSharedDataPointer>
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QTypeInfo>
|
|
|
|
#include <QtGlobal>
|
2017-02-22 13:04:47 +01:00
|
|
|
#include <atomic>
|
2016-08-08 13:44:49 +02:00
|
|
|
|
2015-01-20 21:58:30 +01:00
|
|
|
#include "vlayoutdef.h"
|
2015-01-10 14:47:46 +01:00
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
class VBestSquare;
|
|
|
|
class VLayoutPaperData;
|
2017-02-18 10:22:59 +01:00
|
|
|
class VLayoutPiece;
|
|
|
|
class QGraphicsRectItem;
|
|
|
|
class QRectF;
|
|
|
|
class QGraphicsItem;
|
2016-08-08 13:44:49 +02:00
|
|
|
template <typename T> class QList;
|
|
|
|
template <typename T> class QVector;
|
2015-01-10 14:47:46 +01:00
|
|
|
|
|
|
|
class VLayoutPaper
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VLayoutPaper();
|
|
|
|
VLayoutPaper(int height, int width);
|
|
|
|
VLayoutPaper(const VLayoutPaper &paper);
|
2017-04-19 12:27:17 +02:00
|
|
|
|
2015-07-03 15:36:54 +02:00
|
|
|
~VLayoutPaper();
|
2015-01-10 14:47:46 +01:00
|
|
|
|
2017-04-19 12:27:17 +02:00
|
|
|
VLayoutPaper &operator=(const VLayoutPaper &paper);
|
|
|
|
#ifdef Q_COMPILER_RVALUE_REFS
|
|
|
|
VLayoutPaper &operator=(VLayoutPaper &&paper) Q_DECL_NOTHROW { Swap(paper); return *this; }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void Swap(VLayoutPaper &paper) Q_DECL_NOTHROW
|
|
|
|
{ std::swap(d, paper.d); }
|
|
|
|
|
2015-01-10 14:47:46 +01:00
|
|
|
int GetHeight() const;
|
|
|
|
void SetHeight(int height);
|
|
|
|
|
|
|
|
int GetWidth() const;
|
|
|
|
void SetWidth(int width);
|
|
|
|
|
2015-01-17 15:00:46 +01:00
|
|
|
qreal GetLayoutWidth() const;
|
|
|
|
void SetLayoutWidth(qreal width);
|
|
|
|
|
2015-10-26 09:36:07 +01:00
|
|
|
quint32 GetShift() const;
|
2016-02-23 13:13:10 +01:00
|
|
|
void SetShift(quint32 shift);
|
2015-01-12 16:23:25 +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-08 12:10:56 +02:00
|
|
|
bool IsSaveLength() const;
|
|
|
|
void SetSaveLength(bool value);
|
|
|
|
|
2015-01-12 21:35:32 +01:00
|
|
|
void SetPaperIndex(quint32 index);
|
|
|
|
|
2017-02-22 13:04:47 +01:00
|
|
|
bool ArrangeDetail(const VLayoutPiece &detail, std::atomic_bool &stop);
|
2015-01-10 14:47:46 +01:00
|
|
|
int Count() const;
|
2017-07-01 19:32:54 +02:00
|
|
|
QGraphicsRectItem *GetPaperItem(bool autoCrop, bool textAsPaths) const Q_REQUIRED_RESULT;
|
|
|
|
QList<QGraphicsItem *> GetItemDetails(bool textAsPaths) const Q_REQUIRED_RESULT;
|
2016-02-23 13:13:10 +01:00
|
|
|
|
2017-01-22 10:02:02 +01:00
|
|
|
QVector<VLayoutPiece> GetDetails() const;
|
|
|
|
void SetDetails(const QList<VLayoutPiece>& details);
|
2016-02-23 13:13:10 +01:00
|
|
|
|
2016-12-10 17:38:34 +01:00
|
|
|
QRectF DetailsBoundingRect() const;
|
2015-01-13 11:38:51 +01:00
|
|
|
|
2015-01-10 14:47:46 +01:00
|
|
|
private:
|
|
|
|
QSharedDataPointer<VLayoutPaperData> d;
|
|
|
|
|
2017-02-22 13:04:47 +01:00
|
|
|
bool AddToSheet(const VLayoutPiece &detail, std::atomic_bool &stop);
|
2015-01-10 14:47:46 +01:00
|
|
|
|
2017-01-22 10:02:02 +01:00
|
|
|
bool SaveResult(const VBestSquare &bestResult, const VLayoutPiece &detail);
|
2015-01-10 14:47:46 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2015-11-25 19:56:17 +01:00
|
|
|
Q_DECLARE_TYPEINFO(VLayoutPaper, Q_MOVABLE_TYPE);
|
|
|
|
|
2015-01-10 14:47:46 +01:00
|
|
|
#endif // VLAYOUTPAPER_H
|