2016-11-03 16:59:53 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 3 11, 2016
|
|
|
|
**
|
|
|
|
** @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) 2016 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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "vpiece.h"
|
|
|
|
#include "vpiece_p.h"
|
2016-11-03 19:15:53 +01:00
|
|
|
#include "../vgeometry/vpointf.h"
|
|
|
|
#include "../vgeometry/vabstractcurve.h"
|
|
|
|
#include "vcontainer.h"
|
|
|
|
|
|
|
|
#include <QSharedPointer>
|
|
|
|
#include <QDebug>
|
2016-11-05 09:56:44 +01:00
|
|
|
#include <QPainterPath>
|
2016-11-03 16:59:53 +01:00
|
|
|
|
2017-01-31 17:09:18 +01:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
QVector<quint32> PieceMissingNodes(const QVector<quint32> &d1Nodes, const QVector<quint32> &d2Nodes)
|
|
|
|
{
|
|
|
|
if (d1Nodes.size() == d2Nodes.size()) //-V807
|
|
|
|
{
|
|
|
|
return QVector<quint32>();
|
|
|
|
}
|
|
|
|
|
|
|
|
QSet<quint32> set1;
|
|
|
|
for (qint32 i = 0; i < d1Nodes.size(); ++i)
|
|
|
|
{
|
|
|
|
set1.insert(d1Nodes.at(i));
|
|
|
|
}
|
|
|
|
|
|
|
|
QSet<quint32> set2;
|
|
|
|
for (qint32 j = 0; j < d2Nodes.size(); ++j)
|
|
|
|
{
|
|
|
|
set2.insert(d2Nodes.at(j));
|
|
|
|
}
|
|
|
|
|
|
|
|
const QList<quint32> set3 = set1.subtract(set2).toList();
|
|
|
|
QVector<quint32> r;
|
|
|
|
for (qint32 i = 0; i < set3.size(); ++i)
|
|
|
|
{
|
|
|
|
r.append(set3.at(i));
|
|
|
|
}
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-03 16:59:53 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VPiece::VPiece()
|
2016-11-24 20:26:51 +01:00
|
|
|
: VAbstractPiece(), d(new VPieceData(PiecePathType::PiecePath))
|
2016-11-03 16:59:53 +01:00
|
|
|
{}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VPiece::VPiece(const VPiece &piece)
|
2016-11-03 19:15:53 +01:00
|
|
|
: VAbstractPiece(piece), d (piece.d)
|
2016-11-03 16:59:53 +01:00
|
|
|
{}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VPiece &VPiece::operator=(const VPiece &piece)
|
|
|
|
{
|
|
|
|
if ( &piece == this )
|
|
|
|
{
|
|
|
|
return *this;
|
|
|
|
}
|
2016-11-03 19:15:53 +01:00
|
|
|
VAbstractPiece::operator=(piece);
|
2016-11-03 16:59:53 +01:00
|
|
|
d = piece.d;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VPiece::~VPiece()
|
|
|
|
{}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-11-23 11:54:46 +01:00
|
|
|
VPiecePath VPiece::GetPath() const
|
2016-11-03 16:59:53 +01:00
|
|
|
{
|
2016-11-23 11:54:46 +01:00
|
|
|
return d->m_path;
|
2016-11-03 16:59:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-11-23 11:54:46 +01:00
|
|
|
VPiecePath &VPiece::GetPath()
|
2016-11-03 16:59:53 +01:00
|
|
|
{
|
2016-11-23 11:54:46 +01:00
|
|
|
return d->m_path;
|
2016-11-03 16:59:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-11-23 11:54:46 +01:00
|
|
|
void VPiece::SetPath(const VPiecePath &path)
|
2016-11-03 16:59:53 +01:00
|
|
|
{
|
2016-11-23 11:54:46 +01:00
|
|
|
d->m_path = path;
|
2016-11-03 16:59:53 +01:00
|
|
|
}
|
2016-11-03 19:15:53 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QVector<QPointF> VPiece::MainPathPoints(const VContainer *data) const
|
|
|
|
{
|
2016-11-23 11:54:46 +01:00
|
|
|
QVector<QPointF> points = GetPath().PathPoints(data);
|
2016-11-03 19:15:53 +01:00
|
|
|
points = CheckLoops(CorrectEquidistantPoints(points));//A path can contains loops
|
|
|
|
return points;
|
|
|
|
}
|
|
|
|
|
2016-11-05 09:56:44 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-11-30 14:26:40 +01:00
|
|
|
QVector<VPointF> VPiece::MainPathNodePoints(const VContainer *data) const
|
2016-11-05 09:56:44 +01:00
|
|
|
{
|
2016-11-23 11:54:46 +01:00
|
|
|
return GetPath().PathNodePoints(data);
|
2016-11-05 09:56:44 +01:00
|
|
|
}
|
|
|
|
|
2016-11-10 13:06:09 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QVector<QPointF> VPiece::SeamAllowancePoints(const VContainer *data) const
|
|
|
|
{
|
|
|
|
SCASSERT(data != nullptr);
|
|
|
|
|
2016-11-11 16:55:02 +01:00
|
|
|
|
2016-11-10 13:06:09 +01:00
|
|
|
if (not IsSeamAllowance())
|
|
|
|
{
|
2016-11-11 16:55:02 +01:00
|
|
|
return QVector<QPointF>();
|
2016-11-10 13:06:09 +01:00
|
|
|
}
|
|
|
|
|
2016-11-29 13:10:53 +01:00
|
|
|
const QVector<CustomSARecord> records = GetValidRecords();
|
|
|
|
int recordIndex = -1;
|
|
|
|
bool insertingCSA = false;
|
|
|
|
const qreal width = ToPixel(GetSAWidth(), *data->GetPatternUnit());
|
|
|
|
|
2016-11-11 16:55:02 +01:00
|
|
|
QVector<VSAPoint> pointsEkv;
|
2016-11-23 11:54:46 +01:00
|
|
|
for (int i = 0; i< d->m_path.CountNodes(); ++i)
|
2016-11-10 13:06:09 +01:00
|
|
|
{
|
2016-11-23 11:54:46 +01:00
|
|
|
const VPieceNode &node = d->m_path.at(i);
|
2016-11-12 12:31:37 +01:00
|
|
|
switch (node.GetTypeTool())
|
2016-11-10 13:06:09 +01:00
|
|
|
{
|
|
|
|
case (Tool::NodePoint):
|
|
|
|
{
|
2016-11-29 13:10:53 +01:00
|
|
|
if (not insertingCSA)
|
|
|
|
{
|
|
|
|
pointsEkv.append(VPiecePath::PreparePointEkv(node, data));
|
|
|
|
|
|
|
|
recordIndex = IsCSAStart(records, node.GetId());
|
|
|
|
if (recordIndex != -1)
|
|
|
|
{
|
|
|
|
insertingCSA = true;
|
|
|
|
|
|
|
|
const VPiecePath path = data->GetPiecePath(records.at(recordIndex).path);
|
|
|
|
QVector<VSAPoint> r = path.SeamAllowancePoints(data, width, records.at(recordIndex).reverse);
|
|
|
|
|
|
|
|
if (records.at(recordIndex).includeType == PiecePathIncludeType::AsCustomSA)
|
|
|
|
{
|
|
|
|
for (int j = 0; j < r.size(); ++j)
|
|
|
|
{
|
2016-11-29 14:30:12 +01:00
|
|
|
r[j].SetAngleType(PieceNodeAngle::ByLength);
|
|
|
|
r[j].SetSABefore(0);
|
2016-11-29 15:26:28 +01:00
|
|
|
r[j].SetSAAfter(0);
|
2016-11-29 13:10:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pointsEkv += r;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (records.at(recordIndex).endPoint == node.GetId())
|
|
|
|
{
|
|
|
|
insertingCSA = false;
|
|
|
|
recordIndex = -1;
|
|
|
|
|
|
|
|
pointsEkv.append(VPiecePath::PreparePointEkv(node, data));
|
|
|
|
}
|
|
|
|
}
|
2016-11-10 13:06:09 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case (Tool::NodeArc):
|
2017-02-10 15:47:15 +01:00
|
|
|
case (Tool::NodeElArc):
|
2016-11-10 13:06:09 +01:00
|
|
|
case (Tool::NodeSpline):
|
|
|
|
case (Tool::NodeSplinePath):
|
|
|
|
{
|
2016-11-29 13:10:53 +01:00
|
|
|
if (not insertingCSA)
|
|
|
|
{
|
|
|
|
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(node.GetId());
|
|
|
|
|
|
|
|
pointsEkv += VPiecePath::CurveSeamAllowanceSegment(data, d->m_path.GetNodes(), curve, i,
|
|
|
|
node.GetReverse(), width);
|
|
|
|
}
|
2016-11-10 13:06:09 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2016-11-12 12:31:37 +01:00
|
|
|
qDebug()<<"Get wrong tool type. Ignore."<< static_cast<char>(node.GetTypeTool());
|
2016-11-10 13:06:09 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-29 13:10:53 +01:00
|
|
|
return Equidistant(pointsEkv, width);
|
2016-11-10 13:06:09 +01:00
|
|
|
}
|
|
|
|
|
2016-11-05 09:56:44 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QPainterPath VPiece::MainPathPath(const VContainer *data) const
|
|
|
|
{
|
|
|
|
const QVector<QPointF> points = MainPathPoints(data);
|
|
|
|
QPainterPath path;
|
|
|
|
|
|
|
|
if (not points.isEmpty())
|
|
|
|
{
|
|
|
|
path.moveTo(points[0]);
|
|
|
|
for (qint32 i = 1; i < points.count(); ++i)
|
|
|
|
{
|
|
|
|
path.lineTo(points.at(i));
|
|
|
|
}
|
|
|
|
path.lineTo(points.at(0));
|
|
|
|
path.setFillRule(Qt::WindingFill);
|
|
|
|
}
|
|
|
|
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
|
2016-11-08 11:53:14 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-11-10 13:06:09 +01:00
|
|
|
QPainterPath VPiece::SeamAllowancePath(const VContainer *data) const
|
|
|
|
{
|
|
|
|
const QVector<QPointF> pointsEkv = SeamAllowancePoints(data);
|
|
|
|
QPainterPath ekv;
|
|
|
|
|
|
|
|
// seam allowence
|
|
|
|
if (IsSeamAllowance())
|
|
|
|
{
|
|
|
|
if (not pointsEkv.isEmpty())
|
|
|
|
{
|
|
|
|
ekv.moveTo(pointsEkv.at(0));
|
|
|
|
for (qint32 i = 1; i < pointsEkv.count(); ++i)
|
|
|
|
{
|
|
|
|
ekv.lineTo(pointsEkv.at(i));
|
|
|
|
}
|
|
|
|
|
|
|
|
ekv.setFillRule(Qt::WindingFill);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ekv;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-11-08 11:53:14 +01:00
|
|
|
qreal VPiece::GetMx() const
|
|
|
|
{
|
|
|
|
return d->m_mx;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPiece::SetMx(qreal value)
|
|
|
|
{
|
|
|
|
d->m_mx = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
qreal VPiece::GetMy() const
|
|
|
|
{
|
|
|
|
return d->m_my;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPiece::SetMy(qreal value)
|
|
|
|
{
|
|
|
|
d->m_my = value;
|
|
|
|
}
|
|
|
|
|
2016-11-09 13:11:58 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-11-09 14:53:22 +01:00
|
|
|
bool VPiece::IsInLayout() const
|
|
|
|
{
|
|
|
|
return d->m_inLayout;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPiece::SetInLayout(bool inLayout)
|
|
|
|
{
|
|
|
|
d->m_inLayout = inLayout;
|
|
|
|
}
|
|
|
|
|
2016-11-23 17:40:27 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool VPiece::IsUnited() const
|
|
|
|
{
|
|
|
|
return d->m_united;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPiece::SetUnited(bool united)
|
|
|
|
{
|
|
|
|
d->m_united = united;
|
|
|
|
}
|
|
|
|
|
2017-01-21 14:24:40 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VPiece::GetFormulaSAWidth() const
|
|
|
|
{
|
|
|
|
return d->m_formulaWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPiece::SetFormulaSAWidth(const QString &formula, qreal value)
|
|
|
|
{
|
|
|
|
SetSAWidth(value);
|
|
|
|
const qreal width = GetSAWidth();
|
|
|
|
width >= 0 ? d->m_formulaWidth = formula : d->m_formulaWidth = QLatin1String("0");
|
|
|
|
}
|
|
|
|
|
2016-12-03 17:01:39 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QVector<quint32> VPiece::GetInternalPaths() const
|
|
|
|
{
|
|
|
|
return d->m_internalPaths;
|
|
|
|
}
|
|
|
|
|
2017-01-31 15:26:28 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QVector<quint32> &VPiece::GetInternalPaths()
|
|
|
|
{
|
|
|
|
return d->m_internalPaths;
|
|
|
|
}
|
|
|
|
|
2016-12-03 17:01:39 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPiece::SetInternalPaths(const QVector<quint32> &iPaths)
|
|
|
|
{
|
|
|
|
d->m_internalPaths = iPaths;
|
|
|
|
}
|
|
|
|
|
2017-01-18 09:17:18 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2017-01-31 15:26:28 +01:00
|
|
|
QVector<CustomSARecord> VPiece::GetCustomSARecords() const
|
2017-01-18 09:17:18 +01:00
|
|
|
{
|
2017-01-31 15:26:28 +01:00
|
|
|
return d->m_customSARecords;
|
2017-01-18 09:17:18 +01:00
|
|
|
}
|
|
|
|
|
2016-11-25 13:19:44 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2017-01-31 15:26:28 +01:00
|
|
|
QVector<CustomSARecord> &VPiece::GetCustomSARecords()
|
2016-11-25 13:19:44 +01:00
|
|
|
{
|
|
|
|
return d->m_customSARecords;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPiece::SetCustomSARecords(const QVector<CustomSARecord> &records)
|
|
|
|
{
|
|
|
|
d->m_customSARecords = records;
|
|
|
|
}
|
|
|
|
|
2017-01-18 09:17:18 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2017-01-31 15:26:28 +01:00
|
|
|
QVector<quint32> VPiece::GetPins() const
|
|
|
|
{
|
|
|
|
return d->m_pins;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QVector<quint32> &VPiece::GetPins()
|
|
|
|
{
|
|
|
|
return d->m_pins;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPiece::SetPins(const QVector<quint32> &pins)
|
2017-01-18 09:17:18 +01:00
|
|
|
{
|
2017-01-31 15:26:28 +01:00
|
|
|
d->m_pins = pins;
|
2017-01-18 09:17:18 +01:00
|
|
|
}
|
|
|
|
|
2016-11-09 14:53:22 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-11-09 13:11:58 +01:00
|
|
|
/**
|
2016-11-25 14:35:52 +01:00
|
|
|
* @brief MissingNodes find missing nodes in detail. When we deleted object in detail and return this detail need
|
2016-11-09 13:11:58 +01:00
|
|
|
* understand, what nodes need make invisible.
|
|
|
|
* @param det changed detail.
|
|
|
|
* @return list with missing nodes.
|
|
|
|
*/
|
2016-11-25 15:12:33 +01:00
|
|
|
QVector<quint32> VPiece::MissingNodes(const VPiece &det) const
|
2016-11-09 13:11:58 +01:00
|
|
|
{
|
2016-11-28 09:47:36 +01:00
|
|
|
return d->m_path.MissingNodes(det.GetPath());
|
2016-11-09 13:11:58 +01:00
|
|
|
}
|
|
|
|
|
2016-11-25 15:12:33 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QVector<quint32> VPiece::MissingCSAPath(const VPiece &det) const
|
|
|
|
{
|
2017-01-31 17:09:18 +01:00
|
|
|
QVector<quint32> oldCSARecords;
|
2016-11-25 15:12:33 +01:00
|
|
|
for (qint32 i = 0; i < d->m_customSARecords.size(); ++i)
|
|
|
|
{
|
2017-01-31 17:09:18 +01:00
|
|
|
oldCSARecords.append(d->m_customSARecords.at(i).path);
|
2016-11-25 15:12:33 +01:00
|
|
|
}
|
|
|
|
|
2017-01-31 17:09:18 +01:00
|
|
|
QVector<quint32> newCSARecords;
|
|
|
|
for (qint32 i = 0; i < det.GetCustomSARecords().size(); ++i)
|
2016-11-25 15:12:33 +01:00
|
|
|
{
|
2017-01-31 17:09:18 +01:00
|
|
|
newCSARecords.append(det.GetCustomSARecords().at(i).path);
|
2016-11-25 15:12:33 +01:00
|
|
|
}
|
|
|
|
|
2017-01-31 17:09:18 +01:00
|
|
|
return PieceMissingNodes(oldCSARecords, newCSARecords);
|
2016-11-25 15:12:33 +01:00
|
|
|
}
|
|
|
|
|
2016-11-11 16:55:02 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-12-03 17:01:39 +01:00
|
|
|
QVector<quint32> VPiece::MissingInternalPaths(const VPiece &det) const
|
|
|
|
{
|
2017-01-31 17:09:18 +01:00
|
|
|
return PieceMissingNodes(d->m_internalPaths, det.GetInternalPaths());
|
|
|
|
}
|
2016-12-03 17:01:39 +01:00
|
|
|
|
2017-01-31 17:09:18 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QVector<quint32> VPiece::MissingPins(const VPiece &det) const
|
|
|
|
{
|
|
|
|
return PieceMissingNodes(d->m_pins, det.GetPins());
|
2016-12-03 17:01:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2017-01-12 14:51:08 +01:00
|
|
|
void VPiece::SetPatternPieceData(const VPatternPieceData &data)
|
|
|
|
{
|
|
|
|
d->m_ppData = data;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief Returns full access to the pattern piece data object
|
|
|
|
* @return pattern piece data object
|
|
|
|
*/
|
|
|
|
VPatternPieceData &VPiece::GetPatternPieceData()
|
|
|
|
{
|
|
|
|
return d->m_ppData;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief Returns the read only reference to the pattern piece data object
|
|
|
|
* @return pattern piece data object
|
|
|
|
*/
|
|
|
|
const VPatternPieceData &VPiece::GetPatternPieceData() const
|
|
|
|
{
|
|
|
|
return d->m_ppData;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPiece::SetPatternInfo(const VPatternInfoGeometry &info)
|
|
|
|
{
|
|
|
|
d->m_piPatternInfo = info;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief Returns full access to the pattern info geometry object
|
|
|
|
* @return pattern info geometry object
|
|
|
|
*/
|
|
|
|
VPatternInfoGeometry &VPiece::GetPatternInfo()
|
|
|
|
{
|
|
|
|
return d->m_piPatternInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief Returns the read only reference to the pattern info geometry object
|
|
|
|
* @return pattern info geometry object
|
|
|
|
*/
|
|
|
|
const VPatternInfoGeometry &VPiece::GetPatternInfo() const
|
|
|
|
{
|
|
|
|
return d->m_piPatternInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief VDetail::GetGrainlineGeometry full access to the grainline geometry object
|
|
|
|
* @return reference to grainline geometry object
|
|
|
|
*/
|
|
|
|
VGrainlineGeometry &VPiece::GetGrainlineGeometry()
|
|
|
|
{
|
|
|
|
return d->m_glGrainline;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief VDetail::GetGrainlineGeometry returns the read-only reference to the grainline geometry object
|
|
|
|
* @return reference to grainline geometry object
|
|
|
|
*/
|
|
|
|
const VGrainlineGeometry &VPiece::GetGrainlineGeometry() const
|
|
|
|
{
|
|
|
|
return d->m_glGrainline;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-11-29 13:10:53 +01:00
|
|
|
QVector<CustomSARecord> VPiece::GetValidRecords() const
|
2016-11-11 16:55:02 +01:00
|
|
|
{
|
2016-11-29 13:10:53 +01:00
|
|
|
QVector<CustomSARecord> records;
|
|
|
|
for (int i = 0; i < d->m_customSARecords.size(); ++i)
|
2016-11-11 19:17:39 +01:00
|
|
|
{
|
2016-11-29 13:10:53 +01:00
|
|
|
const CustomSARecord &record = d->m_customSARecords.at(i);
|
2016-11-11 16:55:02 +01:00
|
|
|
|
2016-11-29 15:59:48 +01:00
|
|
|
if (record.startPoint > NULL_ID
|
|
|
|
&& record.path > NULL_ID
|
|
|
|
&& record.endPoint > NULL_ID
|
|
|
|
&& d->m_path.indexOfNode(record.startPoint) != -1
|
|
|
|
&& d->m_path.indexOfNode(record.endPoint) != -1)
|
2016-11-11 19:17:39 +01:00
|
|
|
{
|
2016-11-29 13:10:53 +01:00
|
|
|
records.append(record);
|
2016-11-11 19:17:39 +01:00
|
|
|
}
|
|
|
|
}
|
2016-11-29 13:10:53 +01:00
|
|
|
return records;
|
|
|
|
}
|
2016-11-11 19:17:39 +01:00
|
|
|
|
2016-11-29 13:10:53 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
int VPiece::IsCSAStart(const QVector<CustomSARecord> &records, quint32 id)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < records.size(); ++i)
|
|
|
|
{
|
|
|
|
if (records.at(i).startPoint == id)
|
2016-11-11 19:17:39 +01:00
|
|
|
{
|
2016-11-29 13:10:53 +01:00
|
|
|
return i;
|
2016-11-11 19:17:39 +01:00
|
|
|
}
|
2016-11-11 16:55:02 +01:00
|
|
|
}
|
2016-11-29 13:10:53 +01:00
|
|
|
|
|
|
|
return -1;
|
2016-11-11 16:55:02 +01:00
|
|
|
}
|