2013-11-15 13:41:26 +01:00
|
|
|
/************************************************************************
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:50:05 +01:00
|
|
|
** @file vdetail.h
|
2014-04-30 07:38:52 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2013-11-15 13:50:05 +01:00
|
|
|
** @date November 15, 2013
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** @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.
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
2013-09-18 21:16:19 +02:00
|
|
|
** 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.
|
|
|
|
**
|
2013-10-27 13:36:29 +01:00
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
2013-09-18 21:16:19 +02:00
|
|
|
** 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/>.
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
*************************************************************************/
|
2013-09-18 21:16:19 +02:00
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
#ifndef VDETAIL_H
|
|
|
|
#define VDETAIL_H
|
|
|
|
|
|
|
|
#include "vnodedetail.h"
|
2013-11-21 13:05:26 +01:00
|
|
|
#include <QVector>
|
|
|
|
|
2015-01-02 18:02:07 +01:00
|
|
|
#include "../libs/vlayout/vabstractdetail.h"
|
|
|
|
|
2014-08-20 13:11:12 +02:00
|
|
|
class VDetailData;
|
2015-01-03 13:22:55 +01:00
|
|
|
class VContainer;
|
2015-01-07 17:54:43 +01:00
|
|
|
class QPainterPath;
|
2013-09-11 16:14:21 +02:00
|
|
|
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief The VDetail class for path of object (points, arcs, splines).
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2015-01-02 18:02:07 +01:00
|
|
|
class VDetail :public VAbstractDetail
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2013-08-28 10:55:11 +02:00
|
|
|
public:
|
2014-02-26 09:18:59 +01:00
|
|
|
VDetail();
|
|
|
|
VDetail(const QString &name, const QVector<VNodeDetail> &nodes);
|
|
|
|
VDetail(const VDetail &detail);
|
|
|
|
VDetail &operator=(const VDetail &detail);
|
2015-01-02 18:02:07 +01:00
|
|
|
virtual ~VDetail();
|
|
|
|
|
2014-02-26 09:18:59 +01:00
|
|
|
void append(const VNodeDetail &node);
|
2013-10-26 22:42:54 +02:00
|
|
|
void Clear();
|
2014-01-07 11:04:29 +01:00
|
|
|
void ClearNodes();
|
2014-02-26 09:18:59 +01:00
|
|
|
qint32 CountNode() const;
|
2014-02-25 15:40:24 +01:00
|
|
|
bool Containes(const quint32 &id)const;
|
2014-10-05 22:25:07 +02:00
|
|
|
VNodeDetail & operator[](int indx);
|
|
|
|
const VNodeDetail & at ( int indx ) const;
|
2015-01-02 18:02:07 +01:00
|
|
|
|
|
|
|
qreal getMx() const;
|
|
|
|
void setMx(const qreal &value);
|
|
|
|
|
|
|
|
qreal getMy() const;
|
|
|
|
void setMy(const qreal &value);
|
|
|
|
|
|
|
|
quint32 id() const;
|
|
|
|
void setId(const quint32 &id);
|
|
|
|
|
2014-02-26 09:18:59 +01:00
|
|
|
QVector<VNodeDetail> getNodes() const;
|
2015-01-02 18:02:07 +01:00
|
|
|
void setNodes(const QVector<VNodeDetail> &value);
|
|
|
|
|
|
|
|
int indexOfNode(const quint32 &id) const;
|
|
|
|
bool OnEdge(const quint32 &p1, const quint32 &p2)const;
|
|
|
|
int Edge(const quint32 &p1, const quint32 &p2)const;
|
|
|
|
void NodeOnEdge(const quint32 &index, VNodeDetail &p1, VNodeDetail &p2)const;
|
|
|
|
VDetail RemoveEdge(const quint32 &index) const;
|
|
|
|
|
2014-02-26 09:18:59 +01:00
|
|
|
QList<quint32> Missing(const VDetail &det) const;
|
2015-01-03 13:22:55 +01:00
|
|
|
|
|
|
|
QVector<QPointF> ContourPoints(const VContainer *data) const;
|
|
|
|
QVector<QPointF> SeamAllowancePoints(const VContainer *data) const;
|
2015-01-07 17:54:43 +01:00
|
|
|
|
|
|
|
QPainterPath ContourPath(const VContainer *data) const;
|
2013-08-28 10:55:11 +02:00
|
|
|
private:
|
2014-08-20 13:11:12 +02:00
|
|
|
QSharedDataPointer<VDetailData> d;
|
2015-01-02 18:02:07 +01:00
|
|
|
|
2014-01-07 11:04:29 +01:00
|
|
|
QVector<VNodeDetail> listNodePoint()const;
|
2015-01-02 18:02:07 +01:00
|
|
|
static int indexOfNode(const QVector<VNodeDetail> &list, const quint32 &id);
|
2015-01-03 13:22:55 +01:00
|
|
|
|
|
|
|
QPointF StartSegment(const VContainer *data, const int &i) const;
|
|
|
|
QPointF EndSegment(const VContainer *data, const int &i) const;
|
|
|
|
|
|
|
|
static QVector<QPointF> biasPoints(const QVector<QPointF> &points, const qreal &mx, const qreal &my);
|
2013-08-28 10:55:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VDETAIL_H
|