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
|
|
|
|
** <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 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;
|
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
|
|
|
|
VPiecePath &operator=(VPiecePath &&path) Q_DECL_NOTHROW { Swap(path); return *this; }
|
|
|
|
#endif
|
|
|
|
|
2018-04-22 12:32:06 +02:00
|
|
|
inline void Swap(VPiecePath &path) Q_DECL_NOTHROW
|
2017-04-19 12:27:17 +02:00
|
|
|
{ std::swap(d, path.d); }
|
|
|
|
|
2016-11-23 11:54:46 +01:00
|
|
|
void Append(const VPieceNode &node);
|
|
|
|
void Clear();
|
|
|
|
qint32 CountNodes() const;
|
|
|
|
|
|
|
|
VPieceNode & operator[](int indx);
|
|
|
|
const VPieceNode & at ( int indx ) const;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2018-07-26 19:00:24 +02:00
|
|
|
void SetFirstToCuttingCountour(bool value);
|
|
|
|
bool IsFirstToCuttingCountour() const;
|
|
|
|
|
|
|
|
void SetLastToCuttingCountour(bool value);
|
|
|
|
bool IsLastToCuttingCountour() const;
|
|
|
|
|
|
|
|
QVector<QPointF> PathPoints(const VContainer *data,
|
|
|
|
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;
|
|
|
|
int 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
|
|
|
|
2016-11-23 11:54:46 +01:00
|
|
|
VSAPoint StartSegment(const VContainer *data, int i, bool reverse) const;
|
|
|
|
VSAPoint EndSegment(const VContainer *data, int i, bool reverse) const;
|
|
|
|
|
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);
|
|
|
|
|
2017-04-25 19:48:32 +02:00
|
|
|
static int FindInLoopNotExcludedUp(int start, const QVector<VPieceNode> &nodes);
|
|
|
|
static int FindInLoopNotExcludedDown(int start, const QVector<VPieceNode> &nodes);
|
2017-03-25 09:18:03 +01:00
|
|
|
|
2016-11-29 13:10:53 +01:00
|
|
|
static VSAPoint StartSegment(const VContainer *data, const QVector<VPieceNode> &nodes, int i, bool reverse);
|
|
|
|
static VSAPoint EndSegment(const VContainer *data, const QVector<VPieceNode> &nodes, int i, bool reverse);
|
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,
|
|
|
|
int i, bool reverse, qreal width);
|
2016-11-28 09:47:36 +01:00
|
|
|
|
2018-09-28 13:29:10 +02:00
|
|
|
static QString NodeName(const QVector<VPieceNode> &nodes, int nodeIndex, const VContainer *data);
|
|
|
|
|
2016-11-23 11:54:46 +01:00
|
|
|
private:
|
|
|
|
QSharedDataPointer<VPiecePathData> d;
|
|
|
|
};
|
|
|
|
|
|
|
|
Q_DECLARE_TYPEINFO(VPiecePath, Q_MOVABLE_TYPE);
|
2017-09-11 14:56:18 +02:00
|
|
|
Q_DECLARE_METATYPE(VPiecePath)
|
2016-11-23 11:54:46 +01:00
|
|
|
|
|
|
|
#endif // VPIECEPATH_H
|