Move rotation to separate method. Preparetion for working with new setting.

--HG--
branch : feature
This commit is contained in:
dismine 2015-01-22 13:47:20 +02:00
parent 0d1725fc11
commit dd098506dd
2 changed files with 33 additions and 25 deletions

View File

@ -69,31 +69,7 @@ void VPosition::run()
}
frame = frame + 3;
for (int angle = 0; angle <= 360; angle = angle+180)
{
if (*stop)
{
return;
}
QCoreApplication::processEvents();
// We should use copy of the detail.
VLayoutDetail workDetail = detail;
if (CheckRotationEdges(workDetail, j, i, angle))
{
#ifdef LAYOUT_DEBUG
# ifdef SHOW_CANDIDATE_BEST
++frame;
DrawDebug(gContour, workDetail, frame, paperIndex, detailsCount, details);
# endif
#endif
SaveCandidate(bestResult, workDetail, j, i, BestFrom::Rotation);
}
++frame;
}
Rotate(180);
}
//---------------------------------------------------------------------------------------------------------------------
@ -607,6 +583,36 @@ QVector<QPointF> VPosition::CutEdge(const QLineF &edge, unsigned int shift)
return points;
}
//---------------------------------------------------------------------------------------------------------------------
void VPosition::Rotate(int increase)
{
for (int angle = 0; angle <= 360; angle = angle+increase)
{
if (*stop)
{
return;
}
QCoreApplication::processEvents();
// We should use copy of the detail.
VLayoutDetail workDetail = detail;
if (CheckRotationEdges(workDetail, j, i, angle))
{
#ifdef LAYOUT_DEBUG
# ifdef SHOW_CANDIDATE_BEST
++frame;
DrawDebug(gContour, workDetail, frame, paperIndex, detailsCount, details);
# endif
#endif
SaveCandidate(bestResult, workDetail, j, i, BestFrom::Rotation);
}
++frame;
}
}
//---------------------------------------------------------------------------------------------------------------------
bool VPosition::TrueIntersection(const QLineF &gEdge, const QLineF &dEdge, const QPointF &p) const
{

View File

@ -119,6 +119,8 @@ private:
static void AppendWhole(QVector<QPointF> &contour, const VLayoutDetail &detail, int detJ, unsigned int shift);
static QVector<QPointF> CutEdge(const QLineF &edge, unsigned int shift);
void Rotate(int increase);
};
#endif // VPOSITION_H