valentina/src/app/puzzle/layout/vpsheet.h

121 lines
3.2 KiB
C
Raw Normal View History

/************************************************************************
**
** @file vpsheet.h
** @author Ronan Le Tiec
** @date 23 5, 2020
**
** @brief
** @copyright
** This source code is part of the Valentina project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2020 Valentina project
** <https://gitlab.com/smart-pattern/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/>.
**
*************************************************************************/
2020-05-23 17:46:46 +02:00
#ifndef VPSHEET_H
#define VPSHEET_H
#include <QSizeF>
#include <QMarginsF>
#include <QList>
2020-11-20 15:51:24 +01:00
#include <QComboBox>
2021-07-31 11:21:07 +02:00
#include <QUuid>
2020-05-23 17:46:46 +02:00
#include "def.h"
2021-08-17 17:49:28 +02:00
#include "layoutdef.h"
class VPLayout;
2021-07-29 16:11:18 +02:00
class VPPiece;
class VPSheet : public QObject
2020-05-23 17:46:46 +02:00
{
Q_OBJECT
2020-05-23 17:46:46 +02:00
public:
2021-08-17 17:49:28 +02:00
explicit VPSheet(const VPLayoutPtr &layout);
2021-07-29 16:11:18 +02:00
virtual ~VPSheet() = default;
2020-11-20 15:51:24 +01:00
2020-11-14 17:31:34 +01:00
/**
* @brief GetLayout Returns the Layout of the sheet
* @return Layout of the sheet
2020-11-14 17:31:34 +01:00
*/
2021-08-17 17:49:28 +02:00
auto GetLayout() const -> VPLayoutPtr;
2020-11-14 17:31:34 +01:00
2021-08-17 17:49:28 +02:00
auto GetPieces() const -> QList<VPPiecePtr>;
2021-08-25 15:58:50 +02:00
auto GetSelectedPieces() const -> QList<VPPiecePtr>;
/**
* @brief GetName Returns the name of the sheet
* @return the name
*/
2021-07-29 16:11:18 +02:00
auto GetName() const -> QString;
/**
* @brief SetName Sets the name of the sheet to the given name
* @param name the new sheet's name
*/
void SetName(const QString &name);
2021-07-31 11:21:07 +02:00
auto Uuid() const -> const QUuid &;
bool IsVisible() const;
void SetVisible(bool visible);
2021-08-09 14:09:10 +02:00
auto GrainlineType() const -> GrainlineType;
auto TransformationOrigin() const -> const VPTransformationOrigon &;
void SetTransformationOrigin(const VPTransformationOrigon &newTransformationOrigin);
2021-08-17 17:49:28 +02:00
void Clear();
2021-08-19 14:13:54 +02:00
auto TrashSheet() const -> bool;
void SetTrashSheet(bool newTrashSheet);
void ValidateSuperpositionOfPieces() const;
void ValidatePieceOutOfBound(const VPPiecePtr &piece) const;
void ValidatePiecesOutOfBound() const;
auto GetSheetRect() const -> QRectF;
auto GetMarginsRect() const -> QRectF;
static auto GetSheetRect(const VPLayoutPtr &layout) -> QRectF;
static auto GetMarginsRect(const VPLayoutPtr &layout) -> QRectF;
public slots:
void CheckPiecePositionValidity(const VPPiecePtr &piece) const;
private:
Q_DISABLE_COPY(VPSheet)
2021-08-17 17:49:28 +02:00
VPLayoutWeakPtr m_layout{};
QString m_name{};
2021-07-31 11:21:07 +02:00
QUuid m_uuid{QUuid::createUuid()};
bool m_visible{true};
2021-08-19 14:13:54 +02:00
bool m_trashSheet{false};
2021-08-09 14:09:10 +02:00
VPTransformationOrigon m_transformationOrigin{};
2021-08-30 17:45:27 +02:00
2020-05-23 17:46:46 +02:00
};
2021-08-17 17:49:28 +02:00
Q_DECLARE_METATYPE(VPSheetPtr)
2020-05-23 17:46:46 +02:00
#endif // VPSHEET_H