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
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2013 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 VTOOLUNIONDETAILS_H
|
|
|
|
#define VTOOLUNIONDETAILS_H
|
|
|
|
|
|
|
|
#include "vabstracttool.h"
|
2014-06-08 20:10:57 +02:00
|
|
|
#include "../xml/vpattern.h"
|
|
|
|
|
|
|
|
class VPointF;
|
|
|
|
class VMainGraphicsScene;
|
|
|
|
class DialogTool;
|
2013-12-29 17:48:57 +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:
|
2014-02-25 15:40:24 +01:00
|
|
|
VToolUnionDetails(VPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1, const VDetail &d2,
|
2014-06-12 09:22:29 +02:00
|
|
|
const quint32 &indexD1, const quint32 &indexD2, const Source &typeCreation,
|
2014-02-26 10:22:05 +01:00
|
|
|
QObject *parent = nullptr);
|
2014-01-24 16:10:23 +01:00
|
|
|
/**
|
|
|
|
* @brief setDialog set dialog when user want change tool option.
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
virtual void setDialog() {}
|
2014-02-25 15:02:09 +01:00
|
|
|
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
2014-02-26 10:51:37 +01:00
|
|
|
static void Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id,
|
|
|
|
const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene,
|
2014-06-12 09:22:29 +02:00
|
|
|
VPattern *doc, VContainer *data, const Document &parse,
|
|
|
|
const Source &typeCreation);
|
2014-06-02 09:43:27 +02:00
|
|
|
static void PointsOnEdge(const VDetail &d, const quint32 &index, VPointF &p1, VPointF &p2, VContainer *data);
|
2014-06-13 19:02:41 +02:00
|
|
|
static void FindJ(const qint32 &pointsD2, const VDetail &d2, const quint32 &indexD2, qint32 &j);
|
2014-02-25 15:02:09 +01:00
|
|
|
static QVector<VDetail> GetDetailFromFile(VPattern *doc, const QDomElement &domElement);
|
2013-12-29 17:48:57 +01:00
|
|
|
static const QString TagName;
|
|
|
|
static const QString ToolType;
|
|
|
|
static const QString TagDetail;
|
|
|
|
static const QString TagNode;
|
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;
|
2014-02-25 15:02:09 +01:00
|
|
|
static void AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail,
|
2014-02-25 15:40:24 +01:00
|
|
|
const VDetail &det, const ptrdiff_t &i, const quint32 &idTool, const qreal &dx = 0,
|
|
|
|
const qreal &dy = 0, const quint32 &pRotate = 0, const qreal &angle = 0);
|
|
|
|
static void UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &i,
|
|
|
|
quint32 &idCount, const qreal &dx = 0, const qreal &dy = 0, const quint32 &pRotate = 0,
|
2014-01-02 16:50:01 +01:00
|
|
|
const qreal &angle = 0);
|
|
|
|
static void BiasRotatePoint(VPointF *point, const qreal &dx, const qreal &dy, const QPointF &pRotate,
|
|
|
|
const qreal angle);
|
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
|
|
|
*/
|
|
|
|
virtual void FullUpdateFromFile (){}
|
|
|
|
protected:
|
|
|
|
virtual void AddToFile();
|
|
|
|
virtual void RefreshDataInFile();
|
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(VToolUnionDetails)
|
2014-06-13 19:02:41 +02:00
|
|
|
/** @brief d1 first detail. */
|
2013-12-29 17:48:57 +01:00
|
|
|
VDetail d1;
|
2014-06-13 19:02:41 +02:00
|
|
|
|
|
|
|
/** @brief d2 second detail. */
|
2013-12-29 17:48:57 +01:00
|
|
|
VDetail d2;
|
2014-06-13 19:02:41 +02:00
|
|
|
|
|
|
|
/** @brief indexD1 index edge in first detail. */
|
|
|
|
quint32 indexD1;
|
|
|
|
|
|
|
|
/** @brief indexD2 index edge in second detail. */
|
|
|
|
quint32 indexD2;
|
|
|
|
|
2013-12-29 17:48:57 +01:00
|
|
|
void AddDetail(QDomElement &domElement, VDetail &d);
|
2014-01-02 16:50:01 +01:00
|
|
|
void AddNode(QDomElement &domElement, const VNodeDetail &node);
|
|
|
|
QDomNode UpdateDetail(const QDomNode &domNode, const VDetail &d);
|
2013-12-29 17:48:57 +01:00
|
|
|
void AddToModeling(const QDomElement &domElement);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VTOOLUNIONDETAILS_H
|