2019-05-08 14:19:03 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vpassmark.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 1 5, 2019
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentina project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2019 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2019-05-08 14:19:03 +02: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 VPASSMARK_H
|
|
|
|
#define VPASSMARK_H
|
|
|
|
|
|
|
|
#include <QMetaType>
|
2023-11-28 15:40:27 +01:00
|
|
|
#include <QtGlobal>
|
2019-05-08 14:19:03 +02:00
|
|
|
|
|
|
|
#include "../vmisc/typedef.h"
|
2023-11-28 15:40:27 +01:00
|
|
|
#include "vpiece.h"
|
2019-05-08 14:19:03 +02:00
|
|
|
|
2020-07-10 19:15:19 +02:00
|
|
|
class QPainterPath;
|
|
|
|
|
2023-11-28 15:40:27 +01:00
|
|
|
enum class PassmarkStatus : qint8
|
2019-05-08 14:19:03 +02:00
|
|
|
{
|
|
|
|
Error = 0,
|
|
|
|
Common = 1,
|
|
|
|
Rollback = -1
|
|
|
|
};
|
|
|
|
|
|
|
|
QT_WARNING_PUSH
|
|
|
|
QT_WARNING_DISABLE_GCC("-Weffc++")
|
|
|
|
|
|
|
|
struct VPiecePassmarkData
|
|
|
|
{
|
2023-11-28 15:40:27 +01:00
|
|
|
VSAPoint previousSAPoint{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
|
|
|
VSAPoint passmarkSAPoint{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
|
|
|
VSAPoint nextSAPoint{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
|
|
|
qreal saWidth{0}; // NOLINT(misc-non-private-member-variables-in-classes)
|
|
|
|
QString nodeName{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
|
|
|
QString pieceName{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
|
|
|
// NOLINTNEXTLINE(misc-non-private-member-variables-in-classes)
|
|
|
|
PassmarkLineType passmarkLineType{PassmarkLineType::OneLine};
|
|
|
|
// NOLINTNEXTLINE(misc-non-private-member-variables-in-classes)
|
|
|
|
PassmarkAngleType passmarkAngleType{PassmarkAngleType::Straightforward};
|
|
|
|
bool isMainPathNode{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
|
|
|
bool isShowSecondPassmark{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
|
|
|
vsizetype passmarkIndex{-1}; // NOLINT(misc-non-private-member-variables-in-classes)
|
|
|
|
vidtype id{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes)
|
|
|
|
qreal globalPassmarkLength{0}; // NOLINT(misc-non-private-member-variables-in-classes)
|
|
|
|
qreal globalPassmarkWidth{0}; // NOLINT(misc-non-private-member-variables-in-classes)
|
2019-09-05 13:13:22 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto toJson() const -> QJsonObject;
|
2019-05-08 14:19:03 +02:00
|
|
|
};
|
|
|
|
|
2023-05-08 16:50:22 +02:00
|
|
|
Q_DECLARE_METATYPE(VPiecePassmarkData) // NOLINT
|
2022-08-12 17:50:13 +02:00
|
|
|
Q_DECLARE_TYPEINFO(VPiecePassmarkData, Q_MOVABLE_TYPE); // NOLINT
|
2019-05-08 14:19:03 +02:00
|
|
|
|
|
|
|
QT_WARNING_POP
|
|
|
|
|
2023-11-28 15:40:27 +01:00
|
|
|
enum class PassmarkSide : qint8
|
|
|
|
{
|
|
|
|
All = 0,
|
|
|
|
Left = 1,
|
|
|
|
Right = 2
|
|
|
|
};
|
2019-05-08 14:19:03 +02:00
|
|
|
|
|
|
|
class VPassmark
|
|
|
|
{
|
|
|
|
public:
|
2023-05-08 16:50:22 +02:00
|
|
|
VPassmark() = default;
|
2019-05-08 18:54:30 +02:00
|
|
|
explicit VPassmark(const VPiecePassmarkData &data);
|
2019-05-08 14:19:03 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto FullPassmark(const VPiece &piece, const VContainer *data) const -> QVector<QLineF>;
|
|
|
|
auto SAPassmark(const VPiece &piece, const VContainer *data, PassmarkSide side) const -> QVector<QLineF>;
|
|
|
|
auto SAPassmark(const QVector<QPointF> &seamAllowance, const QVector<QPointF> &rotatedSeamAllowance,
|
|
|
|
PassmarkSide side) const -> QVector<QLineF>;
|
|
|
|
auto BuiltInSAPassmark(const VPiece &piece, const VContainer *data) const -> QVector<QLineF>;
|
2019-05-08 14:19:03 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto BuiltInSAPassmarkBaseLine(const VPiece &piece) const -> QVector<QLineF>;
|
|
|
|
auto SAPassmarkBaseLine(const VPiece &piece, const VContainer *data, PassmarkSide side) const -> QVector<QLineF>;
|
|
|
|
auto SAPassmarkBaseLine(const QVector<QPointF> &seamAllowance, const QVector<QPointF> &rotatedSeamAllowance,
|
|
|
|
PassmarkSide side) const -> QVector<QLineF>;
|
2019-05-27 13:57:36 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto SAPassmarkPath(const VPiece &piece, const VContainer *data, PassmarkSide side) const -> QPainterPath;
|
|
|
|
auto BuiltInSAPassmarkPath(const VPiece &piece, const VContainer *data) const -> QPainterPath;
|
2019-05-08 14:19:03 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto IsNull() const -> bool;
|
2019-05-08 14:19:03 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto Data() const -> VPiecePassmarkData;
|
2019-05-27 13:57:36 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
static auto FindIntersection(const QLineF &line, const QVector<QPointF> &seamAllowance) -> QLineF;
|
2019-05-27 13:57:36 +02:00
|
|
|
|
|
|
|
static const qreal passmarkRadiusFactor;
|
2023-11-28 15:40:27 +01:00
|
|
|
|
2019-05-08 14:19:03 +02:00
|
|
|
private:
|
2019-05-27 13:57:36 +02:00
|
|
|
VPiecePassmarkData m_data{};
|
2019-05-08 14:19:03 +02:00
|
|
|
bool m_null{true};
|
2023-05-06 19:01:15 +02:00
|
|
|
|
|
|
|
auto PassmarkIntersection(const QVector<QPointF> &path, QLineF line, qreal width) const -> QLineF;
|
|
|
|
|
|
|
|
auto PassmarkStraightforwardBaseLine(const QPointF &seamPassmarkSAPoint) const -> QVector<QLineF>;
|
|
|
|
auto PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const QPointF &seamPassmarkSAPoint,
|
|
|
|
const QVector<QPointF> &seamAllowance) const -> QVector<QLineF>;
|
|
|
|
auto PassmarkIntersectionBaseLine(const QVector<QPointF> &path, PassmarkSide side) const -> QVector<QLineF>;
|
|
|
|
auto PassmarkIntersection2BaseLine(const QVector<QPointF> &path, PassmarkSide side) const -> QVector<QLineF>;
|
|
|
|
|
|
|
|
auto CreatePassmarkLines(const QVector<QLineF> &lines, const QVector<QPointF> &seamAllowance,
|
|
|
|
PassmarkSide side) const -> QVector<QLineF>;
|
2019-05-08 14:19:03 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VPASSMARK_H
|