Introducing method UniteMainPathPoints. This method will be usefull if need
return "invisible" path after including custom seam allowance as main path. --HG-- branch : develop
This commit is contained in:
parent
61173f75c4
commit
8424222e7c
|
@ -424,6 +424,14 @@ QVector<QPointF> VPiece::MainPathPoints(const VContainer *data) const
|
|||
return points;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QPointF> VPiece::UniteMainPathPoints(const VContainer *data) const
|
||||
{
|
||||
QVector<QPointF> points = VPiecePath::NodesToPoints(data, GetUnitedPath(data));
|
||||
points = CheckLoops(CorrectEquidistantPoints(points));//A path can contains loops
|
||||
return points;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<VPointF> VPiece::MainPathNodePoints(const VContainer *data, bool showExcluded) const
|
||||
{
|
||||
|
|
|
@ -95,6 +95,7 @@ public:
|
|||
void SetPath(const VPiecePath &path);
|
||||
|
||||
QVector<QPointF> MainPathPoints(const VContainer *data) const;
|
||||
QVector<QPointF> UniteMainPathPoints(const VContainer *data) const;
|
||||
QVector<VPointF> MainPathNodePoints(const VContainer *data, bool showExcluded = false) const;
|
||||
QVector<QPointF> SeamAllowancePoints(const VContainer *data) const;
|
||||
QVector<QPointF> CuttingPathPoints(const VContainer *data) const;
|
||||
|
@ -155,14 +156,14 @@ public:
|
|||
VGrainlineData& GetGrainlineGeometry();
|
||||
const VGrainlineData& GetGrainlineGeometry() const;
|
||||
|
||||
QVector<VPieceNode> GetUnitedPath(const VContainer *data) const;
|
||||
|
||||
static QVector<QLineF> SAPassmark(const VPiecePassmarkData &passmarkData, const QVector<QPointF> &seamAllowance);
|
||||
protected:
|
||||
QVector<QPointF> SeamAllowancePointsWithRotation(const VContainer *data, int makeFirst) const;
|
||||
private:
|
||||
QSharedDataPointer<VPieceData> d;
|
||||
|
||||
QVector<VPieceNode> GetUnitedPath(const VContainer *data) const;
|
||||
|
||||
QVector<CustomSARecord> GetValidRecords() const;
|
||||
QVector<CustomSARecord> FilterRecords(QVector<CustomSARecord> records) const;
|
||||
|
||||
|
|
|
@ -351,40 +351,7 @@ bool VPiecePath::IsLastToCuttingCountour() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QPointF> VPiecePath::PathPoints(const VContainer *data, const QVector<QPointF> &cuttingPath) const
|
||||
{
|
||||
QVector<QPointF> points;
|
||||
for (int i = 0; i < CountNodes(); ++i)
|
||||
{
|
||||
if (at(i).IsExcluded())
|
||||
{
|
||||
continue;// skip excluded node
|
||||
}
|
||||
|
||||
switch (at(i).GetTypeTool())
|
||||
{
|
||||
case (Tool::NodePoint):
|
||||
{
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(at(i).GetId());
|
||||
points.append(static_cast<QPointF>(*point));
|
||||
}
|
||||
break;
|
||||
case (Tool::NodeArc):
|
||||
case (Tool::NodeElArc):
|
||||
case (Tool::NodeSpline):
|
||||
case (Tool::NodeSplinePath):
|
||||
{
|
||||
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(at(i).GetId());
|
||||
|
||||
const QPointF begin = StartSegment(data, i, at(i).GetReverse());
|
||||
const QPointF end = EndSegment(data, i, at(i).GetReverse());
|
||||
|
||||
points << curve->GetSegmentPoints(begin, end, at(i).GetReverse());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
qDebug()<<"Get wrong tool type. Ignore."<< static_cast<char>(at(i).GetTypeTool());
|
||||
break;
|
||||
}
|
||||
}
|
||||
QVector<QPointF> points = NodesToPoints(data, d->m_nodes);
|
||||
|
||||
if (GetType() == PiecePathType::InternalPath && not cuttingPath.isEmpty() && points.size() > 1)
|
||||
{
|
||||
|
@ -1205,3 +1172,46 @@ QString VPiecePath::NodeName(const QVector<VPieceNode> &nodes, int nodeIndex, co
|
|||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QPointF> VPiecePath::NodesToPoints(const VContainer *data, const QVector<VPieceNode> &nodes)
|
||||
{
|
||||
QVector<QPointF> points;
|
||||
for (int i = 0; i < nodes.size(); ++i)
|
||||
{
|
||||
const VPieceNode &node = nodes.at(i);
|
||||
if (node.IsExcluded())
|
||||
{
|
||||
continue;// skip excluded node
|
||||
}
|
||||
|
||||
switch (node.GetTypeTool())
|
||||
{
|
||||
case (Tool::NodePoint):
|
||||
{
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(node.GetId());
|
||||
points.append(static_cast<QPointF>(*point));
|
||||
}
|
||||
break;
|
||||
case (Tool::NodeArc):
|
||||
case (Tool::NodeElArc):
|
||||
case (Tool::NodeSpline):
|
||||
case (Tool::NodeSplinePath):
|
||||
{
|
||||
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(node.GetId());
|
||||
|
||||
|
||||
const QPointF begin = StartSegment(data, nodes, i, node.GetReverse());
|
||||
const QPointF end = EndSegment(data, nodes, i, node.GetReverse());
|
||||
|
||||
points << curve->GetSegmentPoints(begin, end, node.GetReverse());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
qDebug()<<"Get wrong tool type. Ignore."<< static_cast<char>(node.GetTypeTool());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return points;
|
||||
}
|
||||
|
|
|
@ -139,6 +139,8 @@ public:
|
|||
|
||||
static QString NodeName(const QVector<VPieceNode> &nodes, int nodeIndex, const VContainer *data);
|
||||
|
||||
static QVector<QPointF> NodesToPoints(const VContainer *data, const QVector<VPieceNode> &nodes);
|
||||
|
||||
private:
|
||||
QSharedDataPointer<VPiecePathData> d;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user