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