Fixed issue #302. Error when creating layout.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-05-15 18:15:14 +03:00
parent 3cf421bde4
commit 1ee4ccc8e5
2 changed files with 9 additions and 3 deletions

View File

@ -213,8 +213,7 @@ int VContour::EdgesCount() const
return 1; return 1;
} }
const QLineF axis = QLineF(0, 0, d->paperWidth, 0); const int n = qFloor(EmptySheetEdge().length()/d->shift);
const int n = qFloor(axis.length()/d->shift);
if (n <= 0) if (n <= 0)
{ {
return 1; return 1;
@ -236,7 +235,7 @@ QLineF VContour::GlobalEdge(int i) const
if (d->globalContour.isEmpty()) if (d->globalContour.isEmpty())
{ {
// Because sheet is blank we have one global edge for all cases - Ox axis. // Because sheet is blank we have one global edge for all cases - Ox axis.
const QLineF axis = QLineF(0, 0, d->paperWidth - 5, 0); const QLineF axis = EmptySheetEdge();
if (d->shift == 0) if (d->shift == 0)
{ {
return axis; return axis;
@ -328,3 +327,9 @@ void VContour::AppendWhole(QVector<QPointF> &contour, const VLayoutDetail &detai
++j; ++j;
}while (processedEdges < nD); }while (processedEdges < nD);
} }
//---------------------------------------------------------------------------------------------------------------------
QLineF VContour::EmptySheetEdge() const
{
return QLineF(0, 0, d->paperWidth - 5, 0);
}

View File

@ -65,6 +65,7 @@ public:
QVector<QPointF> UniteWithContour(const VLayoutDetail &detail, int globalI, int detJ, BestFrom type) const; QVector<QPointF> UniteWithContour(const VLayoutDetail &detail, int globalI, int detJ, BestFrom type) const;
QLineF EmptySheetEdge() const;
int EdgesCount() const; int EdgesCount() const;
QLineF GlobalEdge(int i) const; QLineF GlobalEdge(int i) const;
QVector<QPointF> CutEdge(const QLineF &edge) const; QVector<QPointF> CutEdge(const QLineF &edge) const;