2015-06-16 10:30:25 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vabstractpattern.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 15 6, 2015
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2015-06-16 10:30:25 +02:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2015 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2015-06-16 10:30:25 +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 VABSTRACTPATTERN_H
|
|
|
|
#define VABSTRACTPATTERN_H
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <qcompilerdetection.h>
|
|
|
|
#include <QHash>
|
|
|
|
#include <QMap>
|
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QPair>
|
|
|
|
#include <QString>
|
|
|
|
#include <QStringList>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QtGlobal>
|
2022-01-28 15:54:20 +01:00
|
|
|
#include <QUuid>
|
2016-08-08 13:44:49 +02:00
|
|
|
|
|
|
|
#include "../vmisc/def.h"
|
2015-06-16 10:30:25 +02:00
|
|
|
#include "vdomdocument.h"
|
|
|
|
#include "vtoolrecord.h"
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
class QDomElement;
|
2017-01-16 10:59:02 +01:00
|
|
|
class VPiecePath;
|
|
|
|
class VPieceNode;
|
2022-01-11 16:24:16 +01:00
|
|
|
class VPatternImage;
|
2022-01-28 15:54:20 +01:00
|
|
|
class VBackgroundPatternImage;
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2020-01-07 11:54:01 +01:00
|
|
|
enum class Document : qint8 { FullLiteParse, LiteParse, LitePPParse, FullParse };
|
|
|
|
enum class LabelType : qint8 {NewPatternPiece, NewLabel};
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2016-01-24 17:15:08 +01:00
|
|
|
// Don't touch values!!!. Same values stored in xml.
|
2020-01-07 11:54:01 +01:00
|
|
|
enum class CrossCirclesPoint : qint8 {FirstPoint = 1, SecondPoint = 2};
|
|
|
|
enum class VCrossCurvesPoint : qint8 {HighestPoint = 1, LowestPoint = 2};
|
|
|
|
enum class HCrossCurvesPoint : qint8 {LeftmostPoint = 1, RightmostPoint = 2};
|
|
|
|
enum class AxisType : qint8 {VerticalAxis = 1, HorizontalAxis = 2};
|
2016-01-24 17:15:08 +01:00
|
|
|
|
2015-06-18 19:23:24 +02:00
|
|
|
class VContainer;
|
2016-08-08 13:44:49 +02:00
|
|
|
class VDataTool;
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2017-08-08 16:43:41 +02:00
|
|
|
QT_WARNING_PUSH
|
|
|
|
QT_WARNING_DISABLE_GCC("-Weffc++")
|
|
|
|
|
|
|
|
struct VFormulaField
|
|
|
|
{
|
|
|
|
QString expression;
|
|
|
|
QDomElement element;
|
|
|
|
QString attribute;
|
|
|
|
};
|
|
|
|
|
2017-09-26 11:54:52 +02:00
|
|
|
struct VFinalMeasurement
|
|
|
|
{
|
|
|
|
QString name;
|
|
|
|
QString formula;
|
|
|
|
QString description;
|
|
|
|
};
|
|
|
|
|
2020-03-24 16:31:32 +01:00
|
|
|
struct VGroupData
|
|
|
|
{
|
|
|
|
QString name{};
|
|
|
|
bool visible{true};
|
|
|
|
QStringList tags{};
|
2021-11-18 12:29:36 +01:00
|
|
|
vidtype tool{NULL_ID};
|
|
|
|
QVector<QPair<vidtype, vidtype>> items{};
|
2020-03-24 16:31:32 +01:00
|
|
|
};
|
|
|
|
|
2017-08-08 16:43:41 +02:00
|
|
|
QT_WARNING_POP
|
|
|
|
|
2021-09-25 11:57:15 +02:00
|
|
|
QT_WARNING_PUSH
|
|
|
|
QT_WARNING_DISABLE_GCC("-Wsuggest-final-types")
|
|
|
|
|
2018-01-26 13:43:52 +01:00
|
|
|
class VAbstractPattern : public VDomDocument
|
2015-06-16 10:30:25 +02:00
|
|
|
{
|
2022-08-12 17:50:13 +02:00
|
|
|
Q_OBJECT // NOLINT
|
2015-06-16 10:30:25 +02:00
|
|
|
public:
|
2015-10-12 13:52:48 +02:00
|
|
|
explicit VAbstractPattern(QObject *parent = nullptr);
|
2018-05-10 12:46:50 +02:00
|
|
|
virtual ~VAbstractPattern();
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto RequiresMeasurements() const -> bool;
|
|
|
|
auto ListMeasurements() const -> QStringList;
|
|
|
|
auto ListExpressions() const -> QVector<VFormulaField>;
|
|
|
|
auto ListIncrementExpressions() const -> QVector<VFormulaField>;
|
2015-08-11 15:41:03 +02:00
|
|
|
|
2023-05-06 19:01:15 +02:00
|
|
|
virtual void CreateEmptyFile() = 0;
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2023-05-06 19:01:15 +02:00
|
|
|
void ChangeActivPP(const QString &name, const Document &parse = Document::FullParse);
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetNameActivPP() const -> QString;
|
|
|
|
auto CheckExistNamePP(const QString &name) const -> bool;
|
|
|
|
auto CountPP() const -> int;
|
|
|
|
auto GetPPElement(const QString &name) -> QDomElement;
|
|
|
|
auto ChangeNamePP(const QString &oldName, const QString &newName) -> bool;
|
|
|
|
auto appendPP(const QString &name) -> bool;
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetActivNodeElement(const QString &name, QDomElement &element) const -> bool;
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getCursor() const -> quint32;
|
2023-05-06 19:01:15 +02:00
|
|
|
void setCursor(const quint32 &value);
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2023-05-06 19:01:15 +02:00
|
|
|
virtual void setXMLContent(const QString &fileName) override;
|
2018-11-18 08:52:08 +01:00
|
|
|
|
2023-05-06 19:01:15 +02:00
|
|
|
virtual void IncrementReferens(quint32 id) const = 0;
|
|
|
|
virtual void DecrementReferens(quint32 id) const = 0;
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
virtual auto GenerateLabel(const LabelType &type, const QString &reservedName = QString()) const -> QString = 0;
|
|
|
|
virtual auto GenerateSuffix() const -> QString = 0;
|
2015-06-18 19:23:24 +02:00
|
|
|
|
2023-05-06 19:01:15 +02:00
|
|
|
virtual void UpdateToolData(const quint32 &id, VContainer *data) = 0;
|
2015-06-18 19:23:24 +02:00
|
|
|
|
2019-10-18 13:01:18 +02:00
|
|
|
virtual void Clear();
|
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
static auto getTool(quint32 id) -> VDataTool *;
|
2023-05-06 19:01:15 +02:00
|
|
|
static void AddTool(quint32 id, VDataTool *tool);
|
|
|
|
static void RemoveTool(quint32 id);
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
static auto ParsePieceNodes(const QDomElement &domElement) -> VPiecePath;
|
|
|
|
static auto ParsePieceCSARecords(const QDomElement &domElement) -> QVector<CustomSARecord>;
|
|
|
|
static auto ParsePieceInternalPaths(const QDomElement &domElement) -> QVector<quint32>;
|
|
|
|
static auto ParsePiecePointRecords(const QDomElement &domElement) -> QVector<quint32>;
|
2017-01-16 10:59:02 +01:00
|
|
|
|
2023-05-06 19:01:15 +02:00
|
|
|
void AddToolOnRemove(VDataTool *tool);
|
2016-02-10 17:45:49 +01:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getHistory() -> QVector<VToolRecord> *;
|
|
|
|
auto getLocalHistory() const -> QVector<VToolRecord>;
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto MPath() const -> QString;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetMPath(const QString &path);
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto SiblingNodeId(const quint32 &nodeId) const -> quint32;
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getPatternPieces() const -> QStringList;
|
2015-06-16 11:04:48 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetDescription() const -> QString;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetDescription(const QString &text);
|
2015-06-16 11:04:48 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetNotes() const -> QString;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetNotes(const QString &text);
|
2015-06-16 11:04:48 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetPatternName() const -> QString;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetPatternName(const QString &qsName);
|
2017-08-19 18:10:57 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetCompanyName() const -> QString;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetCompanyName(const QString &qsName);
|
2017-08-19 18:10:57 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetPatternNumber() const -> QString;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetPatternNumber(const QString &qsNum);
|
2017-08-19 18:10:57 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetCustomerName() const -> QString;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetCustomerName(const QString &qsName);
|
2016-06-26 16:49:51 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetCustomerBirthDate() const -> QDate;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetCustomerBirthDate(const QDate &date);
|
2020-10-16 10:37:49 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetCustomerEmail() const -> QString;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetCustomerEmail(const QString &email);
|
2020-10-16 10:37:49 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetLabelDateFormat() const -> QString;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetLabelDateFormat(const QString &format);
|
2017-08-19 18:10:57 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetLabelTimeFormat() const -> QString;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetLabelTimeFormat(const QString &format);
|
2017-08-19 18:10:57 +02:00
|
|
|
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetPatternLabelTemplate(const QVector<VLabelTemplateLine> &lines);
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetPatternLabelTemplate() const -> QVector<VLabelTemplateLine>;
|
2017-08-15 09:44:00 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto SetWatermarkPath(const QString &path) -> bool;
|
|
|
|
auto GetWatermarkPath() const -> QString;
|
2019-12-13 09:51:29 +01:00
|
|
|
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetPatternMaterials(const QMap<int, QString> &materials);
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetPatternMaterials() const -> QMap<int, QString>;
|
2017-08-30 07:55:07 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetFinalMeasurements() const -> QVector<VFinalMeasurement>;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetFinalMeasurements(const QVector<VFinalMeasurement> &measurements);
|
2017-09-26 11:54:52 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetDefaultPieceLabelPath() const -> QString;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetDefaultPieceLabelPath(const QString &path);
|
2023-01-16 15:40:50 +01:00
|
|
|
|
2017-08-15 14:22:33 +02:00
|
|
|
void SetPatternWasChanged(bool changed);
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetPatternWasChanged() const -> bool;
|
2017-08-15 14:22:33 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetPassmarkLengthVariable() const -> QString;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetPassmarkLengthVariable(const QString &name);
|
|
|
|
|
|
|
|
auto GetPassmarkWidthVariable() const -> QString;
|
|
|
|
void SetPassmarkWidthVariable(const QString &name);
|
2021-05-10 15:39:17 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetImage() const -> VPatternImage;
|
|
|
|
auto SetImage(const VPatternImage &image) -> bool;
|
2023-05-06 19:01:15 +02:00
|
|
|
void DeleteImage();
|
2016-03-09 20:01:37 +01:00
|
|
|
|
2022-01-28 15:54:20 +01:00
|
|
|
auto GetBackgroundImages() const -> QVector<VBackgroundPatternImage>;
|
|
|
|
void SaveBackgroundImages(const QVector<VBackgroundPatternImage> &images);
|
|
|
|
auto GetBackgroundImage(const QUuid &id) const -> VBackgroundPatternImage;
|
|
|
|
void SaveBackgroundImage(const VBackgroundPatternImage &image);
|
|
|
|
void DeleteBackgroundImage(const QUuid &id);
|
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetVersion() const -> QString;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetVersion();
|
2015-06-16 11:04:48 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto IsModified() const -> bool;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetModified(bool modified);
|
2015-12-18 12:57:03 +01:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetDraw(const QString &name) const -> QDomElement;
|
2016-01-07 17:43:08 +01:00
|
|
|
|
2023-05-06 19:01:15 +02:00
|
|
|
void ParseGroups(const QDomElement &domElement);
|
2023-05-03 13:07:02 +02:00
|
|
|
auto CreateGroups(const QString &patternPieceName = QString()) -> QDomElement;
|
|
|
|
auto CreateGroup(quint32 id, const QString &name, const QStringList &tags, const QMap<quint32, quint32> &groupData,
|
|
|
|
vidtype tool = null_id) -> QDomElement;
|
|
|
|
auto GroupLinkedToTool(vidtype toolId) const -> vidtype;
|
2020-03-24 16:31:32 +01:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetGroupName(quint32 id) -> QString;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetGroupName(quint32 id, const QString &name);
|
2020-03-24 16:31:32 +01:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetGroupTags(vidtype id) -> QStringList;
|
2023-05-06 19:01:15 +02:00
|
|
|
void SetGroupTags(quint32 id, const QStringList &tags);
|
2020-03-24 16:31:32 +01:00
|
|
|
|
2022-08-06 12:33:07 +02:00
|
|
|
auto GetDimensionAValue() -> double;
|
|
|
|
void SetDimensionAValue(double value);
|
|
|
|
|
|
|
|
auto GetDimensionBValue() -> double;
|
|
|
|
void SetDimensionBValue(double value);
|
|
|
|
|
|
|
|
auto GetDimensionCValue() -> double;
|
|
|
|
void SetDimensionCValue(double value);
|
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetGroupCategories() const -> QStringList;
|
2020-03-24 16:31:32 +01:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetGroups(const QString &patternPieceName = QString()) -> QMap<quint32, VGroupData>;
|
|
|
|
auto GetGroupsContainingItem(quint32 toolId, quint32 objectId, bool containItem) -> QMap<quint32, QString>;
|
|
|
|
auto AddItemToGroup(quint32 toolId, quint32 objectId, quint32 groupId) -> QDomElement;
|
|
|
|
auto RemoveItemFromGroup(quint32 toolId, quint32 objectId, quint32 groupId) -> QDomElement;
|
|
|
|
auto GetGroupVisibility(quint32 id) -> bool;
|
2016-04-05 19:14:12 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
static auto FilterGroupTags(const QString &tags) -> QStringList;
|
2020-03-24 16:31:32 +01:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto PieceDrawName(quint32 id) -> QString;
|
2017-10-26 15:57:52 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
virtual auto GetCompleteData() const -> VContainer;
|
|
|
|
virtual auto GetCompletePPData(const QString &name) const -> VContainer;
|
2020-12-05 11:36:40 +01:00
|
|
|
|
2021-05-07 10:19:06 +02:00
|
|
|
auto Units() const -> Unit;
|
|
|
|
|
2015-06-16 10:30:25 +02:00
|
|
|
static const QString TagPattern;
|
|
|
|
static const QString TagCalculation;
|
|
|
|
static const QString TagModeling;
|
|
|
|
static const QString TagDetails;
|
2016-05-16 19:59:04 +02:00
|
|
|
static const QString TagDetail;
|
2015-06-16 10:30:25 +02:00
|
|
|
static const QString TagDescription;
|
2016-03-09 20:01:37 +01:00
|
|
|
static const QString TagImage;
|
2015-06-16 10:30:25 +02:00
|
|
|
static const QString TagNotes;
|
|
|
|
static const QString TagMeasurements;
|
|
|
|
static const QString TagIncrements;
|
2017-09-02 13:47:44 +02:00
|
|
|
static const QString TagPreviewCalculations;
|
2015-06-16 10:30:25 +02:00
|
|
|
static const QString TagIncrement;
|
|
|
|
static const QString TagDraw;
|
2016-04-05 19:53:49 +02:00
|
|
|
static const QString TagGroups;
|
2016-04-06 11:03:34 +02:00
|
|
|
static const QString TagGroup;
|
|
|
|
static const QString TagGroupItem;
|
2015-06-16 10:30:25 +02:00
|
|
|
static const QString TagPoint;
|
|
|
|
static const QString TagSpline;
|
|
|
|
static const QString TagArc;
|
2016-12-17 02:53:47 +01:00
|
|
|
static const QString TagElArc;
|
2015-06-16 10:30:25 +02:00
|
|
|
static const QString TagTools;
|
2016-05-16 19:27:51 +02:00
|
|
|
static const QString TagOperation;
|
2016-06-17 16:42:38 +02:00
|
|
|
static const QString TagData;
|
2016-07-02 01:49:38 +02:00
|
|
|
static const QString TagPatternInfo;
|
2016-06-26 16:49:51 +02:00
|
|
|
static const QString TagPatternName;
|
|
|
|
static const QString TagPatternNum;
|
|
|
|
static const QString TagCompanyName;
|
|
|
|
static const QString TagCustomerName;
|
2020-10-16 10:37:49 +02:00
|
|
|
static const QString TagCustomerBirthDate;
|
|
|
|
static const QString TagCustomerEmail;
|
2017-08-15 09:44:00 +02:00
|
|
|
static const QString TagPatternLabel;
|
2019-12-13 09:51:29 +01:00
|
|
|
static const QString TagWatermark;
|
2017-08-30 07:55:07 +02:00
|
|
|
static const QString TagPatternMaterials;
|
2017-09-26 11:54:52 +02:00
|
|
|
static const QString TagFinalMeasurements;
|
2017-08-30 07:55:07 +02:00
|
|
|
static const QString TagMaterial;
|
2017-09-26 11:54:52 +02:00
|
|
|
static const QString TagFMeasurement;
|
2016-09-06 23:50:46 +02:00
|
|
|
static const QString TagGrainline;
|
2016-11-24 20:35:07 +01:00
|
|
|
static const QString TagPath;
|
|
|
|
static const QString TagNodes;
|
|
|
|
static const QString TagNode;
|
2022-01-28 15:54:20 +01:00
|
|
|
static const QString TagBackgroundImages;
|
|
|
|
static const QString TagBackgroundImage;
|
2023-01-16 15:40:50 +01:00
|
|
|
static const QString TagPieceLabel;
|
2015-06-16 10:30:25 +02:00
|
|
|
|
|
|
|
static const QString AttrName;
|
2016-04-05 19:53:49 +02:00
|
|
|
static const QString AttrVisible;
|
|
|
|
static const QString AttrObject;
|
|
|
|
static const QString AttrTool;
|
2015-06-16 10:30:25 +02:00
|
|
|
static const QString AttrType;
|
2016-06-17 16:42:38 +02:00
|
|
|
static const QString AttrLetter;
|
2017-08-21 12:16:43 +02:00
|
|
|
static const QString AttrAnnotation;
|
|
|
|
static const QString AttrOrientation;
|
2017-08-21 16:10:55 +02:00
|
|
|
static const QString AttrRotationWay;
|
2017-08-21 12:16:43 +02:00
|
|
|
static const QString AttrTilt;
|
|
|
|
static const QString AttrFoldPosition;
|
2017-08-18 06:59:47 +02:00
|
|
|
static const QString AttrQuantity;
|
|
|
|
static const QString AttrOnFold;
|
2017-08-19 18:10:57 +02:00
|
|
|
static const QString AttrDateFormat;
|
|
|
|
static const QString AttrTimeFormat;
|
2016-10-25 23:00:42 +02:00
|
|
|
static const QString AttrArrows;
|
2016-11-24 20:35:07 +01:00
|
|
|
static const QString AttrNodeReverse;
|
2017-03-21 16:18:48 +01:00
|
|
|
static const QString AttrNodeExcluded;
|
2017-03-24 13:48:07 +01:00
|
|
|
static const QString AttrNodePassmark;
|
|
|
|
static const QString AttrNodePassmarkLine;
|
|
|
|
static const QString AttrNodePassmarkAngle;
|
2017-04-26 10:22:42 +02:00
|
|
|
static const QString AttrNodeShowSecondPassmark;
|
2023-05-06 19:01:15 +02:00
|
|
|
static const QString AttrNodePassmarkOpening;
|
2022-10-21 13:04:24 +02:00
|
|
|
static const QString AttrNodeTurnPoint;
|
2016-11-28 10:58:44 +01:00
|
|
|
static const QString AttrSABefore;
|
|
|
|
static const QString AttrSAAfter;
|
2017-01-16 16:37:15 +01:00
|
|
|
static const QString AttrStart;
|
|
|
|
static const QString AttrPath;
|
|
|
|
static const QString AttrEnd;
|
|
|
|
static const QString AttrIncludeAs;
|
2017-08-21 16:10:55 +02:00
|
|
|
static const QString AttrRotation;
|
2017-08-30 07:55:07 +02:00
|
|
|
static const QString AttrNumber;
|
2018-03-05 11:05:59 +01:00
|
|
|
static const QString AttrCheckUniqueness;
|
2019-04-17 12:02:22 +02:00
|
|
|
static const QString AttrManualPassmarkLength;
|
|
|
|
static const QString AttrPassmarkLength;
|
2023-05-06 19:01:15 +02:00
|
|
|
static const QString AttrManualPassmarkWidth;
|
|
|
|
static const QString AttrPassmarkWidth;
|
|
|
|
static const QString AttrManualPassmarkAngle;
|
|
|
|
static const QString AttrPassmarkAngle;
|
2019-12-13 09:51:29 +01:00
|
|
|
static const QString AttrOpacity;
|
2020-03-24 16:31:32 +01:00
|
|
|
static const QString AttrTags;
|
2022-01-28 15:54:20 +01:00
|
|
|
static const QString AttrTransform;
|
|
|
|
static const QString AttrHold;
|
|
|
|
static const QString AttrZValue;
|
|
|
|
static const QString AttrImageId;
|
2022-08-06 12:33:07 +02:00
|
|
|
static const QString AttrDimensionA;
|
|
|
|
static const QString AttrDimensionB;
|
|
|
|
static const QString AttrDimensionC;
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2022-01-11 16:24:16 +01:00
|
|
|
static const QString AttrContentType;
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2017-09-26 11:54:52 +02:00
|
|
|
static const QString AttrFormula;
|
|
|
|
static const QString AttrDescription;
|
2022-08-03 19:05:09 +02:00
|
|
|
static const QString AttrSpecialUnits;
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2016-11-24 20:35:07 +01:00
|
|
|
static const QString NodeArc;
|
2016-12-20 16:42:51 +01:00
|
|
|
static const QString NodeElArc;
|
2016-11-24 20:35:07 +01:00
|
|
|
static const QString NodePoint;
|
|
|
|
static const QString NodeSpline;
|
|
|
|
static const QString NodeSplinePath;
|
|
|
|
|
2015-06-16 10:30:25 +02:00
|
|
|
signals:
|
|
|
|
/**
|
2016-05-12 21:11:21 +02:00
|
|
|
* @brief ChangedActivPP change active pattern peace.
|
2015-06-16 10:30:25 +02:00
|
|
|
* @param newName new pattern peace name.
|
|
|
|
*/
|
|
|
|
void ChangedActivPP(const QString &newName);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief ChangedCursor change cursor position.
|
|
|
|
* @param id tool id.
|
|
|
|
*/
|
|
|
|
void ChangedCursor(quint32 id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief ChangedNameDraw save new name pattern peace.
|
|
|
|
* @param oldName old name.
|
|
|
|
* @param newName new name.
|
|
|
|
*/
|
|
|
|
void ChangedNameDraw(const QString &oldName, const QString &newName);
|
|
|
|
/**
|
|
|
|
* @brief FullUpdateFromFile update tool data form file.
|
|
|
|
*/
|
|
|
|
void FullUpdateFromFile();
|
|
|
|
/**
|
|
|
|
* @brief patternChanged emit if we have unsaved change.
|
|
|
|
*/
|
|
|
|
void patternChanged(bool saved);
|
2017-08-17 18:57:46 +02:00
|
|
|
void UpdatePatternLabel();
|
2015-06-16 10:30:25 +02:00
|
|
|
/**
|
|
|
|
* @brief ShowTool highlight tool.
|
|
|
|
* @param id tool id.
|
|
|
|
* @param enable enable or disable highlight.
|
|
|
|
*/
|
|
|
|
void ShowTool(quint32 id, bool enable);
|
|
|
|
void ClearMainWindow();
|
|
|
|
void UndoCommand();
|
|
|
|
void SetEnabledGUI(bool enabled);
|
|
|
|
void CheckLayout();
|
2016-10-14 19:41:37 +02:00
|
|
|
void UpdateInLayoutList();
|
2016-10-14 20:33:12 +02:00
|
|
|
void ShowDetail(quint32 id);
|
2015-06-16 10:30:25 +02:00
|
|
|
void SetCurrentPP(const QString &patterPiece);
|
2018-01-22 13:26:53 +01:00
|
|
|
void MadeProgress();
|
2018-03-25 16:43:28 +02:00
|
|
|
/**
|
|
|
|
* @brief UpdateGroups emit if the groups have been updated
|
|
|
|
*/
|
2020-03-24 16:27:16 +01:00
|
|
|
void UpdateGroups();
|
|
|
|
void UpdateToolTip();
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2022-01-28 15:54:20 +01:00
|
|
|
void BackgroundImageTransformationChanged(QUuid id);
|
|
|
|
void BackgroundImagesHoldChanged();
|
|
|
|
void BackgroundImageHoldChanged(const QUuid &id);
|
|
|
|
void BackgroundImageVisibilityChanged(const QUuid &id);
|
|
|
|
void BackgroundImagesVisibilityChanged();
|
|
|
|
void BackgroundImageNameChanged(const QUuid &id);
|
|
|
|
void BackgroundImagesZValueChanged();
|
|
|
|
void BackgroundImagePositionChanged(const QUuid &id);
|
2022-02-04 10:01:52 +01:00
|
|
|
void BackgroundImageOpacityChanged(const QUuid &id);
|
2022-01-28 15:54:20 +01:00
|
|
|
|
2015-06-16 11:04:48 +02:00
|
|
|
public slots:
|
2015-06-16 17:01:17 +02:00
|
|
|
virtual void LiteParseTree(const Document &parse)=0;
|
2015-06-16 11:04:48 +02:00
|
|
|
void haveLiteChange();
|
2016-07-19 19:50:42 +02:00
|
|
|
void NeedFullParsing();
|
|
|
|
void ClearScene();
|
2016-10-14 19:41:37 +02:00
|
|
|
void CheckInLayoutList();
|
2016-10-14 20:33:12 +02:00
|
|
|
void SelectedDetail(quint32 id);
|
2020-03-18 13:45:47 +01:00
|
|
|
void UpdateVisiblityGroups();
|
2015-06-16 11:04:48 +02:00
|
|
|
|
2015-06-16 10:30:25 +02:00
|
|
|
protected:
|
|
|
|
/** @brief nameActivDraw name current pattern peace. */
|
|
|
|
QString nameActivPP;
|
|
|
|
|
|
|
|
/** @brief cursor cursor keep id tool after which we will add new tool in file. */
|
|
|
|
quint32 cursor;
|
|
|
|
|
2016-02-10 17:45:49 +01:00
|
|
|
QVector<VDataTool*> toolsOnRemove;
|
|
|
|
|
2015-06-16 10:30:25 +02:00
|
|
|
/** @brief history history records. */
|
|
|
|
QVector<VToolRecord> history;
|
|
|
|
|
2015-06-16 11:04:48 +02:00
|
|
|
/** @brief patternPieces list of patern pieces names for combobox*/
|
|
|
|
QStringList patternPieces;
|
|
|
|
|
2015-12-18 12:57:03 +01:00
|
|
|
/** @brief modified keep state of the document for cases that do not cover QUndoStack*/
|
|
|
|
mutable bool modified;
|
|
|
|
|
2021-05-07 10:19:06 +02:00
|
|
|
Unit m_units{Unit::LAST_UNIT_DO_NOT_USE};
|
|
|
|
QString m_patternNumber{};
|
|
|
|
QString m_labelDateFormat{};
|
|
|
|
QString m_patternName{};
|
|
|
|
QString m_MPath{};
|
|
|
|
QString m_watermarkPath{};
|
|
|
|
QString m_companyName{};
|
|
|
|
|
2016-12-03 17:44:24 +01:00
|
|
|
/** @brief tools list with pointer on tools. */
|
|
|
|
static QHash<quint32, VDataTool*> tools;
|
2017-08-15 10:38:36 +02:00
|
|
|
/** @brief patternLabelLines list to speed up reading a template by many pieces. */
|
|
|
|
static QVector<VLabelTemplateLine> patternLabelLines;
|
2017-08-30 07:55:07 +02:00
|
|
|
/** @brief patternMaterials list to speed up reading materials by many pieces. */
|
|
|
|
static QMap<int, QString> patternMaterials;
|
2017-08-15 14:22:33 +02:00
|
|
|
static bool patternLabelWasChanged;
|
2016-12-03 17:44:24 +01:00
|
|
|
|
2017-01-16 10:59:02 +01:00
|
|
|
static void ToolExists(const quint32 &id);
|
2023-05-03 13:07:02 +02:00
|
|
|
static auto ParsePathNodes(const QDomElement &domElement) -> VPiecePath;
|
|
|
|
static auto ParseSANode(const QDomElement &domElement) -> VPieceNode;
|
2015-06-16 10:30:25 +02:00
|
|
|
|
|
|
|
void SetActivPP(const QString& name);
|
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto CheckTagExists(const QString &tag) -> QDomElement;
|
2016-04-02 10:37:37 +02:00
|
|
|
void InsertTag(const QStringList &tags, const QDomElement &element);
|
2015-06-16 11:04:48 +02:00
|
|
|
|
2016-06-27 01:17:27 +02:00
|
|
|
void SetChildTag(const QString& qsParent, const QString& qsChild, const QString& qsValue);
|
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetIndexActivPP() const -> int;
|
|
|
|
auto GetActivDrawElement(QDomElement &element) const -> bool;
|
2017-09-25 15:36:04 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getLocalHistory(const QString &draw) const -> QVector<VToolRecord>;
|
2018-03-24 23:42:17 +01:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GroupHasItem(const QDomElement &groupDomElement, quint32 toolId, quint32 objectId) -> bool;
|
2021-05-07 10:19:06 +02:00
|
|
|
|
|
|
|
auto ReadUnits() const -> Unit;
|
|
|
|
auto ReadPatternNumber() const ->QString;
|
|
|
|
auto ReadLabelDateFormat() const ->QString;
|
|
|
|
auto ReadPatternName() const ->QString;
|
|
|
|
auto ReadMPath() const ->QString;
|
|
|
|
auto ReadWatermarkPath() const -> QString;
|
|
|
|
auto ReadCompanyName() const -> QString;
|
|
|
|
|
2015-06-16 10:30:25 +02:00
|
|
|
private:
|
2022-08-12 17:50:13 +02:00
|
|
|
Q_DISABLE_COPY_MOVE(VAbstractPattern) // NOLINT
|
2015-08-11 15:41:03 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto ListIncrements() const -> QStringList;
|
|
|
|
auto ListPointExpressions() const -> QVector<VFormulaField>;
|
|
|
|
auto ListArcExpressions() const -> QVector<VFormulaField>;
|
|
|
|
auto ListElArcExpressions() const -> QVector<VFormulaField>;
|
|
|
|
auto ListSplineExpressions() const -> QVector<VFormulaField>;
|
|
|
|
auto ListPathPointExpressions() const -> QVector<VFormulaField>;
|
|
|
|
auto ListOperationExpressions() const -> QVector<VFormulaField>;
|
|
|
|
auto ListNodesExpressions(const QDomElement &nodes) const -> QVector<VFormulaField>;
|
|
|
|
auto ListPathExpressions() const -> QVector<VFormulaField>;
|
|
|
|
auto ListGrainlineExpressions(const QDomElement &element) const -> QVector<VFormulaField>;
|
|
|
|
auto ListPieceExpressions() const -> QVector<VFormulaField>;
|
|
|
|
auto ListFinalMeasurementsExpressions() const -> QVector<VFormulaField>;
|
|
|
|
|
|
|
|
auto IsVariable(const QString &token) const -> bool;
|
|
|
|
auto IsFunction(const QString &token) const -> bool;
|
|
|
|
|
|
|
|
auto ParseItemElement(const QDomElement &domElement) -> QPair<bool, QMap<quint32, quint32>>;
|
|
|
|
|
|
|
|
auto GetMaterials(const QDomElement &element) const -> QMap<int, QString>;
|
2017-08-30 07:55:07 +02:00
|
|
|
void SetMaterials(QDomElement &element, const QMap<int, QString> &materials);
|
2017-09-26 11:54:52 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto GetFMeasurements(const QDomElement &element) const -> QVector<VFinalMeasurement>;
|
2017-09-26 11:54:52 +02:00
|
|
|
void SetFMeasurements(QDomElement &element, const QVector<VFinalMeasurement> &measurements);
|
2022-01-28 15:54:20 +01:00
|
|
|
|
|
|
|
auto GetBackgroundPatternImage(const QDomElement &element) const -> VBackgroundPatternImage;
|
|
|
|
auto GetBackgroundImageElement(const QUuid &id) const -> QDomElement;
|
|
|
|
void WriteBackgroundImage(QDomElement &element, const VBackgroundPatternImage &image);
|
2015-06-16 10:30:25 +02:00
|
|
|
};
|
|
|
|
|
2021-09-25 11:57:15 +02:00
|
|
|
QT_WARNING_POP
|
|
|
|
|
2017-09-25 17:15:28 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief GetNameActivPP return current pattern piece name.
|
|
|
|
* @return pattern piece name.
|
|
|
|
*/
|
2023-05-03 13:07:02 +02:00
|
|
|
inline auto VAbstractPattern::GetNameActivPP() const -> QString
|
2017-09-25 17:15:28 +02:00
|
|
|
{
|
|
|
|
return nameActivPP;
|
|
|
|
}
|
|
|
|
|
2015-06-16 10:30:25 +02:00
|
|
|
#endif // VABSTRACTPATTERN_H
|