2016-11-03 16:59:53 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 3 11, 2016
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2016-11-03 16:59:53 +01:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2016 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2016-11-03 16:59:53 +01:00
|
|
|
**
|
|
|
|
** 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 VPIECE_H
|
|
|
|
#define VPIECE_H
|
|
|
|
|
|
|
|
#include <QtGlobal>
|
|
|
|
#include <QSharedDataPointer>
|
|
|
|
|
2016-11-03 19:15:53 +01:00
|
|
|
#include "../vlayout/vabstractpiece.h"
|
2017-10-15 11:25:20 +02:00
|
|
|
#include "../vgeometry/vgeometrydef.h"
|
2016-11-03 19:15:53 +01:00
|
|
|
|
2016-11-03 16:59:53 +01:00
|
|
|
class VPieceData;
|
|
|
|
class VPieceNode;
|
2016-11-23 11:54:46 +01:00
|
|
|
class VPiecePath;
|
2017-02-23 10:26:25 +01:00
|
|
|
class VPatternLabelData;
|
2017-02-23 10:19:27 +01:00
|
|
|
class VPieceLabelData;
|
2017-02-23 10:33:17 +01:00
|
|
|
class VGrainlineData;
|
2017-02-18 10:22:59 +01:00
|
|
|
class VContainer;
|
|
|
|
class QPainterPath;
|
|
|
|
class VPointF;
|
2019-05-08 14:19:03 +02:00
|
|
|
class VPassmark;
|
2019-01-09 16:46:02 +01:00
|
|
|
|
2016-11-03 19:15:53 +01:00
|
|
|
class VPiece : public VAbstractPiece
|
2016-11-03 16:59:53 +01:00
|
|
|
{
|
2019-09-10 15:57:31 +02:00
|
|
|
Q_DECLARE_TR_FUNCTIONS(VPiece)
|
2016-11-03 16:59:53 +01:00
|
|
|
public:
|
|
|
|
VPiece();
|
|
|
|
VPiece(const VPiece &piece);
|
2017-04-19 12:27:17 +02:00
|
|
|
|
2016-11-03 16:59:53 +01:00
|
|
|
virtual ~VPiece();
|
|
|
|
|
2017-04-19 12:27:17 +02:00
|
|
|
VPiece &operator=(const VPiece &piece);
|
|
|
|
#ifdef Q_COMPILER_RVALUE_REFS
|
2019-12-30 16:13:18 +01:00
|
|
|
VPiece(const VPiece &&piece) Q_DECL_NOTHROW;
|
2019-12-30 12:00:57 +01:00
|
|
|
VPiece &operator=(VPiece &&piece) Q_DECL_NOTHROW;
|
2017-04-19 12:27:17 +02:00
|
|
|
#endif
|
|
|
|
|
2016-11-23 11:54:46 +01:00
|
|
|
VPiecePath GetPath() const;
|
|
|
|
VPiecePath &GetPath();
|
|
|
|
void SetPath(const VPiecePath &path);
|
2016-11-03 19:15:53 +01:00
|
|
|
|
2017-10-15 11:25:20 +02:00
|
|
|
QVector<QPointF> MainPathPoints(const VContainer *data) const;
|
2019-02-11 14:00:32 +01:00
|
|
|
QVector<QPointF> UniteMainPathPoints(const VContainer *data) const;
|
2017-10-15 11:25:20 +02:00
|
|
|
QVector<VPointF> MainPathNodePoints(const VContainer *data, bool showExcluded = false) const;
|
|
|
|
QVector<QPointF> SeamAllowancePoints(const VContainer *data) const;
|
2018-07-26 19:00:24 +02:00
|
|
|
QVector<QPointF> CuttingPathPoints(const VContainer *data) const;
|
2019-01-09 16:46:02 +01:00
|
|
|
QVector<QLineF> PassmarksLines(const VContainer *data) const;
|
2019-05-08 14:19:03 +02:00
|
|
|
|
|
|
|
QVector<VPassmark> Passmarks(const VContainer *data) const;
|
2016-11-05 09:56:44 +01:00
|
|
|
|
2018-04-02 15:49:53 +02:00
|
|
|
QVector<QPainterPath> CurvesPainterPath(const VContainer *data) const;
|
|
|
|
|
2018-04-02 16:05:53 +02:00
|
|
|
QPainterPath MainPathPath(const VContainer *data) const;
|
|
|
|
static QPainterPath MainPathPath(const QVector<QPointF> &points);
|
|
|
|
|
2016-11-10 13:06:09 +01:00
|
|
|
QPainterPath SeamAllowancePath(const VContainer *data) const;
|
2017-08-05 10:03:19 +02:00
|
|
|
QPainterPath SeamAllowancePath(const QVector<QPointF> &points) const;
|
2019-01-09 16:46:02 +01:00
|
|
|
QPainterPath PassmarksPath(const VContainer *data) const;
|
2017-10-15 11:25:20 +02:00
|
|
|
QPainterPath PlaceLabelPath(const VContainer *data) const;
|
2016-11-03 19:15:53 +01:00
|
|
|
|
2019-02-23 17:43:06 +01:00
|
|
|
bool IsSeamAllowanceValid(const VContainer *data) const;
|
|
|
|
|
2016-11-09 14:53:22 +01:00
|
|
|
bool IsInLayout() const;
|
|
|
|
void SetInLayout(bool inLayout);
|
|
|
|
|
2016-11-23 17:40:27 +01:00
|
|
|
bool IsUnited() const;
|
|
|
|
void SetUnited(bool united);
|
|
|
|
|
2017-01-21 14:24:40 +01:00
|
|
|
QString GetFormulaSAWidth() const;
|
|
|
|
void SetFormulaSAWidth(const QString &formula, qreal value);
|
|
|
|
|
2016-12-03 17:01:39 +01:00
|
|
|
QVector<quint32> GetInternalPaths() const;
|
2017-01-31 15:26:28 +01:00
|
|
|
QVector<quint32> &GetInternalPaths();
|
2016-12-03 17:01:39 +01:00
|
|
|
void SetInternalPaths(const QVector<quint32> &iPaths);
|
|
|
|
|
2016-11-25 13:19:44 +01:00
|
|
|
QVector<CustomSARecord> GetCustomSARecords() const;
|
2017-01-31 15:26:28 +01:00
|
|
|
QVector<CustomSARecord> &GetCustomSARecords();
|
2016-11-25 13:19:44 +01:00
|
|
|
void SetCustomSARecords(const QVector<CustomSARecord> &records);
|
2017-01-31 15:26:28 +01:00
|
|
|
|
|
|
|
QVector<quint32> GetPins() const;
|
|
|
|
QVector<quint32> &GetPins();
|
|
|
|
void SetPins(const QVector<quint32> &pins);
|
2016-11-25 13:19:44 +01:00
|
|
|
|
2017-10-15 11:25:20 +02:00
|
|
|
QVector<quint32> GetPlaceLabels() const;
|
|
|
|
QVector<quint32> &GetPlaceLabels();
|
|
|
|
void SetPlaceLabels(const QVector<quint32> &labels);
|
|
|
|
|
2017-10-23 09:45:58 +02:00
|
|
|
QList<quint32> Dependencies() const;
|
2016-11-25 15:12:33 +01:00
|
|
|
QVector<quint32> MissingNodes(const VPiece &det) const;
|
|
|
|
QVector<quint32> MissingCSAPath(const VPiece &det) const;
|
2016-12-03 17:01:39 +01:00
|
|
|
QVector<quint32> MissingInternalPaths(const VPiece &det) const;
|
2017-01-31 17:09:18 +01:00
|
|
|
QVector<quint32> MissingPins(const VPiece &det) const;
|
2017-10-15 11:25:20 +02:00
|
|
|
QVector<quint32> MissingPlaceLabels(const VPiece &det) const;
|
2016-11-09 13:11:58 +01:00
|
|
|
|
2017-08-17 18:18:03 +02:00
|
|
|
void SetPatternPieceData(const VPieceLabelData &data);
|
2017-02-23 10:19:27 +01:00
|
|
|
VPieceLabelData& GetPatternPieceData();
|
|
|
|
const VPieceLabelData& GetPatternPieceData() const;
|
2017-01-12 14:51:08 +01:00
|
|
|
|
2017-08-17 18:18:03 +02:00
|
|
|
void SetPatternInfo(const VPatternLabelData &info);
|
2017-02-23 10:26:25 +01:00
|
|
|
VPatternLabelData& GetPatternInfo();
|
|
|
|
const VPatternLabelData& GetPatternInfo() const;
|
2017-01-12 14:51:08 +01:00
|
|
|
|
2018-01-25 22:53:53 +01:00
|
|
|
void SetGrainlineGeometry(const VGrainlineData &data);
|
2017-02-23 10:33:17 +01:00
|
|
|
VGrainlineData& GetGrainlineGeometry();
|
|
|
|
const VGrainlineData& GetGrainlineGeometry() const;
|
2017-01-12 14:51:08 +01:00
|
|
|
|
2019-02-11 14:00:32 +01:00
|
|
|
QVector<VPieceNode> GetUnitedPath(const VContainer *data) const;
|
|
|
|
|
2019-01-09 16:46:02 +01:00
|
|
|
QVector<QPointF> SeamAllowancePointsWithRotation(const VContainer *data, int makeFirst) const;
|
2019-08-29 14:01:27 +02:00
|
|
|
|
|
|
|
static void DumpPiece(const VPiece &piece, const VContainer *data);
|
2016-11-03 16:59:53 +01:00
|
|
|
private:
|
|
|
|
QSharedDataPointer<VPieceData> d;
|
2016-11-03 19:15:53 +01:00
|
|
|
|
2016-11-29 13:10:53 +01:00
|
|
|
QVector<CustomSARecord> GetValidRecords() const;
|
2017-03-29 13:18:33 +02:00
|
|
|
QVector<CustomSARecord> FilterRecords(QVector<CustomSARecord> records) const;
|
2016-11-29 13:10:53 +01:00
|
|
|
|
2017-03-30 11:26:06 +02:00
|
|
|
QVector<VSAPoint> GetNodeSAPoints(const QVector<VPieceNode> &path, int index, const VContainer *data) const;
|
2017-03-28 12:09:00 +02:00
|
|
|
|
2017-03-30 11:26:06 +02:00
|
|
|
bool GetPassmarkSAPoint(const QVector<VPieceNode> &path, int index, const VContainer *data, VSAPoint &point) const;
|
2017-04-25 19:48:32 +02:00
|
|
|
bool GetPassmarkPreviousSAPoints(const QVector<VPieceNode> &path, int index, const VSAPoint &passmarkSAPoint,
|
2018-09-29 21:01:13 +02:00
|
|
|
const VContainer *data, VSAPoint &point, int passmarkIndex) const;
|
2019-01-09 16:46:02 +01:00
|
|
|
bool GetPassmarkNextSAPoints(const QVector<VPieceNode> &path, int index, const VSAPoint &passmarkSAPoint,
|
|
|
|
const VContainer *data, VSAPoint &point, int passmarkIndex) const;
|
2017-03-28 12:09:00 +02:00
|
|
|
|
2017-03-30 11:26:06 +02:00
|
|
|
bool IsPassmarkVisible(const QVector<VPieceNode> &path, int passmarkIndex) const;
|
2017-03-28 12:09:00 +02:00
|
|
|
|
2019-05-08 14:19:03 +02:00
|
|
|
VPassmark CreatePassmark(const QVector<VPieceNode> &path, int previousIndex, int passmarkIndex, int nextIndex,
|
|
|
|
const VContainer *data) const;
|
2017-03-28 12:09:00 +02:00
|
|
|
|
2016-11-29 13:10:53 +01:00
|
|
|
static int IsCSAStart(const QVector<CustomSARecord> &records, quint32 id);
|
2019-08-29 14:01:27 +02:00
|
|
|
|
|
|
|
QJsonObject MainPathToJson() const;
|
|
|
|
QJsonObject DBToJson(const VContainer *data) const;
|
2016-11-03 16:59:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
Q_DECLARE_TYPEINFO(VPiece, Q_MOVABLE_TYPE);
|
|
|
|
|
|
|
|
#endif // VPIECE_H
|