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>
|
|
|
|
|
2014-06-08 20:10:57 +02:00
|
|
|
class QString;
|
|
|
|
|
2014-06-12 09:22:29 +02:00
|
|
|
enum class Contour : char { OpenContour, CloseContour };
|
|
|
|
enum class EquidistantType : char { OpenEquidistant, CloseEquidistant };
|
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
|
|
|
*/
|
2013-12-30 20:33:30 +01:00
|
|
|
class VDetail
|
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
|
|
|
/**
|
|
|
|
* @brief VDetail default contructor. Create empty detail.
|
|
|
|
*/
|
|
|
|
VDetail();
|
|
|
|
/**
|
|
|
|
* @brief VDetail constructor.
|
|
|
|
* @param name detail name.
|
|
|
|
* @param nodes list of nodes.
|
|
|
|
*/
|
|
|
|
VDetail(const QString &name, const QVector<VNodeDetail> &nodes);
|
|
|
|
/**
|
|
|
|
* @brief VDetail copy constructor.
|
|
|
|
* @param detail detail.
|
|
|
|
*/
|
|
|
|
VDetail(const VDetail &detail);
|
|
|
|
/**
|
|
|
|
* @brief operator = assignment operator.
|
|
|
|
* @param detail detail.
|
|
|
|
* @return new detail.
|
|
|
|
*/
|
|
|
|
VDetail &operator=(const VDetail &detail);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief append append in the end of list node.
|
|
|
|
* @param node new node.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
void append(const VNodeDetail &node);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief Clear detail full clear.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
void Clear();
|
2014-01-21 14:51:41 +01:00
|
|
|
/**
|
|
|
|
* @brief ClearNodes clear list of nodes.
|
|
|
|
*/
|
2014-01-07 11:04:29 +01:00
|
|
|
void ClearNodes();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief CountNode return count nodes.
|
|
|
|
* @return count.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
qint32 CountNode() const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief Containes check if detail containe this id.
|
|
|
|
* @param id object id.
|
|
|
|
* @return true if containe.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
bool Containes(const quint32 &id)const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief operator [] find node by index in list.
|
|
|
|
* @param indx index node in list.
|
|
|
|
* @return node
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2013-11-06 20:27:43 +01:00
|
|
|
VNodeDetail & operator[](ptrdiff_t indx);
|
2014-01-21 14:51:41 +01:00
|
|
|
/**
|
|
|
|
* @brief at find node by index in list.
|
|
|
|
* @param indx index node in list.
|
|
|
|
* @return const node.
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
const VNodeDetail & at ( ptrdiff_t indx ) const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief getName return detail name.
|
|
|
|
* @return name.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
QString getName() const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief setName set detail name.
|
|
|
|
* @param value new name.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
void setName(const QString &value);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief getMx return bias for X axis.
|
|
|
|
* @return x bias.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
qreal getMx() const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief setMx set bias for X axis.
|
|
|
|
* @param value new x bias.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
void setMx(const qreal &value);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief getMy get bias for y axis.
|
|
|
|
* @return y axis.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
qreal getMy() const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief setMy set bias for y axis.
|
|
|
|
* @param value new y bias.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
void setMy(const qreal &value);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief getSeamAllowance keep status for seam allowance detail.
|
|
|
|
* @return true - need seam allowance, false - no need seam allowance.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
bool getSeamAllowance() const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief setSeamAllowance set status for seam allowance detail.
|
|
|
|
* @param value true - need seam allowance, false - no need seam allowance.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
void setSeamAllowance(bool value);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief getClosed keep close status for detail equdistant.
|
|
|
|
* @return true - close equdistant, false - don't close equdistant.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
bool getClosed() const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief setClosed set close status for detail equdistant.
|
|
|
|
* @param value true - close equdistant, false - don't close equdistant.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
void setClosed(bool value);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief getWidth return value detail seam allowance.
|
|
|
|
* @return value in mm.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
qreal getWidth() const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief setWidth set value detail seam allowance.
|
|
|
|
* @param value width in mm.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
void setWidth(const qreal &value);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief getNodes return list of nodes.
|
|
|
|
* @return list of nodes.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
QVector<VNodeDetail> getNodes() const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief setNodes set list of nodes
|
|
|
|
* @param value list of nodes
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
void setNodes(const QVector<VNodeDetail> &value);
|
2014-01-21 14:51:41 +01:00
|
|
|
/**
|
|
|
|
* @brief indexOfNode return index in list node using id object.
|
|
|
|
* @param id object (arc, point, spline, splinePath) id.
|
|
|
|
* @return index in list or -1 id can't find.
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
ptrdiff_t indexOfNode(const quint32 &id) const;
|
2014-01-21 14:51:41 +01:00
|
|
|
/**
|
|
|
|
* @brief id return id detail in list data.
|
|
|
|
* @return id.
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
quint32 id() const;
|
2014-01-21 14:51:41 +01:00
|
|
|
/**
|
|
|
|
* @brief setId set id detail in list data.
|
|
|
|
* @param id detail id.
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
void setId(const quint32 &id);
|
2014-01-21 14:51:41 +01:00
|
|
|
/**
|
|
|
|
* @brief OnEdge checks if two poins located on the edge. Edge is line between two points. If between two points
|
|
|
|
* located arcs or splines ignore this.
|
|
|
|
* @param p1 id first point.
|
|
|
|
* @param p2 id second point.
|
|
|
|
* @return true - on edge, false - no.
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
bool OnEdge(const quint32 &p1, const quint32 &p2)const;
|
2014-01-21 14:51:41 +01:00
|
|
|
/**
|
|
|
|
* @brief Edge return edge index in detail. Edge is line between two points. If between two points
|
|
|
|
* located arcs or splines ignore this.
|
|
|
|
* @param p1 id first point.
|
|
|
|
* @param p2 id second point.
|
|
|
|
* @return edge index or -1 if points don't located on edge
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
ptrdiff_t Edge(const quint32 &p1, const quint32 &p2)const;
|
2014-01-21 14:51:41 +01:00
|
|
|
/**
|
|
|
|
* @brief NodeOnEdge return nodes located on edge with index.
|
|
|
|
* @param index index of edge.
|
|
|
|
* @param p1 first node.
|
|
|
|
* @param p2 second node.
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
void NodeOnEdge(const quint32 &index, VNodeDetail &p1, VNodeDetail &p2)const;
|
2014-01-21 14:51:41 +01:00
|
|
|
/**
|
|
|
|
* @brief RemoveEdge return detail without edge with index.
|
|
|
|
* @param index idex of edge.
|
2014-06-01 12:18:55 +02:00
|
|
|
* @return detail without edge with index.
|
2014-01-21 14:51:41 +01:00
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
VDetail RemoveEdge(const quint32 &index) const;
|
2014-01-21 14:51:41 +01:00
|
|
|
/**
|
|
|
|
* @brief Missing find missing ids in detail. When we deleted object in detail and return this detail need
|
|
|
|
* understand, what nodes need make invisible.
|
|
|
|
* @param det changed detail.
|
|
|
|
* @return list with missing detail.
|
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
QList<quint32> Missing(const VDetail &det) const;
|
2013-08-28 10:55:11 +02:00
|
|
|
private:
|
2014-01-21 14:51:41 +01:00
|
|
|
/**
|
|
|
|
* @brief _id id detail.
|
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
quint32 _id;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief nodes list detail nodes.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2013-08-28 10:55:11 +02:00
|
|
|
QVector<VNodeDetail> nodes;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief name detail name.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
QString name;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief mx bias x axis.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
qreal mx;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief my bias y axis.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
qreal my;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief seamAllowance status seamAllowance detail.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-01-21 14:51:41 +01:00
|
|
|
bool seamAllowance;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief closed status equdistant detail.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
bool closed;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-21 14:51:41 +01:00
|
|
|
* @brief width value seamAllowance in mm.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2013-10-26 22:42:54 +02:00
|
|
|
qreal width;
|
2014-01-21 14:51:41 +01:00
|
|
|
/**
|
|
|
|
* @brief listNodePoint return list nodes only with points.
|
|
|
|
* @return list points node.
|
|
|
|
*/
|
2014-01-07 11:04:29 +01:00
|
|
|
QVector<VNodeDetail> listNodePoint()const;
|
2014-01-21 14:51:41 +01:00
|
|
|
/**
|
|
|
|
* @brief indexOfNode return index in list node using id object.
|
|
|
|
* @param list list nodes detail.
|
|
|
|
* @param id object (arc, point, spline, splinePath) id.
|
|
|
|
* @return index in list or -1 id can't find.
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
static ptrdiff_t indexOfNode(const QVector<VNodeDetail> &list, const quint32 &id);
|
2013-08-28 10:55:11 +02:00
|
|
|
};
|
|
|
|
|
2014-02-26 09:18:59 +01:00
|
|
|
inline void VDetail::append(const VNodeDetail &node)
|
|
|
|
{
|
|
|
|
nodes.append(node);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline qint32 VDetail::CountNode() const
|
|
|
|
{
|
|
|
|
return nodes.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline QString VDetail::getName() const
|
|
|
|
{
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void VDetail::setName(const QString &value)
|
|
|
|
{
|
|
|
|
name = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline qreal VDetail::getMx() const
|
|
|
|
{
|
|
|
|
return mx;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void VDetail::setMx(const qreal &value)
|
|
|
|
{
|
|
|
|
mx = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline qreal VDetail::getMy() const
|
|
|
|
{
|
|
|
|
return my;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void VDetail::setMy(const qreal &value)
|
|
|
|
{
|
|
|
|
my = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool VDetail::getSeamAllowance() const
|
|
|
|
{
|
|
|
|
return seamAllowance;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void VDetail::setSeamAllowance(bool value)
|
|
|
|
{
|
|
|
|
seamAllowance = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool VDetail::getClosed() const
|
|
|
|
{
|
|
|
|
return closed;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void VDetail::setClosed(bool value)
|
|
|
|
{
|
|
|
|
closed = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline qreal VDetail::getWidth() const
|
|
|
|
{
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void VDetail::setWidth(const qreal &value)
|
|
|
|
{
|
|
|
|
width = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline QVector<VNodeDetail> VDetail::getNodes() const
|
|
|
|
{
|
|
|
|
return nodes;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void VDetail::setNodes(const QVector<VNodeDetail> &value)
|
|
|
|
{
|
|
|
|
nodes = value;
|
|
|
|
}
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
#endif // VDETAIL_H
|