2014-02-25 15:02:09 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vpattern.h
|
2014-04-30 07:38:52 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2014-02-25 15:02:09 +01:00
|
|
|
** @date 24 2, 2014
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2014-02-25 15:02:09 +01:00
|
|
|
** <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 VPATTERN_H
|
|
|
|
#define VPATTERN_H
|
|
|
|
|
2015-07-10 11:24:47 +02:00
|
|
|
#include "../ifc/xml/vabstractpattern.h"
|
|
|
|
#include "../ifc/xml/vtoolrecord.h"
|
|
|
|
#include "../vpatterndb/vcontainer.h"
|
2014-06-08 20:10:57 +02:00
|
|
|
|
|
|
|
class VDataTool;
|
|
|
|
class VMainGraphicsScene;
|
2014-02-25 15:02:09 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The VPattern class working with pattern file.
|
|
|
|
*/
|
2015-06-16 10:30:25 +02:00
|
|
|
class VPattern : public VAbstractPattern
|
2014-02-25 15:02:09 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-06-12 09:22:29 +02:00
|
|
|
VPattern(VContainer *data, Draw *mode, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
2014-06-05 13:35:38 +02:00
|
|
|
QObject *parent = nullptr);
|
2014-07-17 14:41:48 +02:00
|
|
|
|
2015-08-16 17:56:06 +02:00
|
|
|
virtual void CreateEmptyFile() Q_DECL_OVERRIDE;
|
2014-07-17 14:41:48 +02:00
|
|
|
|
2014-06-12 09:22:29 +02:00
|
|
|
void Parse(const Document &parse);
|
2015-06-16 10:30:25 +02:00
|
|
|
|
2014-02-25 15:02:09 +01:00
|
|
|
void setCurrentData();
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual void UpdateToolData(const quint32 &id, VContainer *data) Q_DECL_OVERRIDE;
|
2014-08-07 13:17:24 +02:00
|
|
|
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual void IncrementReferens(quint32 id) const Q_DECL_OVERRIDE;
|
|
|
|
virtual void DecrementReferens(quint32 id) const Q_DECL_OVERRIDE;
|
2014-08-07 13:17:24 +02:00
|
|
|
|
2015-06-16 10:30:25 +02:00
|
|
|
quint32 SPointActiveDraw();
|
2014-08-07 13:17:24 +02:00
|
|
|
|
2015-12-26 14:08:41 +01:00
|
|
|
virtual void setXMLContent(const QString &fileName) Q_DECL_OVERRIDE;
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual bool SaveDocument(const QString &fileName, QString &error) const Q_DECL_OVERRIDE;
|
2014-08-08 18:07:44 +02:00
|
|
|
|
2015-06-16 11:04:48 +02:00
|
|
|
QRectF ActiveDrawBoundingRect() const;
|
2014-08-08 18:07:44 +02:00
|
|
|
|
2015-06-16 11:04:48 +02:00
|
|
|
QString GetAuthor() const;
|
|
|
|
void SetAuthor(const QString &text);
|
2014-09-05 10:01:46 +02:00
|
|
|
|
2015-08-25 12:35:50 +02:00
|
|
|
void AddEmptyIncrement(const QString &name);
|
|
|
|
void AddEmptyIncrementAfter(const QString &after, const QString &name);
|
|
|
|
void RemoveIncrement(const QString &name);
|
|
|
|
void MoveUpIncrement(const QString &name);
|
|
|
|
void MoveDownIncrement(const QString &name);
|
|
|
|
|
|
|
|
void SetIncrementName(const QString &name, const QString &text);
|
|
|
|
void SetIncrementFormula(const QString &name, const QString &text);
|
|
|
|
void SetIncrementDescription(const QString &name, const QString &text);
|
|
|
|
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual QString GenerateLabel(const LabelType &type, const QString &reservedName = QString())const Q_DECL_OVERRIDE;
|
2014-11-10 15:49:39 +01:00
|
|
|
|
2015-12-11 15:19:11 +01:00
|
|
|
bool IsDefCustom() const;
|
|
|
|
void SetDefCustom(bool value);
|
|
|
|
|
|
|
|
int GetDefCustomHeight() const;
|
|
|
|
void SetDefCustomHeight(int value);
|
|
|
|
|
|
|
|
int GetDefCustomSize() const;
|
|
|
|
void SetDefCustomSize(int value);
|
|
|
|
|
2016-01-22 11:45:18 +01:00
|
|
|
bool IsReadOnly() const;
|
|
|
|
void SetReadOnly(bool rOnly);
|
|
|
|
|
|
|
|
static const QString AttrReadOnly;
|
|
|
|
|
2014-02-25 15:02:09 +01:00
|
|
|
public slots:
|
2014-08-04 15:37:36 +02:00
|
|
|
void LiteParseTree(const Document &parse);
|
2015-06-16 11:04:48 +02:00
|
|
|
|
2014-06-24 10:23:39 +02:00
|
|
|
protected:
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual void customEvent(QEvent * event) Q_DECL_OVERRIDE;
|
2015-06-16 11:04:48 +02:00
|
|
|
|
2014-02-25 15:02:09 +01:00
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(VPattern)
|
2014-06-05 12:02:35 +02:00
|
|
|
|
2014-12-10 19:33:20 +01:00
|
|
|
/** @brief data container with data. */
|
|
|
|
VContainer *data;
|
|
|
|
|
2014-06-05 12:02:35 +02:00
|
|
|
/** @brief mode current draw mode. */
|
2015-06-16 11:04:48 +02:00
|
|
|
Draw *mode;
|
2014-06-05 12:02:35 +02:00
|
|
|
|
2014-06-05 13:35:38 +02:00
|
|
|
VMainGraphicsScene *sceneDraw;
|
|
|
|
VMainGraphicsScene *sceneDetail;
|
2014-06-05 12:02:35 +02:00
|
|
|
|
2014-07-16 14:47:31 +02:00
|
|
|
void ParseDrawElement(const QDomNode& node, const Document &parse);
|
|
|
|
void ParseDrawMode(const QDomNode& node, const Document &parse, const Draw &mode);
|
|
|
|
void ParseDetailElement(const QDomElement &domElement,
|
2014-06-12 09:22:29 +02:00
|
|
|
const Document &parse);
|
2014-07-16 14:47:31 +02:00
|
|
|
void ParseDetails(const QDomElement &domElement, const Document &parse);
|
2014-05-30 10:32:40 +02:00
|
|
|
void ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
2014-06-12 09:22:29 +02:00
|
|
|
const Document &parse, const QString &type);
|
2014-02-25 15:02:09 +01:00
|
|
|
void ParseLineElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
2014-06-12 09:22:29 +02:00
|
|
|
const Document &parse);
|
2016-02-26 15:38:42 +01:00
|
|
|
void ParseSplineElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
2014-06-12 09:22:29 +02:00
|
|
|
const Document &parse, const QString& type);
|
2014-05-30 13:50:41 +02:00
|
|
|
void ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
2014-06-12 09:22:29 +02:00
|
|
|
const Document &parse, const QString& type);
|
2014-02-25 15:02:09 +01:00
|
|
|
void ParseToolsElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
2014-06-12 09:22:29 +02:00
|
|
|
const Document &parse, const QString& type);
|
2014-02-25 15:02:09 +01:00
|
|
|
void ParseIncrementsElement(const QDomNode& node);
|
2014-06-12 09:22:29 +02:00
|
|
|
void PrepareForParse(const Document &parse);
|
2014-06-18 18:11:14 +02:00
|
|
|
void ToolsCommonAttributes(const QDomElement &domElement, quint32 &id);
|
|
|
|
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx,
|
2015-02-07 12:17:31 +01:00
|
|
|
qreal &my, QString &typeLine, QString &lineColor);
|
2014-06-18 18:11:14 +02:00
|
|
|
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx,
|
|
|
|
qreal &my);
|
|
|
|
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my);
|
|
|
|
void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject,
|
|
|
|
quint32 &idTool);
|
2016-03-17 19:12:48 +01:00
|
|
|
QRectF ToolBoundingRect(const QRectF &rec, const quint32 &id) const;
|
2014-07-30 11:03:50 +02:00
|
|
|
void ParseCurrentPP();
|
2015-10-26 09:36:07 +01:00
|
|
|
QString GetLabelBase(quint32 index)const;
|
2015-06-24 18:14:26 +02:00
|
|
|
|
|
|
|
void ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
2015-06-25 12:52:09 +02:00
|
|
|
void ParseNodePoint(const QDomElement &domElement, const Document &parse);
|
2015-06-24 18:14:26 +02:00
|
|
|
void ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolTriangle(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolPointOfIntersectionArcs(VMainGraphicsScene *scene, const QDomElement &domElement,
|
|
|
|
const Document &parse);
|
2016-01-24 17:15:08 +01:00
|
|
|
void ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseToolPointOfIntersectionCurves(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
2015-06-24 18:14:26 +02:00
|
|
|
void ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDomElement &domElement,
|
|
|
|
const Document &parse);
|
|
|
|
void ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const QDomElement &domElement,
|
|
|
|
const Document &parse);
|
|
|
|
void ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
|
|
|
|
2016-02-26 15:38:42 +01:00
|
|
|
// TODO. Delete if minimal supported version is 0.2.7
|
|
|
|
void ParseOldToolSpline(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
|
|
|
|
|
|
|
void ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
2016-03-10 14:55:04 +01:00
|
|
|
void ParseToolCubicBezier(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
2016-03-04 17:08:29 +01:00
|
|
|
|
|
|
|
// TODO. Delete if minimal supported version is 0.2.7
|
|
|
|
void ParseOldToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
|
|
|
|
2015-06-24 18:14:26 +02:00
|
|
|
void ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
2015-06-25 12:52:09 +02:00
|
|
|
void ParseNodeSpline(const QDomElement &domElement, const Document &parse);
|
|
|
|
void ParseNodeSplinePath(const QDomElement &domElement, const Document &parse);
|
2015-06-24 18:14:26 +02:00
|
|
|
|
|
|
|
void ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
2015-06-25 12:52:09 +02:00
|
|
|
void ParseNodeArc(const QDomElement &domElement, const Document &parse);
|
2015-06-24 18:14:26 +02:00
|
|
|
void ParseToolArcWithLength(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
2015-08-25 12:35:50 +02:00
|
|
|
|
|
|
|
qreal EvalFormula(VContainer *data, const QString &formula, bool *ok) const;
|
|
|
|
|
|
|
|
QDomElement MakeEmptyIncrement(const QString &name);
|
|
|
|
QDomElement FindIncrement(const QString &name) const;
|
2015-12-26 14:08:41 +01:00
|
|
|
|
|
|
|
void GarbageCollector();
|
2014-02-25 15:02:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VPATTERN_H
|