2016-11-03 16:59:53 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 3 11, 2016
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2016 Valentina project
|
|
|
|
** <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 VPIECE_H
|
|
|
|
#define VPIECE_H
|
|
|
|
|
|
|
|
#include <QtGlobal>
|
|
|
|
#include <QSharedDataPointer>
|
|
|
|
|
2016-11-03 19:15:53 +01:00
|
|
|
#include "../vlayout/vabstractpiece.h"
|
|
|
|
|
2016-11-03 16:59:53 +01:00
|
|
|
class VPieceData;
|
|
|
|
class VPieceNode;
|
2016-11-03 19:15:53 +01:00
|
|
|
template <class T> class QVector;
|
2016-11-11 16:55:02 +01:00
|
|
|
template <class T>class QSharedPointer;
|
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;
|
2016-11-03 16:59:53 +01:00
|
|
|
|
2016-11-03 19:15:53 +01:00
|
|
|
class VPiece : public VAbstractPiece
|
2016-11-03 16:59:53 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
VPiece();
|
|
|
|
VPiece(const VPiece &piece);
|
|
|
|
VPiece &operator=(const VPiece &piece);
|
|
|
|
virtual ~VPiece();
|
|
|
|
|
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
|
|
|
|
|
|
|
QVector<QPointF> MainPathPoints(const VContainer *data) const;
|
2017-03-22 11:05:53 +01:00
|
|
|
QVector<VPointF> MainPathNodePoints(const VContainer *data, bool showExcluded = false) const;
|
2016-11-10 13:06:09 +01:00
|
|
|
QVector<QPointF> SeamAllowancePoints(const VContainer *data) const;
|
2017-03-28 12:09:00 +02:00
|
|
|
QVector<QLineF> PassmarksLines(const VContainer *data) const;
|
2016-11-05 09:56:44 +01:00
|
|
|
|
|
|
|
QPainterPath MainPathPath(const VContainer *data) const;
|
2016-11-10 13:06:09 +01:00
|
|
|
QPainterPath SeamAllowancePath(const VContainer *data) const;
|
2017-03-28 12:09:00 +02:00
|
|
|
QPainterPath PassmarksPath(const VContainer *data) const;
|
2016-11-03 19:15:53 +01:00
|
|
|
|
2016-11-08 11:53:14 +01:00
|
|
|
qreal GetMx() const;
|
|
|
|
void SetMx(qreal value);
|
|
|
|
|
|
|
|
qreal GetMy() const;
|
|
|
|
void SetMy(qreal value);
|
|
|
|
|
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
|
|
|
|
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;
|
2016-11-09 13:11:58 +01:00
|
|
|
|
2017-02-23 10:19:27 +01:00
|
|
|
void SetPatternPieceData(const VPieceLabelData &data);
|
|
|
|
VPieceLabelData& GetPatternPieceData();
|
|
|
|
const VPieceLabelData& GetPatternPieceData() const;
|
2017-01-12 14:51:08 +01:00
|
|
|
|
2017-02-23 10:26:25 +01:00
|
|
|
void SetPatternInfo(const VPatternLabelData &info);
|
|
|
|
VPatternLabelData& GetPatternInfo();
|
|
|
|
const VPatternLabelData& GetPatternInfo() const;
|
2017-01-12 14:51:08 +01:00
|
|
|
|
2017-02-23 10:33:17 +01:00
|
|
|
VGrainlineData& GetGrainlineGeometry();
|
|
|
|
const VGrainlineData& GetGrainlineGeometry() const;
|
2017-01-12 14:51:08 +01:00
|
|
|
|
2016-11-03 16:59:53 +01:00
|
|
|
private:
|
|
|
|
QSharedDataPointer<VPieceData> d;
|
2016-11-03 19:15:53 +01:00
|
|
|
|
2017-03-30 11:26:06 +02:00
|
|
|
QVector<VPieceNode> GetUnitedPath(const VContainer *data) const;
|
|
|
|
|
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;
|
|
|
|
bool GetPassmarkPreviousSAPoint(const QVector<VPieceNode> &path, int index, const VSAPoint &passmarkSAPoint,
|
|
|
|
const VContainer *data, VSAPoint &point) const;
|
|
|
|
bool GetPassmarkNextSAPoint(const QVector<VPieceNode> &path, int index, const VSAPoint &passmarkSAPoint,
|
|
|
|
const VContainer *data, VSAPoint &point) const;
|
2017-03-28 12:09:00 +02:00
|
|
|
bool GetSeamPassmarkSAPoint(const VSAPoint &previousSAPoint, const VSAPoint &passmarkSAPoint,
|
|
|
|
const VSAPoint &nextSAPoint, const VContainer *data, QPointF &point) const;
|
|
|
|
|
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
|
|
|
|
2017-03-30 11:26:06 +02:00
|
|
|
QVector<QLineF> CreatePassmark(const QVector<VPieceNode> &path, int previousIndex, int passmarkIndex, int nextIndex,
|
|
|
|
const VContainer *data) const;
|
2017-04-05 12:22:33 +02:00
|
|
|
QVector<QLineF> SAPassmark(const QVector<VPieceNode> &path, const VSAPoint &previousSAPoint,
|
|
|
|
const VSAPoint &passmarkSAPoint, const VSAPoint &nextSAPoint, const VContainer *data,
|
|
|
|
int passmarkIndex) const;
|
|
|
|
QVector<QLineF> BuiltInSAPassmark(const QVector<VPieceNode> &path, const VSAPoint &previousSAPoint,
|
|
|
|
const VSAPoint &passmarkSAPoint, const VSAPoint &nextSAPoint,
|
|
|
|
const VContainer *data, int passmarkIndex) 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);
|
2016-11-03 16:59:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
Q_DECLARE_TYPEINFO(VPiece, Q_MOVABLE_TYPE);
|
|
|
|
|
|
|
|
#endif // VPIECE_H
|