2016-11-23 11:54:46 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 22 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-23 11:54:46 +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-23 11:54:46 +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 VPIECEPATH_H
|
|
|
|
#define VPIECEPATH_H
|
|
|
|
|
|
|
|
#include <QtGlobal>
|
|
|
|
#include <QSharedDataPointer>
|
|
|
|
|
2016-11-24 20:26:51 +01:00
|
|
|
#include "../vmisc/def.h"
|
2017-02-18 10:22:59 +01:00
|
|
|
#include "../vgeometry/vabstractcurve.h"
|
2016-11-24 20:26:51 +01:00
|
|
|
|
2016-11-23 11:54:46 +01:00
|
|
|
class VPiecePathData;
|
|
|
|
class VSAPoint;
|
2017-02-18 10:22:59 +01:00
|
|
|
class VContainer;
|
2016-11-23 11:54:46 +01:00
|
|
|
class QPainterPath;
|
2017-02-18 10:22:59 +01:00
|
|
|
class VPointF;
|
|
|
|
class VPieceNode;
|
2018-01-03 18:31:50 +01:00
|
|
|
class VInternalVariable;
|
2022-10-28 15:16:02 +02:00
|
|
|
class VLayoutPoint;
|
2016-11-23 11:54:46 +01:00
|
|
|
|
|
|
|
class VPiecePath
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VPiecePath();
|
2016-12-03 12:31:59 +01:00
|
|
|
explicit VPiecePath(PiecePathType type);
|
2016-11-23 11:54:46 +01:00
|
|
|
VPiecePath(const VPiecePath &path);
|
2017-04-19 12:27:17 +02:00
|
|
|
|
2016-11-23 11:54:46 +01:00
|
|
|
~VPiecePath();
|
|
|
|
|
2017-04-19 12:27:17 +02:00
|
|
|
VPiecePath &operator=(const VPiecePath &path);
|
|
|
|
#ifdef Q_COMPILER_RVALUE_REFS
|
2022-08-12 17:50:13 +02:00
|
|
|
VPiecePath(VPiecePath &&path) Q_DECL_NOTHROW;
|
2019-12-30 12:00:57 +01:00
|
|
|
VPiecePath &operator=(VPiecePath &&path) Q_DECL_NOTHROW;
|
2017-04-19 12:27:17 +02:00
|
|
|
#endif
|
|
|
|
|
2016-11-23 11:54:46 +01:00
|
|
|
void Append(const VPieceNode &node);
|
|
|
|
void Clear();
|
2023-02-09 16:23:11 +01:00
|
|
|
vsizetype CountNodes() const;
|
2016-11-23 11:54:46 +01:00
|
|
|
|
2023-02-09 16:23:11 +01:00
|
|
|
VPieceNode & operator[](vsizetype indx);
|
|
|
|
const VPieceNode & at (vsizetype indx ) const;
|
2016-11-23 11:54:46 +01:00
|
|
|
|
|
|
|
QVector<VPieceNode> GetNodes() const;
|
|
|
|
void SetNodes(const QVector<VPieceNode> &nodes);
|
|
|
|
|
2016-11-24 20:26:51 +01:00
|
|
|
PiecePathType GetType() const;
|
|
|
|
void SetType(PiecePathType type);
|
|
|
|
|
2016-11-28 09:42:37 +01:00
|
|
|
QString GetName() const;
|
|
|
|
void SetName(const QString &name);
|
|
|
|
|
2016-12-03 17:01:39 +01:00
|
|
|
Qt::PenStyle GetPenType() const;
|
|
|
|
void SetPenType(const Qt::PenStyle &type);
|
|
|
|
|
2017-07-16 20:10:48 +02:00
|
|
|
bool IsCutPath() const;
|
|
|
|
void SetCutPath(bool cut);
|
|
|
|
|
2018-01-03 18:31:50 +01:00
|
|
|
QString GetVisibilityTrigger() const;
|
|
|
|
void SetVisibilityTrigger(const QString &formula);
|
|
|
|
|
2022-11-14 17:02:00 +01:00
|
|
|
void SetFirstToCuttingContour(bool value);
|
|
|
|
bool IsFirstToCuttingContour() const;
|
2018-07-26 19:00:24 +02:00
|
|
|
|
2022-11-14 17:02:00 +01:00
|
|
|
void SetLastToCuttingContour(bool value);
|
|
|
|
bool IsLastToCuttingContour() const;
|
2018-07-26 19:00:24 +02:00
|
|
|
|
2022-10-28 15:16:02 +02:00
|
|
|
QVector<VLayoutPoint> PathPoints(const VContainer *data,
|
2018-07-26 19:00:24 +02:00
|
|
|
const QVector<QPointF> &cuttingPath = QVector<QPointF>()) const;
|
2018-04-02 15:49:53 +02:00
|
|
|
QVector<VPointF> PathNodePoints(const VContainer *data, bool showExcluded = true) const;
|
|
|
|
QVector<QVector<QPointF> > PathCurvePoints(const VContainer *data) const;
|
|
|
|
QVector<VSAPoint> SeamAllowancePoints(const VContainer *data, qreal width, bool reverse) const;
|
2016-11-23 11:54:46 +01:00
|
|
|
|
2018-07-26 19:00:24 +02:00
|
|
|
QPainterPath PainterPath(const VContainer *data, const QVector<QPointF> &cuttingPath) const;
|
2018-04-02 15:49:53 +02:00
|
|
|
QVector<QPainterPath> CurvesPainterPath(const VContainer *data) const;
|
2016-11-23 11:54:46 +01:00
|
|
|
|
2017-10-23 09:45:58 +02:00
|
|
|
QList<quint32> Dependencies() const;
|
2016-11-29 13:10:53 +01:00
|
|
|
QVector<quint32> MissingNodes(const VPiecePath &path) const;
|
|
|
|
|
2018-09-28 13:29:10 +02:00
|
|
|
QString NodeName(int nodeIndex, const VContainer *data) const;
|
|
|
|
|
2017-01-16 11:08:13 +01:00
|
|
|
int indexOfNode(quint32 id) const;
|
|
|
|
void NodeOnEdge(quint32 index, VPieceNode &p1, VPieceNode &p2) const;
|
2017-01-17 12:49:55 +01:00
|
|
|
bool Contains(quint32 id) const;
|
|
|
|
bool OnEdge(quint32 p1, quint32 p2) const;
|
2023-02-09 16:23:11 +01:00
|
|
|
vsizetype Edge(quint32 p1, quint32 p2) const;
|
2017-01-16 11:08:13 +01:00
|
|
|
|
|
|
|
QVector<VPieceNode> ListNodePoint() const;
|
|
|
|
|
|
|
|
VPiecePath RemoveEdge(quint32 index) const;
|
2016-11-29 13:10:53 +01:00
|
|
|
|
2022-10-15 17:20:49 +02:00
|
|
|
VSAPoint StartSegment(const VContainer *data, int i) const;
|
|
|
|
VSAPoint EndSegment(const VContainer *data, int i) const;
|
2016-11-23 11:54:46 +01:00
|
|
|
|
2016-12-01 19:47:15 +01:00
|
|
|
QPointF NodePreviousPoint(const VContainer *data, int i) const;
|
|
|
|
QPointF NodeNextPoint(const VContainer *data, int i) const;
|
2018-01-03 18:31:50 +01:00
|
|
|
|
|
|
|
bool IsVisible(const QHash<QString, QSharedPointer<VInternalVariable> > *vars) const;
|
2016-12-01 19:47:15 +01:00
|
|
|
|
2017-03-30 11:26:06 +02:00
|
|
|
static int indexOfNode(const QVector<VPieceNode> &nodes, quint32 id);
|
|
|
|
|
2023-02-09 16:23:11 +01:00
|
|
|
static vsizetype FindInLoopNotExcludedUp(vsizetype start, const QVector<VPieceNode> &nodes);
|
|
|
|
static vsizetype FindInLoopNotExcludedDown(vsizetype start, const QVector<VPieceNode> &nodes);
|
2017-03-25 09:18:03 +01:00
|
|
|
|
2023-02-09 16:23:11 +01:00
|
|
|
static VSAPoint StartSegment(const VContainer *data, const QVector<VPieceNode> &nodes, vsizetype i);
|
|
|
|
static VSAPoint EndSegment(const VContainer *data, const QVector<VPieceNode> &nodes, vsizetype i);
|
2016-11-28 09:47:36 +01:00
|
|
|
|
2016-11-29 13:10:53 +01:00
|
|
|
static VSAPoint PreparePointEkv(const VPieceNode &node, const VContainer *data);
|
|
|
|
|
|
|
|
static QVector<VSAPoint> CurveSeamAllowanceSegment(const VContainer *data, const QVector<VPieceNode> &nodes,
|
|
|
|
const QSharedPointer<VAbstractCurve> &curve,
|
2023-02-09 16:23:11 +01:00
|
|
|
vsizetype i, bool reverse, qreal width,
|
2020-10-05 15:39:01 +02:00
|
|
|
const QString &piece = QString());
|
2016-11-28 09:47:36 +01:00
|
|
|
|
2023-02-09 16:23:11 +01:00
|
|
|
static QString NodeName(const QVector<VPieceNode> &nodes, vsizetype nodeIndex, const VContainer *data);
|
2018-09-28 13:29:10 +02:00
|
|
|
|
2022-10-28 15:16:02 +02:00
|
|
|
static QVector<VLayoutPoint> NodesToPoints(const VContainer *data, const QVector<VPieceNode> &nodes,
|
|
|
|
const QString &piece = QString());
|
2019-02-11 14:00:32 +01:00
|
|
|
|
2016-11-23 11:54:46 +01:00
|
|
|
private:
|
|
|
|
QSharedDataPointer<VPiecePathData> d;
|
|
|
|
};
|
|
|
|
|
2022-08-12 17:50:13 +02:00
|
|
|
Q_DECLARE_TYPEINFO(VPiecePath, Q_MOVABLE_TYPE); // NOLINT
|
2017-09-11 14:56:18 +02:00
|
|
|
Q_DECLARE_METATYPE(VPiecePath)
|
2016-11-23 11:54:46 +01:00
|
|
|
|
|
|
|
#endif // VPIECEPATH_H
|