Do not use piece's path for nesting. Use only layout allowance path.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-07-21 10:19:00 +03:00
parent 928626d6be
commit e18d328178
3 changed files with 4 additions and 49 deletions

View File

@ -856,24 +856,12 @@ int VLayoutPiece::LayoutEdgesCount() const
return d->layoutAllowance.count(); return d->layoutAllowance.count();
} }
//---------------------------------------------------------------------------------------------------------------------
QLineF VLayoutPiece::DetailEdge(int i) const
{
return Edge(DetailPath(), i);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QLineF VLayoutPiece::LayoutEdge(int i) const QLineF VLayoutPiece::LayoutEdge(int i) const
{ {
return Edge(d->layoutAllowance, i); return Edge(d->layoutAllowance, i);
} }
//---------------------------------------------------------------------------------------------------------------------
int VLayoutPiece::DetailEdgeByPoint(const QPointF &p1) const
{
return EdgeByPoint(DetailPath(), p1);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VLayoutPiece::LayoutEdgeByPoint(const QPointF &p1) const int VLayoutPiece::LayoutEdgeByPoint(const QPointF &p1) const
{ {

View File

@ -133,10 +133,7 @@ public:
int DetailEdgesCount() const; int DetailEdgesCount() const;
int LayoutEdgesCount() const; int LayoutEdgesCount() const;
QLineF DetailEdge(int i) const;
QLineF LayoutEdge(int i) const; QLineF LayoutEdge(int i) const;
int DetailEdgeByPoint(const QPointF &p1) const;
int LayoutEdgeByPoint(const QPointF &p1) const; int LayoutEdgeByPoint(const QPointF &p1) const;
QRectF DetailBoundingRect() const; QRectF DetailBoundingRect() const;

View File

@ -240,14 +240,7 @@ bool VPosition::CheckCombineEdges(VLayoutPiece &detail, int j, int &dEdge)
if (flagMirror && not detail.IsForbidFlipping()) if (flagMirror && not detail.IsForbidFlipping())
{ {
if (m_data.gContour.GetContour().isEmpty()) dEdge = detail.LayoutEdgeByPoint(globalEdge.p2());
{
dEdge = detail.DetailEdgeByPoint(globalEdge.p2());
}
else
{
dEdge = detail.LayoutEdgeByPoint(globalEdge.p2());
}
if (dEdge <= 0) if (dEdge <= 0)
{ {
@ -367,15 +360,7 @@ bool VPosition::SheetContains(const QRectF &rect) const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPosition::CombineEdges(VLayoutPiece &detail, const QLineF &globalEdge, int dEdge) void VPosition::CombineEdges(VLayoutPiece &detail, const QLineF &globalEdge, int dEdge)
{ {
QLineF detailEdge; QLineF detailEdge = detail.LayoutEdge(dEdge);
if (m_data.gContour.GetContour().isEmpty())
{
detailEdge = detail.DetailEdge(dEdge);
}
else
{
detailEdge = detail.LayoutEdge(dEdge);
}
// Find distance between two edges for two begin vertex. // Find distance between two edges for two begin vertex.
const qreal dx = globalEdge.x2() - detailEdge.x2(); const qreal dx = globalEdge.x2() - detailEdge.x2();
@ -396,24 +381,9 @@ void VPosition::CombineEdges(VLayoutPiece &detail, const QLineF &globalEdge, int
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPosition::RotateEdges(VLayoutPiece &detail, const QLineF &globalEdge, int dEdge, qreal angle) const void VPosition::RotateEdges(VLayoutPiece &detail, const QLineF &globalEdge, int dEdge, qreal angle) const
{ {
QLineF detailEdge; QLineF detailEdge = detail.LayoutEdge(dEdge);
if (m_data.gContour.GetContour().isEmpty())
{
detailEdge = detail.DetailEdge(dEdge);
}
else
{
detailEdge = detail.LayoutEdge(dEdge);
}
// Find distance between two edges for two begin vertex.
const qreal dx = globalEdge.x2() - detailEdge.x2();
const qreal dy = globalEdge.y2() - detailEdge.y2();
detailEdge.translate(dx, dy); // Use values for translate detail edge.
// Now we move detail to position near to global contour edge. // Now we move detail to position near to global contour edge.
detail.Translate(dx, dy); detail.Translate(globalEdge.x2() - detailEdge.x2(), globalEdge.y2() - detailEdge.y2());
detail.Rotate(globalEdge.p2(), angle); detail.Rotate(globalEdge.p2(), angle);
} }