2013-12-29 17:48:57 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vtooluniondetails.h
|
2014-04-30 07:38:52 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2013-12-29 17:48:57 +01:00
|
|
|
** @date 26 12, 2013
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2013-12-29 17:48:57 +01:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2013-12-29 17:48:57 +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 VTOOLUNIONDETAILS_H
|
|
|
|
#define VTOOLUNIONDETAILS_H
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <qcompilerdetection.h>
|
|
|
|
#include <QDomElement>
|
|
|
|
#include <QDomNode>
|
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QPointF>
|
|
|
|
#include <QString>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
2016-08-09 15:55:46 +02:00
|
|
|
#include "../ifc/ifcdef.h"
|
|
|
|
#include "../ifc/xml/vabstractpattern.h"
|
|
|
|
#include "../vmisc/def.h"
|
2013-12-29 17:48:57 +01:00
|
|
|
#include "vabstracttool.h"
|
2017-01-16 11:08:13 +01:00
|
|
|
#include "../vpatterndb/vpiece.h"
|
2014-06-08 20:10:57 +02:00
|
|
|
|
|
|
|
class DialogTool;
|
2013-12-29 17:48:57 +01:00
|
|
|
|
2017-10-23 09:45:58 +02:00
|
|
|
#define UNION_VERSSION 2
|
|
|
|
|
2017-09-21 09:05:58 +02:00
|
|
|
struct VToolUnionDetailsInitData : VAbstractToolInitData
|
2017-01-16 11:08:13 +01:00
|
|
|
{
|
|
|
|
VToolUnionDetailsInitData()
|
2017-09-18 10:37:23 +02:00
|
|
|
: VAbstractToolInitData(),
|
|
|
|
d1id(NULL_ID),
|
2017-01-16 11:08:13 +01:00
|
|
|
d2id(NULL_ID),
|
|
|
|
indexD1(NULL_ID),
|
|
|
|
indexD2(NULL_ID),
|
2017-10-23 09:45:58 +02:00
|
|
|
retainPieces(false),
|
|
|
|
version(UNION_VERSSION)
|
2017-01-16 11:08:13 +01:00
|
|
|
{}
|
|
|
|
|
|
|
|
quint32 d1id;
|
|
|
|
quint32 d2id;
|
|
|
|
quint32 indexD1;
|
|
|
|
quint32 indexD2;
|
|
|
|
bool retainPieces;
|
2017-10-23 09:45:58 +02:00
|
|
|
uint version;
|
2017-01-16 11:08:13 +01:00
|
|
|
};
|
|
|
|
|
2014-01-24 16:10:23 +01:00
|
|
|
/**
|
|
|
|
* @brief The VToolUnionDetails class tool union details.
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
class VToolUnionDetails : public VAbstractTool
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2018-07-24 13:57:41 +02:00
|
|
|
static VToolUnionDetails *Create(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene,
|
2017-04-15 16:39:59 +02:00
|
|
|
VAbstractPattern *doc, VContainer *data);
|
2017-09-18 10:37:23 +02:00
|
|
|
static VToolUnionDetails *Create(VToolUnionDetailsInitData initData);
|
2016-05-16 19:59:04 +02:00
|
|
|
|
2013-12-29 17:48:57 +01:00
|
|
|
static const QString ToolType;
|
|
|
|
static const QString TagDetail;
|
|
|
|
static const QString TagNode;
|
2016-01-07 17:43:08 +01:00
|
|
|
static const QString TagChildren;
|
|
|
|
static const QString TagChild;
|
2014-01-02 16:50:01 +01:00
|
|
|
static const QString AttrIndexD1;
|
|
|
|
static const QString AttrIndexD2;
|
2013-12-29 17:48:57 +01:00
|
|
|
static const QString AttrIdObject;
|
|
|
|
static const QString AttrNodeType;
|
|
|
|
static const QString NodeTypeContour;
|
|
|
|
static const QString NodeTypeModeling;
|
2017-01-13 09:24:48 +01:00
|
|
|
|
2017-10-23 09:45:58 +02:00
|
|
|
static const quint8 unionVersion;
|
|
|
|
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual QString getTagName() const override;
|
|
|
|
virtual void ShowVisualization(bool show) override;
|
|
|
|
virtual void incrementReferens() override;
|
|
|
|
virtual void decrementReferens() override;
|
|
|
|
virtual void GroupVisibility(quint32 object, bool visible) override;
|
2017-09-11 14:56:18 +02:00
|
|
|
|
|
|
|
static QVector<QPair<bool, VPieceNode> > CalcUnitedPath(const VPiecePath &d1Path, const VPiecePath &d2Path,
|
|
|
|
quint32 indexD2, quint32 pRotate);
|
2013-12-29 17:48:57 +01:00
|
|
|
public slots:
|
|
|
|
/**
|
2014-01-24 13:54:29 +01:00
|
|
|
* @brief FullUpdateFromFile update tool data form file.
|
2013-12-29 17:48:57 +01:00
|
|
|
*/
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual void FullUpdateFromFile () override {}
|
|
|
|
virtual void AllowHover(bool) override {}
|
|
|
|
virtual void AllowSelecting(bool) override {}
|
2013-12-29 17:48:57 +01:00
|
|
|
protected:
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual void AddToFile() override;
|
|
|
|
virtual void SetVisualization() override {}
|
2013-12-29 17:48:57 +01:00
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(VToolUnionDetails)
|
2017-01-16 11:08:13 +01:00
|
|
|
/** @brief d1 first detail id. */
|
|
|
|
quint32 d1id;
|
2014-06-13 19:02:41 +02:00
|
|
|
|
2017-01-16 11:08:13 +01:00
|
|
|
/** @brief d2 second detail id. */
|
|
|
|
quint32 d2id;
|
2014-06-13 19:02:41 +02:00
|
|
|
|
|
|
|
/** @brief indexD1 index edge in first detail. */
|
2017-01-16 11:08:13 +01:00
|
|
|
quint32 indexD1;
|
2014-06-13 19:02:41 +02:00
|
|
|
|
|
|
|
/** @brief indexD2 index edge in second detail. */
|
2017-01-16 11:08:13 +01:00
|
|
|
quint32 indexD2;
|
2016-05-14 21:54:57 +02:00
|
|
|
|
2017-10-23 09:45:58 +02:00
|
|
|
uint version;
|
|
|
|
|
2017-09-18 10:37:23 +02:00
|
|
|
VToolUnionDetails(const VToolUnionDetailsInitData &initData, QObject *parent = nullptr);
|
2016-01-07 17:43:08 +01:00
|
|
|
|
2017-01-16 11:08:13 +01:00
|
|
|
void AddDetail(QDomElement &domElement, const VPiece &d) const;
|
|
|
|
void AddToModeling(const QDomElement &domElement);
|
|
|
|
QVector<quint32> GetReferenceObjects() const;
|
2017-01-18 09:17:18 +01:00
|
|
|
QVector<quint32> ReferenceObjects(const QDomElement &root, const QString &tag, const QString &attribute) const;
|
2013-12-29 17:48:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VTOOLUNIONDETAILS_H
|