Fixed issue #469. Error - Layout has overlapping pieces in develop branch.
--HG-- branch : develop
This commit is contained in:
parent
2d25702c97
commit
e3ee35bf50
|
@ -252,7 +252,24 @@ int VLayoutDetail::EdgeByPoint(const QPointF &p1) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QRectF VLayoutDetail::BoundingRect() const
|
QRectF VLayoutDetail::DetailBoundingRect() const
|
||||||
|
{
|
||||||
|
QVector<QPointF> points;
|
||||||
|
if (getSeamAllowance())
|
||||||
|
{
|
||||||
|
points = GetSeamAllowencePoints();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
points = GetContourPoints();
|
||||||
|
}
|
||||||
|
|
||||||
|
points.append(points.first());
|
||||||
|
return QPolygonF(points).boundingRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VLayoutDetail::LayoutBoundingRect() const
|
||||||
{
|
{
|
||||||
QVector<QPointF> points = GetLayoutAllowencePoints();
|
QVector<QPointF> points = GetLayoutAllowencePoints();
|
||||||
points.append(points.first());
|
points.append(points.first());
|
||||||
|
@ -262,7 +279,7 @@ QRectF VLayoutDetail::BoundingRect() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VLayoutDetail::Diagonal() const
|
qreal VLayoutDetail::Diagonal() const
|
||||||
{
|
{
|
||||||
const QRectF rec = BoundingRect();
|
const QRectF rec = LayoutBoundingRect();
|
||||||
return qSqrt(pow(rec.height(), 2) + pow(rec.width(), 2));
|
return qSqrt(pow(rec.height(), 2) + pow(rec.width(), 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,8 @@ public:
|
||||||
QLineF Edge(int i) const;
|
QLineF Edge(int i) const;
|
||||||
int EdgeByPoint(const QPointF &p1) const;
|
int EdgeByPoint(const QPointF &p1) const;
|
||||||
|
|
||||||
QRectF BoundingRect() const;
|
QRectF DetailBoundingRect() const;
|
||||||
|
QRectF LayoutBoundingRect() const;
|
||||||
qreal Diagonal() const;
|
qreal Diagonal() const;
|
||||||
|
|
||||||
bool isNull() const;
|
bool isNull() const;
|
||||||
|
|
|
@ -335,7 +335,7 @@ QRectF VLayoutPaper::BoundingRect() const
|
||||||
QRectF rec;
|
QRectF rec;
|
||||||
for (int i=0; i < d->details.count(); ++i)
|
for (int i=0; i < d->details.count(); ++i)
|
||||||
{
|
{
|
||||||
rec = rec.united(d->details.at(i).BoundingRect());
|
rec = rec.united(d->details.at(i).LayoutBoundingRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
return rec;
|
return rec;
|
||||||
|
|
|
@ -264,7 +264,7 @@ bool VPosition::CheckCombineEdges(VLayoutDetail &detail, int j, int &dEdge)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CrossingType type = CrossingType::Intersection;
|
CrossingType type = CrossingType::Intersection;
|
||||||
if (SheetContains(detail.BoundingRect()))
|
if (SheetContains(detail.LayoutBoundingRect()))
|
||||||
{
|
{
|
||||||
if (not gContour.GetContour().isEmpty())
|
if (not gContour.GetContour().isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -306,7 +306,7 @@ bool VPosition::CheckCombineEdges(VLayoutDetail &detail, int j, int &dEdge)
|
||||||
}
|
}
|
||||||
|
|
||||||
CrossingType type = CrossingType::Intersection;
|
CrossingType type = CrossingType::Intersection;
|
||||||
if (SheetContains(detail.BoundingRect()))
|
if (SheetContains(detail.LayoutBoundingRect()))
|
||||||
{
|
{
|
||||||
type = Crossing(detail);
|
type = Crossing(detail);
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ bool VPosition::CheckRotationEdges(VLayoutDetail &detail, int j, int dEdge, int
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CrossingType type = CrossingType::Intersection;
|
CrossingType type = CrossingType::Intersection;
|
||||||
if (SheetContains(detail.BoundingRect()))
|
if (SheetContains(detail.LayoutBoundingRect()))
|
||||||
{
|
{
|
||||||
type = Crossing(detail);
|
type = Crossing(detail);
|
||||||
}
|
}
|
||||||
|
@ -367,21 +367,21 @@ bool VPosition::CheckRotationEdges(VLayoutDetail &detail, int j, int dEdge, int
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPosition::CrossingType VPosition::Crossing(const VLayoutDetail &detail) const
|
VPosition::CrossingType VPosition::Crossing(const VLayoutDetail &detail) const
|
||||||
{
|
{
|
||||||
const QRectF dRect = detail.BoundingRect();
|
|
||||||
const QRectF gRect = gContour.BoundingRect();
|
const QRectF gRect = gContour.BoundingRect();
|
||||||
if (not gRect.intersects(dRect))
|
if (not gRect.intersects(detail.LayoutBoundingRect()) && not gRect.contains(detail.DetailBoundingRect()))
|
||||||
{
|
{
|
||||||
// This we can determine efficiently.
|
// This we can determine efficiently.
|
||||||
return CrossingType::NoIntersection;
|
return CrossingType::NoIntersection;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gContour.ContourPath().intersects(detail.LayoutAllowencePath()))
|
const QPainterPath gPath = gContour.ContourPath();
|
||||||
|
if (not gPath.intersects(detail.LayoutAllowencePath()) && not gPath.contains(detail.ContourPath()))
|
||||||
{
|
{
|
||||||
return CrossingType::Intersection;
|
return CrossingType::NoIntersection;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return CrossingType::NoIntersection;
|
return CrossingType::Intersection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user