Fixed issue #302. Error when creating layout.

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

View File

@ -203,8 +203,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;
@ -226,7 +225,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;
@ -318,3 +317,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

@ -62,6 +62,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;