2021-08-09 14:09:10 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vppiece.h
|
|
|
|
** @author Ronan Le Tiec
|
|
|
|
** @date 13 4, 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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
#ifndef VPPIECE_H
|
|
|
|
#define VPPIECE_H
|
|
|
|
|
|
|
|
#include <QUuid>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QPoint>
|
|
|
|
#include <QTransform>
|
|
|
|
|
|
|
|
#include "../vlayout/vlayoutpiece.h"
|
2021-08-17 17:49:28 +02:00
|
|
|
#include "../layout/layoutdef.h"
|
2021-08-09 14:09:10 +02:00
|
|
|
|
|
|
|
class VPLayout;
|
|
|
|
class VPSheet;
|
|
|
|
|
|
|
|
class VPPiece : public VLayoutPiece
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VPPiece() = default;
|
|
|
|
explicit VPPiece(const VLayoutPiece &layoutPiece);
|
|
|
|
|
|
|
|
virtual ~VPPiece() = default;
|
|
|
|
|
|
|
|
void ClearTransformations();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief SetPosition Sets the position of the piece, in relation to the origin of the scene
|
|
|
|
* @param point the point where to set the piece
|
|
|
|
*/
|
|
|
|
void SetPosition(QPointF point);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetPosition Returns the position of the piece
|
|
|
|
* @return the position of the piece
|
|
|
|
*/
|
|
|
|
auto GetPosition() -> QPointF;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief RotateToGrainline rotates the piece to follow the grainline
|
|
|
|
*/
|
|
|
|
void RotateToGrainline();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief SetSelected Sets wether the piece is selected
|
|
|
|
* @param value true if the piece is selected
|
|
|
|
*/
|
|
|
|
void SetSelected(bool value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief IsSelected Returns wether the piece is selected. It emit the signal SelectionChanged
|
|
|
|
* @return true if the piece is selected
|
|
|
|
*/
|
|
|
|
auto IsSelected() const -> bool;
|
|
|
|
|
2021-08-17 17:49:28 +02:00
|
|
|
auto Sheet() const -> VPSheetPtr;
|
|
|
|
void SetSheet(const VPSheetPtr &newSheet);
|
2021-08-09 14:09:10 +02:00
|
|
|
|
2021-08-17 17:49:28 +02:00
|
|
|
auto Layout() const -> VPLayoutPtr;
|
|
|
|
void SetLayout(const VPLayoutPtr &layout);
|
2021-08-09 14:09:10 +02:00
|
|
|
|
2021-08-14 14:19:28 +02:00
|
|
|
void SetGrainlineEnabled(bool enabled);
|
|
|
|
void SetGrainlineAngle(qreal angle);
|
|
|
|
void SetGrainlineArrowType(GrainlineArrowDirection type);
|
|
|
|
void SetGrainlinePoints(const QVector<QPointF> &points);
|
|
|
|
|
|
|
|
auto GetPieceLabelRect() const -> QVector<QPointF>;
|
|
|
|
void SetPieceLabelRect(const QVector<QPointF> &rect);
|
|
|
|
|
|
|
|
auto GetPieceLabelData() const ->VTextManager;
|
|
|
|
void SetPieceLabelData(const VTextManager &data);
|
|
|
|
|
|
|
|
auto GetPatternLabelRect() const -> QVector<QPointF>;
|
|
|
|
void SetPatternLabelRect(const QVector<QPointF> &rect);
|
|
|
|
|
|
|
|
auto GetPatternLabelData() const ->VTextManager;
|
|
|
|
void SetPatternLabelData(const VTextManager &data);
|
|
|
|
|
2021-08-26 07:50:11 +02:00
|
|
|
/**
|
|
|
|
* @brief Flip horizontally mirror around center of bounding rect
|
|
|
|
*/
|
|
|
|
void Flip();
|
|
|
|
|
2021-08-09 14:09:10 +02:00
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(VPPiece)
|
|
|
|
|
2021-08-17 17:49:28 +02:00
|
|
|
VPLayoutWeakPtr m_layout{};
|
2021-08-09 14:09:10 +02:00
|
|
|
|
2021-08-17 17:49:28 +02:00
|
|
|
VPSheetWeakPtr m_sheet{};
|
2021-08-09 14:09:10 +02:00
|
|
|
|
|
|
|
bool m_isSelected{false};
|
|
|
|
};
|
|
|
|
|
2021-08-17 17:49:28 +02:00
|
|
|
Q_DECLARE_METATYPE(VPPiecePtr)
|
|
|
|
|
2021-08-09 14:09:10 +02:00
|
|
|
#endif // VPPIECE_H
|